Skip to content

split authkey setup script and invoke during poststart#56

Open
rajsinghtech wants to merge 1 commit into
tailscale:mainfrom
rajsinghtech:rajsinghtech/poststart
Open

split authkey setup script and invoke during poststart#56
rajsinghtech wants to merge 1 commit into
tailscale:mainfrom
rajsinghtech:rajsinghtech/poststart

Conversation

@rajsinghtech

@rajsinghtech rajsinghtech commented Jul 12, 2025

Copy link
Copy Markdown

The devcontainer was failing to authenticate automatically with TS_AUTH_KEY when env var was setup. The root cause was a timing issue:

  • Build Phase: Feature installs and entrypoint runs (secrets NOT available)
  • Runtime Phase: GitHub Codespaces injects secrets (too late for entrypoint)

This meant TS_AUTH_KEY was undefined when the authentication logic ran.
Changes

  • Added postCreateCommand to run auth script
  • Removed auth logic from entrypoint
  • Created new script for authentication

fixes: #53

@rajsinghtech
rajsinghtech force-pushed the rajsinghtech/poststart branch from dd9d79d to c1dc556 Compare July 12, 2025 01:26
@rajsinghtech rajsinghtech changed the title add tailscaled-auth-setup script for post-creation authentication split authkey setup script and invoke during poststart Jul 12, 2025
@calebshay

Copy link
Copy Markdown

Just going to throw it out there that this worked for me as well. Would be nice to get it into the latest release.

@calpoy

calpoy commented Jul 14, 2026

Copy link
Copy Markdown

In my Codespace, the Feature wasn’t seeing TS_AUTH_KEY or CODESPACE_NAME during the entrypoint either, even though both were available later in interactive shells.

Adding the following to the consuming repository’s devcontainer.json made the existing Feature work without any modifications:

"containerEnv": {
  "TS_AUTH_KEY": "${localEnv:TS_AUTH_KEY}",
  "CODESPACE_NAME": "${localEnv:CODESPACE_NAME}"
}

After doing this, the Feature successfully auto-authenticated with Tailscale and used CODESPACE_NAME as the hostname.

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.

never login with key env

3 participants