Skip to content

Commit

Permalink
Build and push sonic container image.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 committed Apr 18, 2024
1 parent a204bca commit eeeedb7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
test:
Expand All @@ -35,11 +36,23 @@ jobs:
run: |
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "MINI_LAB_VM_IMAGE=ghcr.io/metal-stack/mini-lab-vms:${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "MINI_LAB_VM_IMAGE=ghcr.io/metal-stack/mini-lab-vms:latest" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo "MINI_LAB_SONIC_IMAGE=ghcr.io/metal-stack/mini-lab-sonic:${GITHUB_HEAD_REF##*/}" >> $GITHUB_ENV || true
[ "${GITHUB_EVENT_NAME}" == 'push' ] && echo "MINI_LAB_SONIC_IMAGE=ghcr.io/metal-stack/mini-lab-sonic:latest" >> $GITHUB_ENV || true
- name: Build Docker image
run: |
make build-vms-image
docker push ${MINI_LAB_VM_IMAGE}
- name: Build and push mini-lab-vms container image
uses: docker/build-push-action@v5
with:
context: ./images
file: Dockerfile.vms
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.MINI_LAB_VM_IMAGE }}

- name: Build and push mini-lab-sonic container image
uses: docker/build-push-action@v5
with:
context: ./images/sonic
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.MINI_LAB_SONIC_IMAGE }}

- name: Run integration tests
shell: bash
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ANSIBLE_EXTRA_VARS_FILE := $(or $(ANSIBLE_EXTRA_VARS_FILE),)

MINI_LAB_FLAVOR := $(or $(MINI_LAB_FLAVOR),default)
MINI_LAB_VM_IMAGE := $(or $(MINI_LAB_VM_IMAGE),ghcr.io/metal-stack/mini-lab-vms:latest)
MINI_LAB_SONIC_IMAGE := $(or $(MINI_LAB_SONIC_IMAGE),ghcr.io/metal-stack/mini-lab-sonic:latest)

MACHINE_OS=ubuntu-22.04

Expand Down Expand Up @@ -219,9 +220,5 @@ dev-env:
@echo "export METALCTL_HMAC=metal-admin"
@echo "export KUBECONFIG=$(KUBECONFIG)"

.PHONY: build-vms-image
build-vms-image:
cd images && docker build -f Dockerfile.vms -t $(MINI_LAB_VM_IMAGE) . && cd -

sonic-vs.img:
curl --location --output - "${SONIC_REMOTE_IMG}" | gunzip > sonic-vs.img
4 changes: 2 additions & 2 deletions mini-lab.sonic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ topology:
nodes:
leaf01:
kind: linux
image: ghcr.io/metal-stack/mini-lab-sonic:latest
image: ${MINI_LAB_SONIC_IMAGE}
labels:
ansible-group: sonic
binds:
Expand All @@ -17,7 +17,7 @@ topology:
- sonic-vs.img:/sonic-vs.img
leaf02:
kind: linux
image: ghcr.io/metal-stack/mini-lab-sonic:latest
image: ${MINI_LAB_SONIC_IMAGE}
labels:
ansible-group: sonic
binds:
Expand Down

0 comments on commit eeeedb7

Please sign in to comment.