Skip to content

Commit df10c2a

Browse files
committed
Build docker images before running integration tests.
1 parent 0802dfa commit df10c2a

File tree

2 files changed

+40
-23
lines changed

2 files changed

+40
-23
lines changed

.github/workflows/integration.yaml

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,11 @@ env:
1212
REGISTRY: ghcr.io
1313

1414
jobs:
15-
test:
16-
name: Run tests
17-
runs-on: self-hosted
18-
19-
strategy:
20-
matrix:
21-
flavors:
22-
- name: cumulus
23-
- name: sonic
24-
- name: gardener
15+
build:
16+
name: Build Docker images
17+
runs-on: ubuntu-latest
2518

2619
steps:
27-
- name: Gain back workspace permissions # https://github.com/actions/checkout/issues/211
28-
run: |
29-
[ -d "${GITHUB_WORKSPACE}" ] && sudo chown -R $USER:$USER ${GITHUB_WORKSPACE}
30-
31-
- name: Setup Containerlab
32-
run: |
33-
bash -c "$(curl -sL https://get.containerlab.dev)"
34-
env:
35-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36-
# set if required:
37-
# DESIRED_VERSION: v0.59.0
38-
3920
- name: Log in to the container registry
4021
uses: docker/login-action@v3
4122
with:
@@ -71,7 +52,42 @@ jobs:
7152
tags: ${{ env.MINI_LAB_SONIC_IMAGE }}
7253
cache-from: type=registry,ref=${{ env.MINI_LAB_SONIC_IMAGE }}
7354
cache-to: type=inline
74-
if: ${{ matrix.flavors.name == 'sonic' }}
55+
56+
test:
57+
name: Run tests
58+
runs-on: self-hosted
59+
needs:
60+
- build
61+
62+
strategy:
63+
matrix:
64+
flavors:
65+
- name: cumulus
66+
- name: sonic
67+
- name: gardener
68+
69+
steps:
70+
- name: Gain back workspace permissions # https://github.com/actions/checkout/issues/211
71+
run: |
72+
[ -d "${GITHUB_WORKSPACE}" ] && sudo chown -R $USER:$USER ${GITHUB_WORKSPACE}
73+
74+
- name: Setup Containerlab
75+
run: |
76+
bash -c "$(curl -sL https://get.containerlab.dev)"
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
# set if required:
80+
# DESIRED_VERSION: v0.59.0
81+
82+
- name: Checkout
83+
uses: actions/checkout@v4
84+
85+
- name: Make tag
86+
run: |
87+
IMAGE_TAG=$([ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo ${GITHUB_HEAD_REF##*/} || echo "latest")
88+
89+
echo "MINI_LAB_VM_IMAGE=ghcr.io/metal-stack/mini-lab-vms:${IMAGE_TAG}" >> $GITHUB_ENV
90+
echo "MINI_LAB_SONIC_IMAGE=ghcr.io/metal-stack/mini-lab-sonic:${IMAGE_TAG}" >> $GITHUB_ENV
7591
7692
- name: Run integration tests
7793
shell: bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.env
22
.idea
3+
.vscode
34
.kubeconfig
45
**/*.pyc
56
clab-mini-lab

0 commit comments

Comments
 (0)