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

added manifest based multi arch build #2128

Merged
merged 5 commits into from
Jul 6, 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
9 changes: 6 additions & 3 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
GO_VER: "1.21.8"
CGO_ENABLED: 0
MKDOCS_INS_VER: 9.5.9-insiders-4.52.2-hellt
GORELEASER_VER: v1.19.2
GORELEASER_VER: v2.0.1
PY_VER: "3.10"

jobs:
Expand Down Expand Up @@ -447,11 +447,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
uses: goreleaser/goreleaser-action@v6
with:
version: ${{ env.GORELEASER_VER }}
args: release --rm-dist --debug
args: release --clean --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURYPUSHTOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kind-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: vxlan-test
name: kind-test

"on":
workflow_call:
Expand Down
39 changes: 35 additions & 4 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2020 Nokia
# Licensed under the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause

version: 2
project_name: containerlab
builds:
- id: clab-bin
Expand All @@ -21,31 +21,62 @@ builds:
# hooks:
# post:
# - upx "{{ .Path }}"

dockers:
- goos: linux
goarch: amd64
image_templates:
# if version starts with v0.0.0 this is a beta build, for which we don't apply the `latest` tag and apply `beta` tag instead
- '{{ $pfx := slice .Version 0 6}}{{- if eq $pfx "v0.0.0"}}ghcr.io/srl-labs/clab:beta{{else}}ghcr.io/srl-labs/clab:latest{{- end }}'
- 'ghcr.io/srl-labs/clab:{{ replace .Version "v" ""}}'
# if version contains 0.0.0 this is a beta build, for which we don't apply the `latest` tag and apply `beta` tag instead
- &amd_latest_image '{{- if contains .Version "0.0.0"}}ghcr.io/srl-labs/clab:beta-amd64{{- else}}{{- if not .IsSnapshot}}ghcr.io/srl-labs/clab:latest-amd64{{- end}}{{- end }}'
- &amd_versioned_image 'ghcr.io/srl-labs/clab:{{ replace .Version "v" "" }}-amd64'
build_flag_templates:
- "--platform=linux/amd64"
use: buildx
dockerfile: goreleaser.dockerfile
- goos: linux
goarch: arm64
image_templates:
# if version contains 0.0.0 this is a beta build, for which we don't apply the `latest` tag and apply `beta` tag instead
- &arm_latest_image '{{- if contains .Version "0.0.0"}}ghcr.io/srl-labs/clab:beta-arm64{{- else}}{{- if not .IsSnapshot}}ghcr.io/srl-labs/clab:latest-arm64{{- end}}{{- end }}'
- &arm_versioned_image 'ghcr.io/srl-labs/clab:{{ replace .Version "v" ""}}-arm64'
build_flag_templates:
- "--platform=linux/arm64"
dockerfile: goreleaser.dockerfile
use: buildx

docker_manifests:
- name_template: 'ghcr.io/srl-labs/clab:{{ replace .Version "v" "" }}'
image_templates:
- *amd_versioned_image
- *arm_versioned_image
# this manifest creates a `latest` or `beta` tag based on the version of the release
- name_template: '{{- if contains .Version "0.0.0"}}ghcr.io/srl-labs/clab:beta{{- else}}{{- if not .IsSnapshot}}ghcr.io/srl-labs/clab:latest{{- end}}{{- end }}'
image_templates:
- *amd_latest_image
- *arm_latest_image

archives:
- name_template: '{{ .ProjectName }}_{{ replace .Version "v" "" }}_{{ .Os }}_{{ .Arch }}'
files:
- lab-examples/**/*
- templates/**/*

checksum:
name_template: checksums.txt

snapshot:
name_template: "{{ .Tag }}-next"

publishers:
- name: fury.io deb/rpm packages
ids:
- containerlab-nfpms # this id belongs to nfpm section and is used to only upload artifacts from nfpm
dir: "{{ dir .ArtifactPath }}"
cmd: curl -F package=@{{ .ArtifactName }} https://{{ .Env.FURY_TOKEN }}@push.fury.io/netdevops/

release:
prerelease: auto

changelog:
use: github-native

Expand Down
Loading