This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
80 lines (63 loc) · 2.62 KB
/
pr-checks-build-images.yaml
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
name: PR checks - Build operator images
on:
pull_request:
branches:
- master
- 'release-v**.x'
env:
SDK_VERSION: "1.17.0"
CONTAINER_RUNTIME: "podman"
ARTIFACTS: "artifacts"
REGISTRY_PREFIX: quay.io/redhat-developer
REPO: servicebinding-operator
jobs:
build-operator-images:
name: "Build operator images (PR)"
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "^1.18"
- name: Checkout Git Repository
uses: actions/checkout@v4
- name: Setup CLI
uses: ./.github/actions/setup-cli
with:
operator-sdk: true
- name: Setup local registry
run: |
.github/actions/setup-podman/setup-local-registry.sh
.github/actions/setup-podman/setup-podman-wrapper.sh
- name: Build images
env:
PR_NUMBER: ${{github.event.pull_request.number}}
PR_SHA: ${{github.event.pull_request.head.sha}}
OPERATOR_REPO_REF: ${{env.REGISTRY_PREFIX}}/${{env.REPO}}
run: |
export TAG=pr-${PR_NUMBER}-${PR_SHA:0:8}
export OPERATOR_IMAGE_REF=${OPERATOR_REPO_REF}:${TAG}
export OPERATOR_BUNDLE_IMAGE_REF=${OPERATOR_IMAGE_REF}-bundle
export OPERATOR_INDEX_IMAGE_REF=$(make operator-index-image-ref)
export OPERATOR_UPGRADE_INDEX_IMAGE_REF=${OPERATOR_IMAGE_REF}-index
export OPERATOR_BUNDLE_VERSION=$(make operator-version)-${TAG}
which podman
make opm
podman pull ${OPERATOR_INDEX_IMAGE_REF}
OPM=.github/actions/setup-podman/opm BUILDAH_FORMAT=docker make SKIP_REGISTRY_LOGIN=true push-index-image-upgrade -o registry-login
mkdir -p ${ARTIFACTS}
echo "export OPERATOR_IMAGE_REF=${OPERATOR_IMAGE_REF}" >> ${ARTIFACTS}/operator.refs
echo "export OPERATOR_BUNDLE_IMAGE_REF=${OPERATOR_BUNDLE_IMAGE_REF}" >> ${ARTIFACTS}/operator.refs
echo "export OPERATOR_INDEX_IMAGE_REF=${OPERATOR_UPGRADE_INDEX_IMAGE_REF}" >> ${ARTIFACTS}/operator.refs
podman stop reg
tar -czvf ${ARTIFACTS}/registry.tar.gz -C ${GITHUB_WORKSPACE} registry
- name: Archive images
uses: actions/upload-artifact@v3
with:
name: operator-images-${{github.event.pull_request.number}}-${{github.event.pull_request.head.sha}}
path: ${{env.ARTIFACTS}}/*.tar.gz
- name: Archive image references
uses: actions/upload-artifact@v3
with:
name: operator-refs-${{github.event.pull_request.number}}-${{github.event.pull_request.head.sha}}
path: ${{env.ARTIFACTS}}/*.refs