You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: 'This mode will use the Userspace networking mode (specially for container where tunnel VPN is not possible). DEPRECATED, not used anymore'
33
+
type: boolean
34
+
required: false
35
+
default: true
36
+
debug:
37
+
description: 'This mode generate the tailscale bug report'
38
+
type: boolean
39
+
required: false
40
+
default: false
41
+
debugEnabled:
42
+
description: 'This mode will allow to SSH to the runner. DEPRECATED, not used, replaced by github runner variable'
43
+
type: boolean
44
+
required: false
45
+
default: false
46
+
acceptDns:
47
+
description: ''
48
+
type: boolean
49
+
required: false
50
+
default: true
51
+
acceptRoutes:
52
+
description: ''
53
+
type: boolean
54
+
required: false
55
+
default: true
56
+
slackChannel:
57
+
description: 'Provide Slack Channel to send SSH information'
58
+
type: string
59
+
required: false
60
+
slackToken:
61
+
description: 'Slack Token to send message'
62
+
type: string
63
+
required: false
64
+
waitForSSH:
65
+
description: 'You can use this action at the end of your job with waitForSSH=true to handle SSH connection in case of workflow failed'
66
+
type: boolean
67
+
required: false
68
+
default: false
69
+
sshTimeout:
70
+
description: 'Number of minute to wait for SSH connection before ending the job'
71
+
type: string
72
+
required: false
73
+
default: "5m"
74
+
sshKeyId:
75
+
description: 'Internal usage. when the SSH Key changed on tailscale, please update the default value. Its in use in this action, to take the following decisions'
76
+
# - if this key is used on the WF, and debug mode is not enabled during action run, no need to connect to tailscale
77
+
# - if tailscale is used for something else than SSH (like internal ressources access), so we are testing internal url access.
78
+
type: string
79
+
required: false
80
+
default: "tskey-auth-kBgJJWKh3311CNTRL"
81
+
runs:
82
+
using: 'composite'
83
+
steps:
84
+
- name: Check Runner OS
85
+
if: ${{ runner.os != 'Linux' }}
86
+
shell: bash
87
+
run: |
88
+
echo "::error title=⛔ error hint::Support Linux Only"
89
+
exit 1
90
+
- name: check debug
91
+
#if: ${{ runner.debug == '1' }}
92
+
shell: bash
93
+
run: |
94
+
if [ "${{ runner.debug }}" = "1" ]; then
95
+
echo "debug"
96
+
else
97
+
echo "no debug"
98
+
fi
99
+
100
+
- name: Check Tailscale Action Usage mode (waitForSSH or Normal)
101
+
id: tailscale-mode
102
+
shell: bash
103
+
run: |
104
+
#if waitForSSH is enabled, we need to check if Tailscale is already connected or not (this parameter must be used for debugging usage when a step of worklfow failed)
105
+
#if Tailscale is already connected, it means the action was already called at the start of the WF with all mandatory inputs, we just need to enable SSH and wait for connection.
106
+
#if Tailscale is not yet connected, we need to execute the entire action (aka setup tailscale) and wait for SSH at the end
107
+
if [ "${{ inputs['waitForSSH'] }}" = true ]; then
108
+
if ! command -v tailscale &> /dev/null
109
+
then
110
+
echo "INSTALL=true" >> $GITHUB_OUTPUT
111
+
echo "WITHSSH=true" >> $GITHUB_OUTPUT
112
+
echo "WAITFORSSH=true" >> $GITHUB_OUTPUT
113
+
else
114
+
echo "INSTALL=false" >> $GITHUB_OUTPUT
115
+
echo "WITHSSH=true" >> $GITHUB_OUTPUT
116
+
echo "WAITFORSSH=true" >> $GITHUB_OUTPUT
117
+
fi
118
+
else
119
+
#if Debug is not enabled, so we need to check why this action is called by checking AUTH_KEY : if the workflow is using SSH'ed key, and debug is not enabled, no need to execute Tailscale
120
+
if [ "${{ runner.debug }}" = "1" ]; then #debug enabled, so connect to tailscale with SSH
121
+
echo "INSTALL=true" >> $GITHUB_OUTPUT
122
+
echo "WITHSSH=true" >> $GITHUB_OUTPUT
123
+
echo "WAITFORSSH=false" >> $GITHUB_OUTPUT
124
+
else
125
+
if [[ "${{ inputs['authkey'] }}" =~ "${{ inputs['sshKeyId'] }}" ]]; then #debug not enabled, so if the Key is the SSH'ed one, no need to execute tailscale
126
+
echo "INSTALL=false" >> $GITHUB_OUTPUT
127
+
echo "WITHSSH=false" >> $GITHUB_OUTPUT
128
+
echo "WAITFORSSH=false" >> $GITHUB_OUTPUT
129
+
else #debug not enable, but need to execute tailscale because it's standard Tailscale Key
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"
#because the SSH can be enabled dynamically if the workflow failed, so we need to store slack infos to be able to retrieve them during the waitforssh step
0 commit comments