diff --git a/.github/workflows/base-image.yaml b/.github/workflows/base-image.yaml index 986fa751..c0a6174c 100644 --- a/.github/workflows/base-image.yaml +++ b/.github/workflows/base-image.yaml @@ -10,6 +10,12 @@ jobs: name: build mini-lab-sonic base image runs-on: ubuntu-latest + strategy: + matrix: + versions: + - name: 202311 + - name: 202411 + steps: - name: Log in to the container registry uses: docker/login-action@v3 @@ -21,18 +27,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Make tag - run: | - git fetch --tags - echo "tag=$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD)" >> $GITHUB_ENV - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Build and push mini-lab-sonic container + - name: Build and push mini-lab-sonic-base container uses: docker/build-push-action@v6 with: push: true sbom: true - file: images/sonic/base/Dockerfile - tags: ${{ env.REGISTRY }}/metal-stack/mini-lab-sonic-base:${{ env.tag }} + file: images/sonic/base-${{ matrix.versions.name }}/Dockerfile + tags: ${{ env.REGISTRY }}/metal-stack/mini-lab-sonic-base:${{ matrix.versions.name }} diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 754b0007..e9b941f0 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -41,6 +41,7 @@ jobs: uses: docker/build-push-action@v6 with: context: ./images/machine + pull: true push: true sbom: true tags: ${{ env.MINI_LAB_VM_IMAGE }} @@ -76,6 +77,7 @@ jobs: uses: docker/build-push-action@v6 with: context: ./images/sonic + pull: true push: true sbom: true tags: ${{ env.MINI_LAB_SONIC_IMAGE }} diff --git a/Makefile b/Makefile index 520cd053..5c2af20f 100644 --- a/Makefile +++ b/Makefile @@ -62,6 +62,10 @@ up: env gen-certs control-plane-bake partition-bake sleep 10 ssh -F files/ssh/config leaf01 'systemctl restart metal-core' ssh -F files/ssh/config leaf02 'systemctl restart metal-core' +# TODO: for community SONiC versions > 202311 a bgp restart is needed in the virtual environment + sleep 10 + ssh -F files/ssh/config leaf01 'systemctl restart bgp' + ssh -F files/ssh/config leaf02 'systemctl restart bgp' .PHONY: restart restart: down up @@ -353,6 +357,11 @@ test-connectivity-to-external-service-via-ipv6: fi; \ done +.PHONY: build-sonic-base +build-sonic-base: + docker build -t ghcr.io/metal-stack/mini-lab-sonic-base:202311 images/sonic/base-202311 + docker build -t ghcr.io/metal-stack/mini-lab-sonic-base:202411 images/sonic/base-202411 + docker build -t ghcr.io/metal-stack/mini-lab-sonic-base:202505 images/sonic/base-202505 ## DEV TARGETS ## diff --git a/images/sonic/Dockerfile b/images/sonic/Dockerfile index c3d8a30a..fe262415 100644 --- a/images/sonic/Dockerfile +++ b/images/sonic/Dockerfile @@ -14,8 +14,8 @@ RUN apt-get update && \ qemu-system-x86 \ telnet -COPY --from=ghcr.io/metal-stack/mini-lab-sonic:base /sonic-vs.img /sonic-vs.img -COPY --from=ghcr.io/metal-stack/mini-lab-sonic:base /frr-pythontools.deb /frr-pythontools.deb +COPY --from=ghcr.io/metal-stack/mini-lab-sonic-base:202505 /sonic-vs.img /sonic-vs.img +COPY --from=ghcr.io/metal-stack/mini-lab-sonic-base:202505 /frr-pythontools.deb /frr-pythontools.deb ENTRYPOINT ["/launch.py"] diff --git a/images/sonic/base/Dockerfile b/images/sonic/base-202311/Dockerfile similarity index 100% rename from images/sonic/base/Dockerfile rename to images/sonic/base-202311/Dockerfile diff --git a/images/sonic/base-202411/Dockerfile b/images/sonic/base-202411/Dockerfile new file mode 100644 index 00000000..f863475b --- /dev/null +++ b/images/sonic/base-202411/Dockerfile @@ -0,0 +1,25 @@ +# Check: https://sonic-build.azurewebsites.net/ui/sonic/pipelines +ARG SONIC_BASE_URL=https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=202411&platform=vs +ARG SONIC_IMG_URL=${SONIC_BASE_URL}&target=target%2Fsonic-vs.img.gz +ARG FRR_RELOAD_URL=${SONIC_BASE_URL}&target=target%2Fdebs%2Fbookworm%2Ffrr-pythontools_10.0.1-sonic-0_all.deb + +FROM docker.io/library/busybox:stable AS download + +ARG SONIC_IMG_URL +ARG FRR_RELOAD_URL + +ADD "${SONIC_IMG_URL}" /sonic-vs.img.gz +ADD "${FRR_RELOAD_URL}" /frr-pythontools.deb + +RUN gunzip /sonic-vs.img.gz + +FROM scratch + +ARG SONIC_IMG_URL +ARG FRR_RELOAD_URL + +LABEL sonic-img-url=${SONIC_IMG_URL} \ + frr-reload-url=${FRR_RELOAD_URL} + +COPY --from=download /frr-pythontools.deb /frr-pythontools.deb +COPY --from=download /sonic-vs.img /sonic-vs.img diff --git a/images/sonic/base-202505/Dockerfile b/images/sonic/base-202505/Dockerfile new file mode 100644 index 00000000..632cdc0a --- /dev/null +++ b/images/sonic/base-202505/Dockerfile @@ -0,0 +1,25 @@ +# Check: https://sonic-build.azurewebsites.net/ui/sonic/pipelines +ARG SONIC_BASE_URL=https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=202505&platform=vs +ARG SONIC_IMG_URL=${SONIC_BASE_URL}&target=target%2Fsonic-vs.img.gz +ARG FRR_RELOAD_URL=${SONIC_BASE_URL}&target=target%2Fdebs%2Fbookworm%2Ffrr-pythontools_10.3-sonic-0_all.deb + +FROM docker.io/library/busybox:stable AS download + +ARG SONIC_IMG_URL +ARG FRR_RELOAD_URL + +ADD "${SONIC_IMG_URL}" /sonic-vs.img.gz +ADD "${FRR_RELOAD_URL}" /frr-pythontools.deb + +RUN gunzip /sonic-vs.img.gz + +FROM scratch + +ARG SONIC_IMG_URL +ARG FRR_RELOAD_URL + +LABEL sonic-img-url=${SONIC_IMG_URL} \ + frr-reload-url=${FRR_RELOAD_URL} + +COPY --from=download /frr-pythontools.deb /frr-pythontools.deb +COPY --from=download /sonic-vs.img /sonic-vs.img diff --git a/mini-lab.sonic.yaml b/mini-lab.sonic.yaml index 9ce9ba71..eb33236f 100644 --- a/mini-lab.sonic.yaml +++ b/mini-lab.sonic.yaml @@ -9,7 +9,7 @@ topology: kind: linux nodes: exit: - image: quay.io/frrouting/frr:10.0.1 + image: quay.io/frrouting/frr:10.3.0 network-mode: none binds: - files/exit/daemons:/etc/frr/daemons diff --git a/roles/sonic/tasks/frr-reload.yaml b/roles/sonic/tasks/frr-reload.yaml index 8164a1a5..76723923 100644 --- a/roles/sonic/tasks/frr-reload.yaml +++ b/roles/sonic/tasks/frr-reload.yaml @@ -1,7 +1,8 @@ --- - name: Wait until the bgpd is up ansible.builtin.wait_for: - port: 2605 + # this it the zebra port - it changed in version 202505 from 2605 to 2601 + port: 2601 state: started - name: Copy frr-pythontools into container