Introduce new mini-lab flavor for Enterprise SONiC and fix capi-lab #593
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Integration Test | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| push: | |
| branches: | |
| - master | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| build-mini-lab-vms-image: | |
| name: Build mini-lab-vms image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push mini-lab-vms container | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./images/machine | |
| pull: true | |
| push: true | |
| sbom: true | |
| tags: ${{ env.MINI_LAB_VM_IMAGE }} | |
| cache-from: type=registry,ref=${{ env.MINI_LAB_VM_IMAGE }} | |
| cache-to: type=inline | |
| build-mini-lab-sonic-image: | |
| name: Build mini-lab-sonic image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push mini-lab-sonic container | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./images/sonic | |
| pull: true | |
| push: true | |
| sbom: true | |
| tags: ${{ env.MINI_LAB_SONIC_IMAGE }} | |
| cache-from: type=registry,ref=${{ env.MINI_LAB_SONIC_IMAGE }} | |
| cache-to: type=inline | |
| test: | |
| name: Run tests | |
| runs-on: self-hosted | |
| needs: | |
| - build-mini-lab-vms-image | |
| - build-mini-lab-sonic-image | |
| continue-on-error: true | |
| strategy: | |
| matrix: | |
| flavors: | |
| - name: sonic | |
| - name: gardener | |
| - name: dell_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 }} | |
| # set if required: | |
| # DESIRED_VERSION: v0.59.0 | |
| - name: Log in to the container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: r.metal-stack.io | |
| username: ${{ secrets.R_METALSTACK_IO_READ_USER }} | |
| password: ${{ secrets.R_METALSTACK_IO_READ_PASSWORD }} | |
| - 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: Run integration tests | |
| shell: bash | |
| run: | | |
| eval $(make dev-env) | |
| ./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 }} |