-
Notifications
You must be signed in to change notification settings - Fork 15
156 lines (126 loc) · 4.69 KB
/
test-jammy-dind.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: 🧪 Test Ubuntu Jammy (22.04 LTS) runner
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- "images/rootless-ubuntu-jammy.Dockerfile"
- "images/**.sh"
- "images/software/*"
- ".github/workflows/test-jammy-dind.yml"
jobs:
build:
name: Build test image
runs-on: ubuntu-latest # use the GitHub-hosted runner to build the image
steps:
- name: Set release id
run: echo "SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Set up build summary
run: |
echo '### Build summary 🚀' >> $GITHUB_STEP_SUMMARY
echo ' ' >> $GITHUB_STEP_SUMMARY
echo '- Changes that produced this build [here](${{ github.server_url }}/${{ github.repository }}/commit/${{ env.SHA_SHORT }}) ' >> $GITHUB_STEP_SUMMARY
echo '- Full code at this point in time [here](${{ github.server_url }}/${{ github.repository }}/tree/${{ env.SHA_SHORT }})' >> $GITHUB_STEP_SUMMARY
echo ' ' >> $GITHUB_STEP_SUMMARY
- name: Checkout
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
file: "images/rootless-ubuntu-jammy.Dockerfile"
push: true
tags: ghcr.io/some-natalie/kubernoodles/rootless-ubuntu-jammy:test
deploy:
name: Deploy test image to `test-runners` namespace
runs-on: deploy-controller # use a self-hosted runner to deploy the image
needs: [build]
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Write out the kubeconfig info
run: |
echo ${{ secrets.DEPLOY_ACCOUNT }} | base64 -d > kube-config
- name: Update deployment (using latest chart of actions-runner-controller-charts/auto-scaling-runner-set)
run: |
helm install test-jammy-dind \
--namespace "test-runners" \
--set githubConfigSecret.github_app_id="${{ vars.ARC_APP_ID }}" \
--set githubConfigSecret.github_app_installation_id="${{ vars.ARC_INSTALL_ID }}" \
--set githubConfigSecret.github_app_private_key="${{ secrets.ARC_APP_PRIVATE_KEY }}" \
-f deployments/helm-jammy-dind-test.yml \
oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set \
--version 0.9.3
env:
KUBECONFIG: kube-config
- name: Remove kubeconfig info
run: rm -f kube-config
- name: Wait 2 minutes to let the new pod come up
run: sleep 120
test:
name: Run tests!
runs-on: [test-jammy-dind]
needs: [deploy]
timeout-minutes: 15
steps:
- name: Setup test summary
run: |
echo '### Test summary 🧪' >> $GITHUB_STEP_SUMMARY
echo ' ' >> $GITHUB_STEP_SUMMARY
echo '- ✅ runner builds and deploys' >> $GITHUB_STEP_SUMMARY
- name: Checkout
uses: actions/checkout@v4
- name: Print debug info
uses: ./tests/debug
- name: Sudo fails
uses: ./tests/sudo-fails
- name: Docker tests
uses: ./tests/docker
- name: Container Action test
id: container
continue-on-error: true
uses: ./tests/container
- name: Log container success (if applicable)
if: steps.container.outcome == 'success'
run: |
echo '- ✅ container action succeeded' >> $GITHUB_STEP_SUMMARY
- name: Log container failure (if applicable)
if: steps.container.outcome == 'failure'
run: |
echo '- ❌ container action failed' >> $GITHUB_STEP_SUMMARY
remove-deploy:
name: Delete test image deployment
runs-on: deploy-controller # use a self-hosted runner to remove the image
needs: [test]
environment: test
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Write out the kubeconfig info
run: |
echo ${{ secrets.DEPLOY_ACCOUNT }} | base64 -d > kube-config
- name: Deploy
run: |
helm uninstall test-jammy-dind --namespace "test-runners"
env:
KUBECONFIG: kube-config
- name: Remove kubeconfig info
run: rm -f kube-config
- name: Output removal
run: |
echo ' ' >> $GITHUB_STEP_SUMMARY
echo '🧹 Test deployment removed' >> $GITHUB_STEP_SUMMARY