Skip to content

Commit

Permalink
Build and push sonic container image. (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit91 authored Apr 19, 2024
1 parent a204bca commit 87ab548
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,25 @@ jobs:

- name: Make tag
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
IMAGE_TAG=$([ "${GITHUB_EVENT_NAME}" == 'pull_request' ] && echo ${GITHUB_HEAD_REF##*/} || echo "latest")
- name: Build Docker image
run: |
make build-vms-image
docker push ${MINI_LAB_VM_IMAGE}
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 }}

- 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 }}

- 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 87ab548

Please sign in to comment.