53
53
- name : Get PR number, title, and branch name
54
54
id : pr_info
55
55
run : |
56
- set -e pipefail
56
+ set -euo pipefail
57
57
PR_NUMBER=${{ github.event.inputs.pr_number || github.event.pull_request.number }}
58
58
PR_TITLE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.title')
59
59
PR_BRANCH=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.head.ref')
65
65
- name : Set required tags
66
66
id : set_tags
67
67
run : |
68
- set -e pipefail
68
+ set -euo pipefail
69
69
echo "CODER_BASE_IMAGE_TAG=$CODER_BASE_IMAGE_TAG" >> $GITHUB_OUTPUT
70
70
echo "CODER_IMAGE_TAG=$CODER_IMAGE_TAG" >> $GITHUB_OUTPUT
71
71
env :
@@ -74,15 +74,15 @@ jobs:
74
74
75
75
- name : Set up kubeconfig
76
76
run : |
77
- set -e pipefail
77
+ set -euo pipefail
78
78
mkdir -p ~/.kube
79
79
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
80
80
export KUBECONFIG=~/.kube/config
81
81
82
82
- name : Check if the helm deployment already exists
83
83
id : check_deployment
84
84
run : |
85
- set -e pipefail
85
+ set -euo pipefail
86
86
if helm status "pr${{ steps.pr_info.outputs.PR_NUMBER }}" --namespace "pr${{ steps.pr_info.outputs.PR_NUMBER }}" > /dev/null 2>&1; then
87
87
echo "Deployment already exists. Skipping deployment."
88
88
new=false
@@ -151,7 +151,7 @@ jobs:
151
151
- name : Print number of changed files
152
152
if : github.event_name == 'workflow_dispatch' || steps.check_deployment.outputs.NEW == 'false'
153
153
run : |
154
- set -e pipefail
154
+ set -euo pipefail
155
155
echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}"
156
156
echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}"
157
157
@@ -190,7 +190,7 @@ jobs:
190
190
191
191
- name : Build and push Linux amd64 Docker image
192
192
run : |
193
- set -e pipefail
193
+ set -euo pipefail
194
194
go mod download
195
195
make gen/mark-fresh
196
196
export DOCKER_IMAGE_NO_PREREQUISITES=true
@@ -221,15 +221,15 @@ jobs:
221
221
steps :
222
222
- name : Set up kubeconfig
223
223
run : |
224
- set -e pipefail
224
+ set -euo pipefail
225
225
mkdir -p ~/.kube
226
226
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
227
227
export KUBECONFIG=~/.kube/config
228
228
229
229
- name : Check if image exists
230
230
if : needs.get_info.outputs.NEW == 'true'
231
231
run : |
232
- set -e pipefail
232
+ set -euo pipefail
233
233
foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o ${{ env.CODER_IMAGE_TAG }} | head -n 1)
234
234
if [ -z "$foundTag" ]; then
235
235
echo "Image not found"
@@ -254,7 +254,7 @@ jobs:
254
254
- name : Create PR namespace
255
255
if : needs.get_info.outputs.NEW == 'true'
256
256
run : |
257
- set -e pipefail
257
+ set -euo pipefail
258
258
# try to delete the namespace, but don't fail if it doesn't exist
259
259
kubectl delete namespace "pr${{ env.PR_NUMBER }}" || true
260
260
kubectl create namespace "pr${{ env.PR_NUMBER }}"
@@ -313,7 +313,7 @@ jobs:
313
313
if : needs.get_info.outputs.NEW == 'true'
314
314
# This service account will be used to grant full access to the namespace from the workspace
315
315
run : |
316
- set -e pipefail
316
+ set -euo pipefail
317
317
# Create service account, role, rolebinding and secret
318
318
cat <<EOF | kubectl apply -f -
319
319
apiVersion: v1
@@ -446,7 +446,7 @@ jobs:
446
446
447
447
- name : Install/Upgrade Helm chart
448
448
run : |
449
- set -e pipefail
449
+ set -euo pipefail
450
450
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then
451
451
helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm \
452
452
--namespace "pr${{ env.PR_NUMBER }}" \
@@ -474,7 +474,7 @@ jobs:
474
474
- name : Get Coder binary
475
475
if : needs.get_info.outputs.NEW == 'true'
476
476
run : |
477
- set -e pipefail
477
+ set -euo pipefail
478
478
479
479
DEST="${HOME}/coder"
480
480
URL="https://${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-linux-amd64"
@@ -501,7 +501,7 @@ jobs:
501
501
if : needs.get_info.outputs.NEW == 'true'
502
502
id : setup_deployment
503
503
run : |
504
- set -e pipefail
504
+ set -euo pipefail
505
505
506
506
# Create first user
507
507
0 commit comments