Skip to content

Commit

Permalink
action.yml: allow specifying a state directory
Browse files Browse the repository at this point in the history
Fixes #132

Signed-off-by: Anton Tolchanov <[email protected]>
  • Loading branch information
knyar committed Jul 9, 2024
1 parent 0bf9b9f commit a1fb343
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ be automatically removed by the coordination server a short time after they
finish their run. The nodes are also [marked Preapproved](https://tailscale.com/kb/1085/auth-keys/)
on tailnets which use [Device Approval](https://tailscale.com/kb/1099/device-approval/)
If you are using this Action in a [Tailnet
Lock](https://tailscale.com/kb/1226/tailnet-lock) enabled network, you need to
specify a [state
directory](https://tailscale.com/kb/1278/tailscaled#flags-to-tailscaled) for the
client to store the Tailnet Key Authority data in. To do this, set the
`statedir` input variable - for example, `statedir: /tmp/tailscale-state/`

## Defining Tailscale version

Which Tailscale version to use can be set like this:
Expand Down
13 changes: 12 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ inputs:
description: 'Fixed hostname to use.'
required: false
default: ''
statedir:
description: 'Optional state directory to use (if unset, memory state is used)'
required: false
default: ''
runs:
using: 'composite'
steps:
Expand Down Expand Up @@ -95,8 +99,15 @@ runs:
shell: bash
env:
ADDITIONAL_DAEMON_ARGS: ${{ inputs.tailscaled-args }}
STATEDIR: ${{ inputs.statedir }}
run: |
sudo -E tailscaled --state=mem: ${ADDITIONAL_DAEMON_ARGS} 2>~/tailscaled.log &
if [ "$STATEDIR" == "" ]; then
STATE_ARGS="--state=mem:"
else
STATE_ARGS="--statedir=${STATEDIR}"
mkdir -p "$STATEDIR"
fi
sudo -E tailscaled ${STATE_ARGS} ${ADDITIONAL_DAEMON_ARGS} 2>~/tailscaled.log &
# And check that tailscaled came up. The CLI will block for a bit waiting
# for it. And --json will make it exit with status 0 even if we're logged
# out (as we will be). Without --json it returns an error if we're not up.
Expand Down

0 comments on commit a1fb343

Please sign in to comment.