Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and push sonic container image. #157

Merged
merged 5 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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