Skip to content

Commit c64a7b4

Browse files
committed
use set -euo pipefail
1 parent 5923471 commit c64a7b4

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Get PR number, title, and branch name
5454
id: pr_info
5555
run: |
56-
set -e pipefail
56+
set -euo pipefail
5757
PR_NUMBER=${{ github.event.inputs.pr_number || github.event.pull_request.number }}
5858
PR_TITLE=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/coder/coder/pulls/$PR_NUMBER | jq -r '.title')
5959
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,7 +65,7 @@ jobs:
6565
- name: Set required tags
6666
id: set_tags
6767
run: |
68-
set -e pipefail
68+
set -euo pipefail
6969
echo "CODER_BASE_IMAGE_TAG=$CODER_BASE_IMAGE_TAG" >> $GITHUB_OUTPUT
7070
echo "CODER_IMAGE_TAG=$CODER_IMAGE_TAG" >> $GITHUB_OUTPUT
7171
env:
@@ -74,15 +74,15 @@ jobs:
7474

7575
- name: Set up kubeconfig
7676
run: |
77-
set -e pipefail
77+
set -euo pipefail
7878
mkdir -p ~/.kube
7979
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
8080
export KUBECONFIG=~/.kube/config
8181
8282
- name: Check if the helm deployment already exists
8383
id: check_deployment
8484
run: |
85-
set -e pipefail
85+
set -euo pipefail
8686
if helm status "pr${{ steps.pr_info.outputs.PR_NUMBER }}" --namespace "pr${{ steps.pr_info.outputs.PR_NUMBER }}" > /dev/null 2>&1; then
8787
echo "Deployment already exists. Skipping deployment."
8888
new=false
@@ -151,7 +151,7 @@ jobs:
151151
- name: Print number of changed files
152152
if: github.event_name == 'workflow_dispatch' || steps.check_deployment.outputs.NEW == 'false'
153153
run: |
154-
set -e pipefail
154+
set -euo pipefail
155155
echo "Total number of changed files: ${{ steps.filter.outputs.all_count }}"
156156
echo "Number of ignored files: ${{ steps.filter.outputs.ignored_count }}"
157157
@@ -190,7 +190,7 @@ jobs:
190190

191191
- name: Build and push Linux amd64 Docker image
192192
run: |
193-
set -e pipefail
193+
set -euo pipefail
194194
go mod download
195195
make gen/mark-fresh
196196
export DOCKER_IMAGE_NO_PREREQUISITES=true
@@ -221,15 +221,15 @@ jobs:
221221
steps:
222222
- name: Set up kubeconfig
223223
run: |
224-
set -e pipefail
224+
set -euo pipefail
225225
mkdir -p ~/.kube
226226
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG }}" > ~/.kube/config
227227
export KUBECONFIG=~/.kube/config
228228
229229
- name: Check if image exists
230230
if: needs.get_info.outputs.NEW == 'true'
231231
run: |
232-
set -e pipefail
232+
set -euo pipefail
233233
foundTag=$(curl -fsSL https://github.com/coder/coder/pkgs/container/coder-preview | grep -o ${{ env.CODER_IMAGE_TAG }} | head -n 1)
234234
if [ -z "$foundTag" ]; then
235235
echo "Image not found"
@@ -254,7 +254,7 @@ jobs:
254254
- name: Create PR namespace
255255
if: needs.get_info.outputs.NEW == 'true'
256256
run: |
257-
set -e pipefail
257+
set -euo pipefail
258258
# try to delete the namespace, but don't fail if it doesn't exist
259259
kubectl delete namespace "pr${{ env.PR_NUMBER }}" || true
260260
kubectl create namespace "pr${{ env.PR_NUMBER }}"
@@ -313,7 +313,7 @@ jobs:
313313
if: needs.get_info.outputs.NEW == 'true'
314314
# This service account will be used to grant full access to the namespace from the workspace
315315
run: |
316-
set -e pipefail
316+
set -euo pipefail
317317
# Create service account, role, rolebinding and secret
318318
cat <<EOF | kubectl apply -f -
319319
apiVersion: v1
@@ -446,7 +446,7 @@ jobs:
446446
447447
- name: Install/Upgrade Helm chart
448448
run: |
449-
set -e pipefail
449+
set -euo pipefail
450450
if [[ ${{ github.event_name }} == "workflow_dispatch" ]]; then
451451
helm upgrade --install "pr${{ env.PR_NUMBER }}" ./helm \
452452
--namespace "pr${{ env.PR_NUMBER }}" \
@@ -474,7 +474,7 @@ jobs:
474474
- name: Get Coder binary
475475
if: needs.get_info.outputs.NEW == 'true'
476476
run: |
477-
set -e pipefail
477+
set -euo pipefail
478478
479479
DEST="${HOME}/coder"
480480
URL="https://${{ env.PR_DEPLOYMENT_ACCESS_URL }}/bin/coder-linux-amd64"
@@ -501,7 +501,7 @@ jobs:
501501
if: needs.get_info.outputs.NEW == 'true'
502502
id: setup_deployment
503503
run: |
504-
set -e pipefail
504+
set -euo pipefail
505505
506506
# Create first user
507507

0 commit comments

Comments
 (0)