|
12 | 12 | REGISTRY: ghcr.io
|
13 | 13 |
|
14 | 14 | 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-mini-lab-vms-image: |
| 16 | + name: Build mini-lab-vms image |
| 17 | + runs-on: ubuntu-latest |
25 | 18 |
|
26 | 19 | 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 |
| - |
39 | 20 | - name: Log in to the container registry
|
40 | 21 | uses: docker/login-action@v3
|
41 | 22 | with:
|
|
63 | 44 | cache-from: type=registry,ref=${{ env.MINI_LAB_VM_IMAGE }}
|
64 | 45 | cache-to: type=inline
|
65 | 46 |
|
| 47 | + build-mini-lab-sonic-image: |
| 48 | + name: Build mini-lab-sonic image |
| 49 | + runs-on: ubuntu-latest |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Log in to the container registry |
| 53 | + uses: docker/login-action@v3 |
| 54 | + with: |
| 55 | + registry: ${{ env.REGISTRY }} |
| 56 | + username: ${{ secrets.DOCKER_REGISTRY_USER }} |
| 57 | + password: ${{ secrets.DOCKER_REGISTRY_TOKEN }} |
| 58 | + |
| 59 | + - name: Checkout |
| 60 | + uses: actions/checkout@v4 |
| 61 | + |
| 62 | + - name: Make tag |
| 63 | + run: | |
| 64 | + IMAGE_TAG=$([ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo ${GITHUB_HEAD_REF##*/} || echo "latest") |
| 65 | +
|
| 66 | + echo "MINI_LAB_VM_IMAGE=ghcr.io/metal-stack/mini-lab-vms:${IMAGE_TAG}" >> $GITHUB_ENV |
| 67 | + echo "MINI_LAB_SONIC_IMAGE=ghcr.io/metal-stack/mini-lab-sonic:${IMAGE_TAG}" >> $GITHUB_ENV |
| 68 | +
|
66 | 69 | - name: Build and push mini-lab-sonic container
|
67 | 70 | uses: docker/build-push-action@v5
|
68 | 71 | with:
|
|
71 | 74 | tags: ${{ env.MINI_LAB_SONIC_IMAGE }}
|
72 | 75 | cache-from: type=registry,ref=${{ env.MINI_LAB_SONIC_IMAGE }}
|
73 | 76 | cache-to: type=inline
|
74 |
| - if: ${{ matrix.flavors.name == 'sonic' }} |
| 77 | + |
| 78 | + test: |
| 79 | + name: Run tests |
| 80 | + runs-on: self-hosted |
| 81 | + needs: |
| 82 | + - build-mini-lab-vms-image |
| 83 | + - build-mini-lab-sonic-image |
| 84 | + |
| 85 | + strategy: |
| 86 | + matrix: |
| 87 | + flavors: |
| 88 | + - name: cumulus |
| 89 | + - name: sonic |
| 90 | + - name: gardener |
| 91 | + |
| 92 | + steps: |
| 93 | + - name: Gain back workspace permissions # https://github.com/actions/checkout/issues/211 |
| 94 | + run: | |
| 95 | + [ -d "${GITHUB_WORKSPACE}" ] && sudo chown -R $USER:$USER ${GITHUB_WORKSPACE} |
| 96 | +
|
| 97 | + - name: Setup Containerlab |
| 98 | + run: | |
| 99 | + bash -c "$(curl -sL https://get.containerlab.dev)" |
| 100 | + env: |
| 101 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 102 | + # set if required: |
| 103 | + # DESIRED_VERSION: v0.59.0 |
| 104 | + |
| 105 | + - name: Checkout |
| 106 | + uses: actions/checkout@v4 |
| 107 | + |
| 108 | + - name: Make tag |
| 109 | + run: | |
| 110 | + IMAGE_TAG=$([ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo ${GITHUB_HEAD_REF##*/} || echo "latest") |
| 111 | +
|
| 112 | + echo "MINI_LAB_VM_IMAGE=ghcr.io/metal-stack/mini-lab-vms:${IMAGE_TAG}" >> $GITHUB_ENV |
| 113 | + echo "MINI_LAB_SONIC_IMAGE=ghcr.io/metal-stack/mini-lab-sonic:${IMAGE_TAG}" >> $GITHUB_ENV |
75 | 114 |
|
76 | 115 | - name: Run integration tests
|
77 | 116 | shell: bash
|
|
0 commit comments