-
Notifications
You must be signed in to change notification settings - Fork 32
114 lines (99 loc) · 3.47 KB
/
Copy pathreleaseimage.yml
File metadata and controls
114 lines (99 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: ImageRelease
on:
push:
tags:
- '*/v*.*.*'
env:
# Common versions
GO_VERSION: '1.24'
GO_REQUIRED_MIN_VERSION: ''
GOPATH: '/home/runner/work/addon-contrib/addon-contrib/go'
GITHUB_REF: ${{ github.ref }}
defaults:
run:
working-directory: go/src/open-cluster-management.io/addon-contrib
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/addon-contrib
- name: prepare release environment
id: prepare-env
uses: ./go/src/open-cluster-management.io/addon-contrib/.github/actions/prepare-release-env
with:
github_ref: ${{ github.ref }}
outputs:
MAJOR_RELEASE_VERSION: ${{ steps.prepare-env.outputs.MAJOR_RELEASE_VERSION }}
RELEASE_VERSION: ${{ steps.prepare-env.outputs.RELEASE_VERSION }}
MATRIX: ${{ steps.prepare-env.outputs.MATRIX }}
images:
name: images
runs-on: ubuntu-latest
needs: [ env ]
strategy:
matrix:
arch: [ amd64, arm64 ]
repository: ${{ fromJson(needs.env.outputs.MATRIX).repository }}
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/addon-contrib
- 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/imagebuilder@v1.2.16
- name: pull base image
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest --platform=linux/${{ matrix.arch }}
- name: Check if Dockerfile exists
id: check-dockerfile
uses: ./go/src/open-cluster-management.io/addon-contrib/.github/actions/check-dockerfile
with:
repository: ${{ matrix.repository }}
repoRoot: go/src/open-cluster-management.io/addon-contrib
- name: build image
if: steps.check-dockerfile.outputs.exists == 'true'
run: |
set -e
cd ${{ matrix.repository }}
IMAGE_TAG=${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} \
IMAGE_BUILD_EXTRA_FLAGS="--build-arg OS=linux --build-arg ARCH=${{ matrix.arch }}" \
make image
- name: push image
if: steps.check-dockerfile.outputs.exists == 'true'
run: |
set -e
cd ${{ matrix.repository }}
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
IMAGE_TAG=${{ needs.env.outputs.RELEASE_VERSION }}-${{ matrix.arch }} \
make image-push
image-manifest:
name: Create and Push Image Manifest
runs-on: ubuntu-latest
needs: [ env, images ]
strategy:
matrix:
repository: ${{ fromJson(needs.env.outputs.MATRIX).repository }}
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
path: go/src/open-cluster-management.io/addon-contrib
- name: create
run: |
set -e
cd ${{ matrix.repository }}
echo ${{ secrets.DOCKER_PASSWORD }} | docker login quay.io --username ${{ secrets.DOCKER_USER }} --password-stdin
IMAGE_TAG=${{ needs.env.outputs.RELEASE_VERSION }} \
make image-manifest