Skip to content

Commit 93c8303

Browse files
committed
fix(workflow): correct kube config permissions and reorder steps
Change kube config file permission to 600 for better security and reorder the template and workspace creation steps to after user promotion.
1 parent 1a6ec33 commit 93c8303

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

.github/workflows/pr-deploy.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
set -euo pipefail
111111
mkdir -p ~/.kube
112112
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG_BASE64 }}" | base64 --decode > ~/.kube/config
113-
chmod 644 ~/.kube/config
113+
chmod 600 ~/.kube/config
114114
export KUBECONFIG=~/.kube/config
115115
116116
- name: Check if the helm deployment already exists
@@ -284,7 +284,7 @@ jobs:
284284
set -euo pipefail
285285
mkdir -p ~/.kube
286286
echo "${{ secrets.PR_DEPLOYMENTS_KUBECONFIG_BASE64 }}" | base64 --decode > ~/.kube/config
287-
chmod 644 ~/.kube/config
287+
chmod 600 ~/.kube/config
288288
export KUBECONFIG=~/.kube/config
289289
290290
- name: Check if image exists
@@ -443,14 +443,6 @@ jobs:
443443
--use-token-as-session \
444444
https://${{ env.PR_HOSTNAME }}
445445
446-
# Create template
447-
cd ./.github/pr-deployments/template
448-
coder templates push -y --variable namespace=pr${{ env.PR_NUMBER }} kubernetes
449-
450-
# Create workspace
451-
coder create --template="kubernetes" kube --parameter cpu=2 --parameter memory=4 --parameter home_disk_size=2 -y
452-
coder stop kube -y
453-
454446
# Create a user for the github.actor
455447
coder users create \
456448
--user ${{ github.actor }} \
@@ -459,7 +451,15 @@ jobs:
459451
--login-type github
460452
461453
# promote the user to admin role
462-
# coder org members edit-role ${{ github.actor }} owner
454+
coder org members edit-role ${{ github.actor }} owner
455+
456+
# Create template
457+
cd ./.github/pr-deployments/template
458+
coder templates push -y --variable namespace=pr${{ env.PR_NUMBER }} kubernetes
459+
460+
# Create workspace
461+
coder create --template="kubernetes" kube --parameter cpu=2 --parameter memory=4 --parameter home_disk_size=2 -y
462+
coder stop kube -y
463463
464464
- name: Send Slack notification
465465
if: needs.get_info.outputs.NEW == 'true' || github.event.inputs.deploy == 'true'

0 commit comments

Comments
 (0)