-
Notifications
You must be signed in to change notification settings - Fork 6
109 lines (94 loc) · 3.36 KB
/
iso-ci.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
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
name: iso-ci.yaml
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
release:
types: [ published ]
env:
VCS_URL: https://github.com/IBM/ibm-storage-odf-operator
jobs:
precheck-and-build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go: ["1.18"]
steps:
- uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: check copyright
run: |
make check-copyright
- name: run tests
run: |
make test
- name: login to Quay.io
# Only if we need to push an image
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.QUAYIO_USERNAME }}
password: ${{ secrets.QUAYIO_TOKEN }}
# Setup for buildx
- name: set up QEMU
uses: docker/setup-qemu-action@v1
- name: set up Docker Buildx
uses: docker/[email protected]
# Debugging information
- name: docker info
run: docker info
- name: buildx inspect
run: docker buildx inspect
- name: set output
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: get tag without v
id: tag
shell: bash
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
run: |
BUILD_VERSION=${{ github.event.release.tag_name }}
echo "BUILD_VERSION=${BUILD_VERSION:1}" >> $GITHUB_ENV
# Build and (optionally) push the operator image
- name: build the operator image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/ppc64le,linux/s390x
build-args: |
VCS_REF=${{ env.BUILD_VERSION || 'dev' }}-${{ steps.vars.outputs.sha_short }}
VCS_URL=${{ env.VCS_URL }}
# Only push if we are publishing a release
push: ${{ github.event_name == 'release' && github.event.action == 'published' }}
# Use a 'dev' tag, that won't be pushed, for non-release builds
tags: quay.io/ibmodffs/ibm-storage-odf-operator:${{ env.BUILD_VERSION || 'dev' }}
- name: generate bundle manifests and metadata
run: |
export IMAGE_TAG=${{ env.BUILD_VERSION || 'dev' }}
make bundle
rm -rf ./bundle/manifests/ibm-storage-odf-operator_v1_serviceaccount.yaml
# Build and (optionally) push the operator bundle image
- name: build the operator bundle image
uses: docker/build-push-action@v2
with:
context: .
file: ./bundle.Dockerfile
platforms: linux/amd64,linux/ppc64le,linux/s390x
push: ${{ github.event_name == 'release' && github.event.action == 'published' }}
tags: quay.io/ibmodffs/ibm-storage-odf-operator-bundle:${{ env.BUILD_VERSION || 'dev' }}
# Build and (optionally) push the operator must gather image
- name: build the operator must gather image
uses: docker/build-push-action@v2
with:
context: ./must-gather
file: ./must-gather/Dockerfile
push: ${{ github.event_name == 'release' && github.event.action == 'published' }}
tags: quay.io/ibmodffs/ibm-storage-odf-operator-must-gather:${{ env.BUILD_VERSION || 'dev' }}