Skip to content

Commit f3d8004

Browse files
Artyopaanm
authored andcommitted
ci: refactor some conformance workflows
Adapted k8s network policies, delegated ipam & kind proxy embedded to use the wait-for-images action, reducing code duplication burden. Same on conformance-runtime, using a docker pull/save approach from the runner instead of curling from the VM. Helps if registry needs auth. Signed-off-by: Antony Reynaud <antony.reynaud@isovalent.com>
1 parent 806b399 commit f3d8004

4 files changed

Lines changed: 61 additions & 56 deletions

File tree

.github/workflows/conformance-delegated-ipam.yaml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,15 @@ jobs:
296296
--docker-username="${{ vars.DOCKER_READ_USERNAME }}" \
297297
--docker-password="${{ secrets.DOCKER_READ_PASSWORD }}"
298298
299-
- name: Login to docker registry for image wait
300-
if: ${{ vars.DOCKER_AUTH_REQUIRED == 'true' }}
301-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
302-
with:
303-
registry: ${{ vars.DOCKER_READ_HOST}}
304-
username: ${{ vars.DOCKER_READ_USERNAME}}
305-
password: ${{ secrets.DOCKER_READ_PASSWORD }}
306-
307299
- name: Wait for images to be available
308-
timeout-minutes: 30
309-
shell: bash
310-
run: |
311-
for image in cilium-ci operator-generic-ci hubble-relay-ci; do
312-
until docker manifest inspect ${{ vars.DOCKER_READ_HOST }}/${{ vars.DOCKER_READ_ORG }}/$image:${{ steps.vars.outputs.sha }} &> /dev/null; do sleep 45s; done
313-
done
300+
uses: ./.github/actions/wait-for-images
301+
with:
302+
SHA: ${{ steps.vars.outputs.sha }}
303+
images: cilium-ci operator-generic-ci hubble-relay-ci
304+
login-host: ${{ vars.DOCKER_READ_HOST }}
305+
login-username: ${{ vars.DOCKER_READ_USERNAME }}
306+
login-password: ${{ secrets.DOCKER_READ_PASSWORD }}
307+
auth-required: ${{ vars.DOCKER_AUTH_REQUIRED }}
314308

315309
- name: Wait for nodes to become ready
316310
run: |

.github/workflows/conformance-k8s-network-policies.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ jobs:
7979
fi
8080
8181
- name: Wait for images to be available
82-
timeout-minutes: 30
83-
shell: bash
84-
run: |
85-
until docker manifest inspect ${{ env.REGISTRY_DEV }}/${{ env.ORGANIZATION_DEV }}/cilium-ci:${{ steps.vars.outputs.tag }} &> /dev/null; do sleep 45s; done
86-
until docker manifest inspect ${{ env.REGISTRY_DEV }}/${{ env.ORGANIZATION_DEV }}/operator-generic-ci:${{ steps.vars.outputs.tag }} &> /dev/null; do sleep 45s; done
82+
uses: ./.github/actions/wait-for-images
83+
with:
84+
SHA: ${{ steps.vars.outputs.tag }}
85+
images: cilium-ci operator-generic-ci
86+
login-host: ${{ vars.DOCKER_READ_HOST }}
87+
login-username: ${{ vars.DOCKER_READ_USERNAME }}
88+
login-password: ${{ secrets.DOCKER_READ_PASSWORD }}
8789

8890
- name: Create kind cluster
8991
uses: helm/kind-action@ef37e7f390d99f746eb8b610417061a60e82a6cc # v1.14.0
@@ -94,6 +96,15 @@ jobs:
9496
config: ${{ env.KIND_CONFIG }}
9597
wait: 0 # The control-plane never becomes ready, since no CNI is present
9698

99+
- name: Create imagePullSecret
100+
if: ${{ vars.DOCKER_AUTH_REQUIRED == 'true' }}
101+
run: |
102+
kubectl create secret docker-registry cilium-registry \
103+
--namespace kube-system \
104+
--docker-server=${{ vars.DOCKER_READ_HOST }} \
105+
--docker-username="${{ vars.DOCKER_READ_USERNAME }}" \
106+
--docker-password="${{ secrets.DOCKER_READ_PASSWORD }}"
107+
97108
- name: Install cilium chart
98109
id: install-cilium
99110
run: |
@@ -136,6 +147,10 @@ jobs:
136147
--set hubble.enabled=true \
137148
--set=hubble.metrics.enabled={dns,drop,tcp,flow,port-distribution,icmp,http}"
138149
150+
if [ "${{ vars.DOCKER_AUTH_REQUIRED }}" == "true" ]; then
151+
HELM_ARGS="$HELM_ARGS --set-string=imagePullSecrets[0].name=cilium-registry"
152+
fi
153+
139154
helm install cilium ./install/kubernetes/cilium $HELM_ARGS
140155
141156
kubectl wait -n kube-system --for=condition=Ready -l app.kubernetes.io/part-of=cilium pod --timeout=5m

.github/workflows/conformance-kind-proxy-embedded.yaml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,15 @@ jobs:
195195
--docker-username="${{ vars.DOCKER_READ_USERNAME }}" \
196196
--docker-password="${{ secrets.DOCKER_READ_PASSWORD }}"
197197
198-
- name: Login to docker registry for image wait
199-
if: ${{ vars.DOCKER_AUTH_REQUIRED == 'true' }}
200-
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
201-
with:
202-
registry: ${{ vars.DOCKER_READ_HOST}}
203-
username: ${{ vars.DOCKER_READ_USERNAME}}
204-
password: ${{ secrets.DOCKER_READ_PASSWORD }}
205-
206198
- name: Wait for images to be available
207-
timeout-minutes: 30
208-
shell: bash
209-
run: |
210-
for image in cilium-ci operator-generic-ci hubble-relay-ci ; do
211-
until docker manifest inspect ${{ vars.DOCKER_READ_HOST }}/${{ vars.DOCKER_READ_ORG }}/$image:${{ steps.vars.outputs.sha }} &> /dev/null; do sleep 45s; done
212-
done
199+
uses: ./.github/actions/wait-for-images
200+
with:
201+
SHA: ${{ steps.vars.outputs.sha }}
202+
images: cilium-ci operator-generic-ci hubble-relay-ci
203+
login-host: ${{ vars.DOCKER_READ_HOST }}
204+
login-username: ${{ vars.DOCKER_READ_USERNAME }}
205+
login-password: ${{ secrets.DOCKER_READ_PASSWORD }}
206+
auth-required: ${{ vars.DOCKER_AUTH_REQUIRED }}
213207

214208
# Warning: since this is a privileged workflow, subsequent workflow job
215209
# steps must take care not to execute untrusted code.

.github/workflows/conformance-runtime.yaml

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -89,32 +89,23 @@ jobs:
8989
wait-for-images:
9090
runs-on: ubuntu-24.04
9191
name: Wait for images
92+
timeout-minutes: 30
9293
steps:
9394
- name: Checkout context ref (trusted)
9495
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
9596
with:
9697
ref: ${{ inputs.context-ref || github.sha }}
9798
persist-credentials: false
9899

99-
- name: Set Environment Variables
100-
uses: ./.github/actions/set-env-variables
101-
102-
- name: Set up job variables
103-
id: vars
104-
run: |
105-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
106-
SHA="${{ inputs.SHA }}"
107-
else
108-
SHA="${{ github.sha }}"
109-
fi
110-
111-
echo "sha=${SHA}" >> $GITHUB_OUTPUT
112-
113-
- name: Waiting for images
114-
timeout-minutes: 20
115-
shell: bash
116-
run: |
117-
until docker manifest inspect ${{ env.REGISTRY_DEV }}/${{ env.ORGANIZATION_DEV }}/cilium-ci:${{ steps.vars.outputs.sha }} &> /dev/null; do sleep 45s; done
100+
- name: Wait for images
101+
uses: ./.github/actions/wait-for-images
102+
with:
103+
SHA: ${{ inputs.SHA || github.sha }}
104+
images: cilium-ci
105+
login-host: ${{ vars.DOCKER_READ_HOST }}
106+
login-username: ${{ vars.DOCKER_READ_USERNAME }}
107+
login-password: ${{ secrets.DOCKER_READ_PASSWORD }}
108+
auth-required: ${{ vars.DOCKER_AUTH_REQUIRED }}
118109

119110
setup-and-test:
120111
needs: wait-for-images
@@ -193,7 +184,6 @@ jobs:
193184
lvh-version: "v0.0.30"
194185
mem: 14G
195186

196-
197187
# Load Golang cache build from GitHub
198188
- name: Load Golang cache build from GitHub
199189
if: ${{ matrix.focus == 'privileged' }}
@@ -221,6 +211,20 @@ jobs:
221211
mv "${GOCACHE}/go-build-cache.tar.zst" ./go-build-cache.tar.zst || true
222212
mv "${GOMODCACHE}/go-mod-cache.tar.zst" ./go-mod-cache.tar.zst || true
223213
214+
- name: Login to docker registry for CI image pull
215+
if: ${{ vars.DOCKER_AUTH_REQUIRED == 'true' }}
216+
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
217+
with:
218+
registry: ${{ vars.DOCKER_READ_HOST }}
219+
username: ${{ vars.DOCKER_READ_USERNAME }}
220+
password: ${{ secrets.DOCKER_READ_PASSWORD }}
221+
222+
- name: Export Cilium toolchain image for the VM
223+
shell: bash
224+
run: |
225+
docker pull ${{ env.REGISTRY_DEV }}/${{ env.ORGANIZATION_DEV }}/cilium-ci:${{ steps.vars.outputs.sha }}
226+
docker save ${{ env.REGISTRY_DEV }}/${{ env.ORGANIZATION_DEV }}/cilium-ci:${{ steps.vars.outputs.sha }} -o ./cilium-toolchain-image.tar
227+
224228
- name: Setup runtime
225229
timeout-minutes: 10
226230
uses: cilium/little-vm-helper@5ae749011735fd77f30f38add52f1a53a5568671 # v0.0.30
@@ -240,9 +244,7 @@ jobs:
240244
# These programs are not statically linked so they might break in
241245
# the case of GHA runners being upgraded.
242246
if ! command -v clang >/dev/null 2>&1; then
243-
# Wait for systemd-resolved to be ready so that the image pull
244-
# below can resolve the registry hostname.
245-
for i in {1..5}; do curl "https://${{ env.REGISTRY_DEV }}" > /dev/null 2>&1 && break || sleep 5; echo "Waiting for systemd-resolved to be ready..."; done
247+
docker load -i /host/cilium-toolchain-image.tar
246248
docker create --name cilium-toolchain ${{ env.REGISTRY_DEV }}/${{ env.ORGANIZATION_DEV }}/cilium-ci:${{ steps.vars.outputs.sha }}
247249
docker cp cilium-toolchain:/usr/local/bin/clang /usr/bin/
248250
docker cp cilium-toolchain:/usr/local/bin/llc /usr/bin/

0 commit comments

Comments
 (0)