Skip to content

teach autoconf sccache code about namespace tokens#5188

Open
graydon wants to merge 1 commit intostellar:masterfrom
graydon:namespace-sccache-token-support
Open

teach autoconf sccache code about namespace tokens#5188
graydon wants to merge 1 commit intostellar:masterfrom
graydon:namespace-sccache-token-support

Conversation

@graydon
Copy link
Contributor

@graydon graydon commented Mar 19, 2026

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.

Copilot AI review requested due to automatic review settings March 19, 2026 06:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=PATH configure option and auto-detection of namespace-token.json in common locations.
  • Adds workstation-only enforcement (when NAMESPACE_GITHUB_RUNTIME is unset) with an actionable error message describing how to create the token.
  • Plumbs the token file into the nsc cache sccache setup invocation.

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.])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants