teach autoconf sccache code about namespace tokens#5188
Open
graydon wants to merge 1 commit intostellar:masterfrom
Open
teach autoconf sccache code about namespace tokens#5188graydon wants to merge 1 commit intostellar:masterfrom
graydon wants to merge 1 commit intostellar:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support in configure.ac for using a named/persistent NSC namespace token file when configuring sccache via nsc, including auto-detection and workstation guidance.
Changes:
- Introduces
--with-nsc-token-file=PATHconfigure option and auto-detection ofnamespace-token.jsonin common locations. - Adds workstation-only enforcement (when
NAMESPACE_GITHUB_RUNTIMEis unset) with an actionable error message describing how to create the token. - Plumbs the token file into the
nsc cache sccache setupinvocation.
Comment on lines
+300
to
+307
| # Build the nsc command, appending --token only when we have a file. | ||
| nsc_setup_cmd="$NSC cache sccache setup --cache_name=stellar" | ||
| AS_IF([test -n "$nsc_token_file"], [ | ||
| nsc_setup_cmd="$nsc_setup_cmd --token=$nsc_token_file" | ||
| ]) | ||
|
|
||
| AC_MSG_NOTICE([configuring sccache environment with: $nsc_setup_cmd]) | ||
| NSC_SCCACHE_SETUP=`eval $nsc_setup_cmd` |
Comment on lines
+260
to
+266
| AC_MSG_CHECKING([for namespace-token.json in standard locations]) | ||
| for _nsc_dir in "$(cd "$srcdir" && pwd)" "$(pwd)" "$HOME"; do | ||
| if test -f "$_nsc_dir/namespace-token.json"; then | ||
| nsc_token_file="$_nsc_dir/namespace-token.json" | ||
| break | ||
| fi | ||
| done |
| nsc_token_file="$with_nsc_token_file" | ||
|
|
||
| # Auto-detect namespace-token.json if not explicitly provided. | ||
| AS_IF([test "x$nsc_token_file" = "x" -o "x$nsc_token_file" = "xyes"], [ |
Comment on lines
+289
to
+296
| AS_IF([test ! -f "$nsc_token_file"], [ | ||
| AC_MSG_ERROR([nsc token file '$nsc_token_file' does not exist. | ||
|
|
||
| To generate a token, run: | ||
|
|
||
| nsc cache sccache create-token --cache_name=stellar --token=$nsc_token_file | ||
|
|
||
| Then re-run configure.]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds support to configure.ac for named, persistent namespace tokens, which are mostly necessary for using the shared sccache if you don't want it to freeze up after a half hour when the default tokens (which only last a half hour).
Named, persistent tokens last 90 days, which is better! But you have to save them to a file. So the configure script now sniffs around for one in srcdir, builddir and homedir named namespace-token.json and if it doesn't find one (and detects it's not in a CI-context that doesn't need a token) advises you to make one yourself. It could make one itself but I figured it's probably best to let the user decide how to handle that step, just give them a suggestion. They might already have a token on another machine or in a password vault or something.