-
Notifications
You must be signed in to change notification settings - Fork 12
84 lines (72 loc) · 2.43 KB
/
integration.yaml
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
---
name: Integration Test
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
REGISTRY: ghcr.io
jobs:
test:
name: Run tests
runs-on: self-hosted
strategy:
matrix:
flavors:
- name: cumulus
- name: sonic
steps:
- name: Gain back workspace permissions # https://github.com/actions/checkout/issues/211
run: |
[ -d "${GITHUB_WORKSPACE}" ] && sudo chown -R $USER:$USER ${GITHUB_WORKSPACE}
- name: Setup Containerlab
run: |
bash -c "$(curl -sL https://get.containerlab.dev)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# we can remove desired version again after this fix was released: https://github.com/srl-labs/containerlab/pull/2000
DESIRED_VERSION: v0.56.0
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
- name: Checkout
uses: actions/checkout@v4
- name: Make tag
run: |
IMAGE_TAG=$([ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo ${GITHUB_HEAD_REF##*/} || echo "latest")
echo "MINI_LAB_VM_IMAGE=ghcr.io/metal-stack/mini-lab-vms:${IMAGE_TAG}" >> $GITHUB_ENV
echo "MINI_LAB_SONIC_IMAGE=ghcr.io/metal-stack/mini-lab-sonic:${IMAGE_TAG}" >> $GITHUB_ENV
- name: Build and push mini-lab-vms container
uses: docker/build-push-action@v5
with:
context: ./images
file: ./images/Dockerfile.vms
push: true
tags: ${{ env.MINI_LAB_VM_IMAGE }}
cache-from: type=registry,ref=${{ env.MINI_LAB_VM_IMAGE }}
cache-to: type=inline
- name: Build and push mini-lab-sonic container
uses: docker/build-push-action@v5
with:
context: ./images/sonic
push: true
tags: ${{ env.MINI_LAB_SONIC_IMAGE }}
cache-from: type=registry,ref=${{ env.MINI_LAB_SONIC_IMAGE }}
cache-to: type=inline
if: ${{ matrix.flavors.name == 'sonic' }}
- name: Run integration tests
shell: bash
run: |
./test/ci-cleanup.sh
./test/integration.sh
env:
MINI_LAB_FLAVOR: ${{ matrix.flavors.name }}
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}