From 57e0afc0f188bdf278d0c0984f6c4b1ba220e62f Mon Sep 17 00:00:00 2001 From: galal-hussein Date: Tue, 23 Jul 2024 20:32:41 +0300 Subject: [PATCH] Add manifest pipeline for rke2-runtime docker image Signed-off-by: galal-hussein --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ Makefile | 4 ++++ manifest-runtime.tmpl | 14 -------------- scripts/publish-manifest-runtime | 23 +++++++++++++++++++++++ 4 files changed, 52 insertions(+), 14 deletions(-) delete mode 100644 manifest-runtime.tmpl create mode 100755 scripts/publish-manifest-runtime diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b40a865ea5..695c77519d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -127,6 +127,31 @@ jobs: dapper -f Dockerfile --target dapper make publish-binary env: GH_TOKEN: ${{ github.token }} + manifest: + needs: [release-amd64, release-arm64] + runs-on: runs-on,runner=8cpu-linux-x64,run-id=${{ github.run_id }},image=ubuntu22-full-x64,hdd=64 + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Dapper + run: | + curl -sL https://releases.rancher.com/dapper/latest/dapper-$(uname -s)-$(uname -m) > /usr/local/bin/dapper + chmod +x /usr/local/bin/dapper + + - name: "Read secrets" + uses: rancher-eio/read-vault-secrets@main + with: + secrets: | + secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ; + secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ; + + - name: Manifest + run: | + GITHUB_ACTION_TAG=${{ github.ref_name }} dapper -f Dockerfile --target dapper make publish-manifest-runtime + env: + DOCKER_USERNAME: ${{ env.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }} dispatch: needs: [release-amd64, release-arm64] runs-on: runs-on,runner=8cpu-linux-x64,run-id=${{ github.run_id }},image=ubuntu22-full-x64,hdd=64 diff --git a/Makefile b/Makefile index 7d38f74f1e..96f525606c 100644 --- a/Makefile +++ b/Makefile @@ -112,6 +112,10 @@ dev-peer-enter: ## Enter the peer shell on another termi publish-manifest-kubernetes: build-image-kubernetes ## Create and push the kubernetes manifest ./scripts/publish-manifest-kubernetes +.PHONY: publish-manifest-runtime +publish-manifest-runtime: ## Create and push the runtime manifest + ./scripts/publish-manifest-runtime + .PHONY: publish-binary publish-binary: ## Upload binaries ./scripts/publish-binary diff --git a/manifest-runtime.tmpl b/manifest-runtime.tmpl deleted file mode 100644 index e4a64aba38..0000000000 --- a/manifest-runtime.tmpl +++ /dev/null @@ -1,14 +0,0 @@ -image: rancher/rke2-runtime:{{replace "+" "-" build.tag}} -manifests: - - image: rancher/rke2-runtime:{{replace "+" "-" build.tag}}-linux-amd64 - platform: - architecture: amd64 - os: linux - - image: rancher/rke2-runtime:{{replace "+" "-" build.tag}}-linux-arm64 - platform: - architecture: arm64 - os: linux - - image: rancher/rke2-runtime:{{replace "+" "-" build.tag}}-windows-amd64 - platform: - architecture: amd64 - os: windows diff --git a/scripts/publish-manifest-runtime b/scripts/publish-manifest-runtime new file mode 100755 index 0000000000..7364ea7eda --- /dev/null +++ b/scripts/publish-manifest-runtime @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -ex + +cd $(dirname $0)/.. + +source ./scripts/version.sh +export DOCKER_CLI_EXPERIMENTAL=enabled + +docker manifest create \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 \ + ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 + +docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-amd64 --os linux --arch amd64 +docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-linux-arm64 --os linux --arch arm64 +docker manifest annotate ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 --os windows --arch amd64 + +set +x +docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD +set -x + +docker manifest push ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}