Skip to content

Commit

Permalink
rke2-runtime signing and manifests (#7089) (#7102)
Browse files Browse the repository at this point in the history
Signed-off-by: Brooks Newberry <[email protected]>
  • Loading branch information
brooksn authored Oct 23, 2024
1 parent 02fbb2a commit 8e1c66a
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 24 deletions.
85 changes: 69 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
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 ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials password | PRIME_REGISTRY_PASSWORD
- name: Package Images
run: |
Expand All @@ -57,12 +60,37 @@ jobs:
dapper -f Dockerfile --target dapper make test
- name: Publish Image Runtime
run: |
GITHUB_ACTION_TAG=${{ github.ref_name }} dapper -f Dockerfile --target dapper make publish-image-runtime
env:
DOCKER_USERNAME: ${{ env.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}

uses: rancher/ecm-distro-tools/actions/publish-image@master
with:
image: "rke2-runtime"
tag: ${{ github.ref_name }}
make-target: publish-image-runtime

public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}

prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}

- name: Publish Image Runtime (Windows)
uses: rancher/ecm-distro-tools/actions/publish-image@master
with:
image: "rke2-runtime"
tag: ${{ github.ref_name }}
make-target: publish-image-runtime-windows

public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}

prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}

- name: Package windows images
run: |
GITHUB_ACTION_TAG=${{ github.ref_name }} dapper -f Dockerfile --target dapper make package-windows-images
Expand Down Expand Up @@ -101,6 +129,9 @@ jobs:
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 ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials password | PRIME_REGISTRY_PASSWORD ;
- name: Package Images
run: |
Expand All @@ -112,11 +143,20 @@ jobs:
dapper -f Dockerfile --target dapper make scan-images
- name: Publish Image Runtime
run: |
GITHUB_ACTION_TAG=${{ github.ref_name }} dapper -f Dockerfile --target dapper make publish-image-runtime
env:
DOCKER_USERNAME: ${{ env.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ env.DOCKER_PASSWORD }}
uses: rancher/ecm-distro-tools/actions/publish-image@master
with:
image: "rke2-runtime"
tag: ${{ github.ref_name }}
make-target: publish-image-runtime

public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}

prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}

- name: Checksum
run: |
Expand Down Expand Up @@ -145,13 +185,26 @@ jobs:
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 ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials registry | PRIME_REGISTRY ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials username | PRIME_REGISTRY_USERNAME ;
secret/data/github/repo/${{ github.repository }}/rancher-prime-registry/credentials password | PRIME_REGISTRY_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 }}
uses: rancher/ecm-distro-tools/actions/publish-image@master
with:
image: "rke2-runtime"
tag: ${{ github.ref_name }}
make-target: publish-manifest-runtime

public-repo: rancher
public-username: ${{ env.DOCKER_USERNAME }}
public-password: ${{ env.DOCKER_PASSWORD }}

prime-repo: rancher
prime-registry: ${{ env.PRIME_REGISTRY }}
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
prime-password: ${{ env.PRIME_REGISTRY_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
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ build-image-runtime: ## Build the runtime image
publish-image-runtime: build-image-runtime
./scripts/publish-image-runtime

.PHONY: publish-image-runtime-windows
publish-image-runtime: build-image-runtime
./scripts/publish-image-runtime-windows

.PHONY: validate
validate: ## Run go fmt/vet
./scripts/validate
Expand Down
22 changes: 14 additions & 8 deletions scripts/publish-image-runtime
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ cd $(dirname $0)/..

source ./scripts/version.sh

set +x
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
set -x

docker image push ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-${GOOS}-${GOARCH}
if [ "${GOARCH}" != "s390x" ] && [ "${GOARCH}" != "arm64" ]; then
docker image push ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64
fi
DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker image build ${IID_FILE_FLAG} \
--sbom=true \
--attest type=provenance,mode=max \
--build-arg TAG=${VERSION} \
--build-arg KUBERNETES_VERSION=${KUBERNETES_VERSION} \
--build-arg MAJOR=${VERSION_MAJOR} \
--build-arg MINOR=${VERSION_MINOR} \
--build-arg DAPPER_HOST_ARCH=${GOARCH} \
--build-arg CACHEBUST="$(date +%s%N)" \
--tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-${GOOS}-${GOARCH} \
--target runtime \
--file Dockerfile \
--push \
.
20 changes: 20 additions & 0 deletions scripts/publish-image-runtime-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -ex

cd $(dirname $0)/..

source ./scripts/version.sh

DOCKER_BUILDKIT=${DOCKER_BUILDKIT:-1} docker image build ${IID_FILE_FLAG} \
--sbom=true \
--attest type=provenance,mode=max \
--build-arg TAG=${VERSION} \
--build-arg KUBERNETES_VERSION=${KUBERNETES_VERSION} \
--build-arg MAJOR=${VERSION_MAJOR} \
--build-arg MINOR=${VERSION_MINOR} \
--build-arg CACHEBUST="$(date +%s%N)" \
--tag ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}-windows-amd64 \
--target windows-runtime \
--file Dockerfile.windows \
--push \
.
4 changes: 4 additions & 0 deletions scripts/publish-manifest-runtime
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
set -x

docker manifest push ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION}

if [ -n "${IID_FILE}" ]; then
docker buildx imagetools inspect --format "{{json .Manifest}}" ${REPO}/${PROG}-runtime:${DOCKERIZED_VERSION} | jq -r '.digest' > ${IID_FILE}
fi

0 comments on commit 8e1c66a

Please sign in to comment.