-
Notifications
You must be signed in to change notification settings - Fork 4
192 lines (171 loc) · 6.75 KB
/
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
---
name: CI Plugin workflow
on:
pull_request:
push:
tags:
- 'v*.*.*'
env:
REGISTRY_USER: opct+github_opct_plugins
REGISTRY_ADDR: quay.io
jobs:
linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Shellcheck - hack
uses: azohra/shell-linter@latest
with:
path: "hack/*.sh"
- name: Shellcheck - Plugin - openshift-tests
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-provider-cert/plugin/*.sh'
- name: Shellcheck - Plugin - openshift-tests - hack
uses: azohra/shell-linter@latest
with:
path: './openshift-tests-provider-cert/hack/*.sh'
#
# Build container image
#
build-container:
name: release container(devel)
if: ${{ github.event_name == 'pull_request' && github.base_ref == 'main' }}
runs-on: ubuntu-22.04
needs: [linters]
env:
VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
TOOLS_REPO: localhost/tools
PLUGIN_TESTS_REPO: localhost/plugin-openshift-tests
MGM_REPO: localhost/must-gather-monitoring
#environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Log in to Quay.io
uses: redhat-actions/podman-login@v1
with:
username: ${{ env.REGISTRY_USER }}
password: ${{ secrets.REG_PASS }}
registry: ${{ env.REGISTRY_ADDR }}
# # https://github.com/marketplace/actions/podman-login
# - name: Log in to Quay.io
# uses: redhat-actions/podman-login@v1
# with:
# username: ${{ env.PROD_QUAY_USER }}
# password: ${{ env.PROD_QUAY_PASS }}
# registry: quay.io
- name: Build and publish container images
shell: bash
run: |
#echo "> Logging to Quay.io and user [${{ env.OPCT_USER }}]:"
##podman login -u="${{ env.OPCT_USER }}" -p="${{ env.OPCT_PASS }}" quay.io
echo "> Build and publish container image:"
bash ./hack/build-all.sh
# # TODO1: arm64 environment on Github Actions is not working.
# # manual steps is required:
# # $ make build-arch-arm64 VERSION=${VERSION}
# # $ make push-manifests VERSION=${VERSION}
#
# # TODO2: Quay login is not working for newer steps. Secrets are returning empty values.
#
# image is not working with podman
# - uses: uraimo/run-on-arch-action@v2
# name: Build images arm64
# id: build
# with:
# arch: aarch64
# distro: ubuntu20.04
# shell: /bin/bash
# env: |
# VERSION: "v0.0.0-devel-pr.${{ github.event.pull_request.number }}"
# TOOLS_REPO: localhost/tools
# PLUGIN_TESTS_REPO: localhost/plugin-openshift-tests
# MGM_REPO: localhost/must-gather-monitoring
# run: |
# apt-get update \
# && apt -y install build-essential lsb-release curl gpg
# # https://podman.io/docs/installation
# mkdir -p /etc/apt/keyrings
# curl -fsSL "https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/Release.key" \
# | gpg --dearmor \
# | tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
# echo \
# "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg]\
# https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_$(lsb_release -rs)/ /" \
# | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
# #apt-get update -qq
# apt-get -qq -y install podman
# echo "> Build and publish container image:"
# make build-arch-arm64 VERSION=${VERSION}
# - name: Build manifests
# shell: bash
# run: |
# echo "> Build and publish container image:"
# make build-manifests VERSION=${VERSION}
# - name: Push images
# shell: bash
# run: |
# echo "> PuBuild and publish manifests"
# make push-manifests VERSION=${VERSION}
# # Commenting in PR
- name: Find comment
uses: peter-evans/find-comment@v2
id: fbc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: '<!-- id-build-comment -->'
- name: Create comment
# if: steps.fbc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
<!-- id-build-comment -->
Images built:
- Tools: [quay.io/opct/tools:${{ env.VERSION }}](https://quay.io/repository/opct/tools?tab=tags)
- Plugin openshift-tests: [quay.io/opct/plugin-openshift-tests:${{ env.VERSION }}](https://quay.io/repository/opct/plugin-openshift-tests?tab=tags)
- Must-Gather Monitoring: [quay.io/opct/must-gather-monitoring:${{ env.VERSION }}](https://quay.io/repository/opct/must-gather-monitoring?tab=tags)
reactions: rocket
#
# Releasing: triggered when a tag is created
#
release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- build-container
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set vars
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Push Container image
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
QUAY_USER: ${{ secrets.QUAY_USER }}
QUAY_PASS: ${{ secrets.QUAY_PASS }}
run: |
podman login -u="${QUAY_USER}" -p="${QUAY_PASS}" quay.io
cd openshift-tests-provider-cert/;
make release VERSION=$RELEASE_VERSION
# https://github.com/mikepenz/release-changelog-builder-action#configuration
- name: Build Changelog
id: github_release
uses: mikepenz/[email protected]
with:
configuration: ".github/workflows/changelog-configuration.json"
# https://github.com/softprops/action-gh-release
- name: Create Release on Github
uses: softprops/[email protected]
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
with:
body: |
## Changelog
Image published to [quay.io/ocp-cert/openshift-tests-provider-cert:$RELEASE_VERSION](https://quay.io/repository/ocp-cert/openshift-tests-provider-cert?tab=tags)
${{steps.github_release.outputs.changelog}}