Skip to content

Commit 1bd93df

Browse files
committed
Experimenting
1 parent 2b49897 commit 1bd93df

File tree

2 files changed

+46
-84
lines changed

2 files changed

+46
-84
lines changed

.github/workflows/tailscale.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ on:
44
workflow_dispatch:
55
push:
66
branches:
7-
- main
7+
- 'mpminardi/windows-experiments'
88
pull_request:
99
branches:
1010
- '*'
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-latest
14+
runs-on: windows-latest
1515
steps:
1616
- name: Check out code
1717
uses: actions/checkout@v2
@@ -23,6 +23,6 @@ jobs:
2323
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
2424
tags: tag:ci
2525

26-
- name: check for hello.ts.net in netmap
27-
run:
28-
tailscale status | grep -q hello
26+
#- name: check for hello.ts.net in netmap
27+
# run:
28+
# tailscale status | grep -q hello

action.yml

Lines changed: 41 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -51,89 +51,51 @@ inputs:
5151
runs:
5252
using: 'composite'
5353
steps:
54-
- name: Check Runner OS
55-
if: ${{ runner.os != 'Linux' }}
56-
shell: bash
57-
run: |
58-
echo "::error title=⛔ error hint::Support Linux Only"
59-
exit 1
6054
- name: Check Auth Info Empty
6155
if: ${{ inputs.authkey == '' && (inputs['oauth-secret'] == '' || inputs.tags == '') }}
6256
shell: bash
6357
run: |
6458
echo "::error title=⛔ error hint::OAuth identity empty, Maybe you need to populate it in the Secrets for your workflow, see more in https://docs.github.com/en/actions/security-guides/encrypted-secrets and https://tailscale.com/s/oauth-clients"
6559
exit 1
66-
- name: Download Tailscale
67-
shell: bash
68-
id: download
69-
env:
70-
VERSION: ${{ inputs.version }}
71-
SHA256SUM: ${{ inputs.sha256sum }}
72-
run: |
73-
if [ "$VERSION" = "latest" ]; then
74-
VERSION=$(curl -s "https://pkgs.tailscale.com/stable/?mode=json" | jq -r .Version)
75-
echo "Latest Tailscale version: $VERSION"
76-
fi
77-
if [ ${{ runner.arch }} = "ARM64" ]; then
78-
TS_ARCH="arm64"
79-
elif [ ${{ runner.arch }} = "ARM" ]; then
80-
TS_ARCH="arm"
81-
elif [ ${{ runner.arch }} = "X86" ]; then
82-
TS_ARCH="386"
83-
elif [ ${{ runner.arch }} = "X64" ]; then
84-
TS_ARCH="amd64"
85-
else
86-
TS_ARCH="amd64"
87-
fi
88-
MINOR=$(echo "$VERSION" | awk -F '.' {'print $2'})
89-
if [ $((MINOR % 2)) -eq 0 ]; then
90-
URL="https://pkgs.tailscale.com/stable/tailscale_${VERSION}_${TS_ARCH}.tgz"
91-
else
92-
URL="https://pkgs.tailscale.com/unstable/tailscale_${VERSION}_${TS_ARCH}.tgz"
93-
fi
94-
echo "Downloading $URL"
95-
curl -H user-agent:tailscale-github-action -L "$URL" -o tailscale.tgz --max-time 300 --fail
96-
if ! [[ "$SHA256SUM" ]] ; then
97-
SHA256SUM="$(curl -H user-agent:tailscale-github-action -L "${URL}.sha256" --fail)"
98-
fi
99-
echo "Expected sha256: $SHA256SUM"
100-
echo "Actual sha256: $(sha256sum tailscale.tgz)"
101-
echo "$SHA256SUM tailscale.tgz" | sha256sum -c
102-
tar -C /tmp -xzf tailscale.tgz
103-
rm tailscale.tgz
104-
TSPATH=/tmp/tailscale_${VERSION}_${TS_ARCH}
105-
sudo mv "${TSPATH}/tailscale" "${TSPATH}/tailscaled" /usr/bin
106-
- name: Start Tailscale Daemon
107-
shell: bash
108-
env:
109-
ADDITIONAL_DAEMON_ARGS: ${{ inputs.tailscaled-args }}
110-
STATEDIR: ${{ inputs.statedir }}
111-
run: |
112-
if [ "$STATEDIR" == "" ]; then
113-
STATE_ARGS="--state=mem:"
114-
else
115-
STATE_ARGS="--statedir=${STATEDIR}"
116-
mkdir -p "$STATEDIR"
117-
fi
118-
sudo -E tailscaled ${STATE_ARGS} ${ADDITIONAL_DAEMON_ARGS} 2>~/tailscaled.log &
119-
# And check that tailscaled came up. The CLI will block for a bit waiting
120-
# for it. And --json will make it exit with status 0 even if we're logged
121-
# out (as we will be). Without --json it returns an error if we're not up.
122-
sudo -E tailscale status --json >/dev/null
123-
- name: Connect to Tailscale
124-
shell: bash
125-
env:
126-
ADDITIONAL_ARGS: ${{ inputs.args }}
127-
HOSTNAME: ${{ inputs.hostname }}
128-
TAILSCALE_AUTHKEY: ${{ inputs.authkey }}
129-
TIMEOUT: ${{ inputs.timeout }}
130-
TS_EXPERIMENT_OAUTH_AUTHKEY: true
60+
- name: Install Tailscale
61+
shell: pwsh
13162
run: |
132-
if [ -z "${HOSTNAME}" ]; then
133-
HOSTNAME="github-$(cat /etc/hostname)"
134-
fi
135-
if [ -n "${{ inputs['oauth-secret'] }}" ]; then
136-
TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true"
137-
TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
138-
fi
139-
timeout --verbose --kill-after=1s ${TIMEOUT} sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}
63+
choco install tailscale
64+
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
65+
refreshenv
66+
tailscale status
67+
cat 'C:\ProgramData\chocolatey\logs\chocolatey.log'
68+
#- name: Start Tailscale Daemon
69+
# shell: bash
70+
# env:
71+
# ADDITIONAL_DAEMON_ARGS: ${{ inputs.tailscaled-args }}
72+
# STATEDIR: ${{ inputs.statedir }}
73+
# run: |
74+
# if [ "$STATEDIR" == "" ]; then
75+
# STATE_ARGS="--state=mem:"
76+
# else
77+
# STATE_ARGS="--statedir=${STATEDIR}"
78+
# mkdir -p "$STATEDIR"
79+
# fi
80+
# sudo -E tailscaled ${STATE_ARGS} ${ADDITIONAL_DAEMON_ARGS} 2>~/tailscaled.log &
81+
# # And check that tailscaled came up. The CLI will block for a bit waiting
82+
# # for it. And --json will make it exit with status 0 even if we're logged
83+
# # out (as we will be). Without --json it returns an error if we're not up.
84+
# sudo -E tailscale status --json >/dev/null
85+
#- name: Connect to Tailscale
86+
# shell: bash
87+
# env:
88+
# ADDITIONAL_ARGS: ${{ inputs.args }}
89+
# HOSTNAME: ${{ inputs.hostname }}
90+
# TAILSCALE_AUTHKEY: ${{ inputs.authkey }}
91+
# TIMEOUT: ${{ inputs.timeout }}
92+
# TS_EXPERIMENT_OAUTH_AUTHKEY: true
93+
# run: |
94+
# if [ -z "${HOSTNAME}" ]; then
95+
# HOSTNAME="github-$(cat /etc/hostname)"
96+
# fi
97+
# if [ -n "${{ inputs['oauth-secret'] }}" ]; then
98+
# TAILSCALE_AUTHKEY="${{ inputs['oauth-secret'] }}?preauthorized=true&ephemeral=true"
99+
# TAGS_ARG="--advertise-tags=${{ inputs.tags }}"
100+
# fi
101+
# timeout --verbose --kill-after=1s ${TIMEOUT} sudo -E tailscale up ${TAGS_ARG} --authkey=${TAILSCALE_AUTHKEY} --hostname=${HOSTNAME} --accept-routes ${ADDITIONAL_ARGS}

0 commit comments

Comments
 (0)