Skip to content

ImageRelease

ImageRelease #5

Workflow file for this run

name: ImageRelease
on:
push:
tags:
- 'v*.*.*'
env:
# Common versions
GO_VERSION: '1.22'
GO_REQUIRED_MIN_VERSION: ''
GOPATH: '/home/runner/work/ocm/ocm/go'
GITHUB_REF: ${{ github.ref }}
defaults:
run:
working-directory: go/src/open-cluster-management.io/ocm
permissions:
contents: read
jobs:
env:
name: prepare release env
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/ocm
- name: get release version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: get major release version
run: |
echo "MAJOR_RELEASE_VERSION=${RELEASE_VERSION%.*}" >> $GITHUB_ENV
echo "TRIMMED_RELEASE_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV
outputs:
MAJOR_RELEASE_VERSION: ${{ env.MAJOR_RELEASE_VERSION }}
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
images:
name: images
runs-on: ubuntu-latest
needs: [ env ]
strategy:
matrix:
arch: [ amd64, arm64 ]
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/ocm
- name: install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: install imagebuilder
run: go install github.com/openshift/imagebuilder/cmd/[email protected]
- name: pull base image
run: docker pull registry.access.redhat.com/ubi8/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
- name: images
run: |
IMAGE_TAG=${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} \
IMAGE_BUILD_EXTRA_FLAGS="--build-arg OS=linux --build-arg ARCH=${{ matrix.arch }}" \
make images
- name: push
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
docker push quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
docker push quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
docker push quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
docker push quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
docker push quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }}
image-manifest:
name: image manifest
runs-on: ubuntu-latest
needs: [ env, images ]
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/ocm
- name: create
run: |
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
# registration
docker manifest create quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 \
quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }}-arm64
# work
docker manifest create quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 \
quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }}-arm64
# placement
docker manifest create quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 \
quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }}-arm64
# addon-manager
docker manifest create quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 \
quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }}-arm64
# registration-operator
docker manifest create quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 \
quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }}-arm64
- name: annotate
run: |
# registration
docker manifest annotate quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64
docker manifest annotate quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }}-arm64 --arch arm64
# work
docker manifest annotate quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64
docker manifest annotate quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }}-arm64 --arch arm64
# placement
docker manifest annotate quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64
docker manifest annotate quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }}-arm64 --arch arm64
# addon-manager
docker manifest annotate quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64
docker manifest annotate quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }}-arm64 --arch arm64
# registration-operator
docker manifest annotate quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }}-amd64 --arch amd64
docker manifest annotate quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }} \
quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }}-arm64 --arch arm64
- name: push
run: |
docker manifest push quay.io/open-cluster-management/registration:${{ needs.env.outputs.RELEASE_VERSION }}
docker manifest push quay.io/open-cluster-management/work:${{ needs.env.outputs.RELEASE_VERSION }}
docker manifest push quay.io/open-cluster-management/placement:${{ needs.env.outputs.RELEASE_VERSION }}
docker manifest push quay.io/open-cluster-management/addon-manager:${{ needs.env.outputs.RELEASE_VERSION }}
docker manifest push quay.io/open-cluster-management/registration-operator:${{ needs.env.outputs.RELEASE_VERSION }}