-
Notifications
You must be signed in to change notification settings - Fork 73
92 lines (81 loc) · 3.67 KB
/
publish-operators-for-e2e-tests.yml
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
name: publish-operators-for-e2e-tests
on:
issue_comment:
types: [created]
pull_request_target:
types: [opened, synchronize, reopened, ready_for_review]
env:
GOPATH: /tmp/go
jobs:
binary:
name: Build & push operator bundles for e2e tests
runs-on: ubuntu-20.04
if: ${{ github.event.comment == '' || contains(github.event.comment.body, '/retest') || contains(github.event.comment.body, '/test all') || contains(github.event.comment.body, '/test e2e') }}
steps:
# Checkout from PR event - in that case the comment field is empty
- name: Checkout code from PR event
uses: actions/checkout@v4
if: ${{ github.event.comment == '' }}
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
fetch-depth: 0
# If the workflow was triggered based on comment, then we need to get the information about the PR
# Is executed only for comment events - in that case the pull_request field is empty
- name: Send Github API Request to get PR data
id: request
uses: octokit/[email protected]
if: ${{ github.event.pull_request == '' }}
with:
route: ${{ github.event.issue.pull_request.url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Checkout the code based on the data retrieved from the previous step
# Is executed only for comment events - in that case the pull_request field is empty
- name: Checkout code from PR
uses: actions/checkout@v4
if: ${{ github.event.pull_request == '' }}
with:
repository: ${{ fromJson(steps.request.outputs.data).head.repo.full_name }}
ref: ${{ fromJson(steps.request.outputs.data).head.ref }}
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles ('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Prepare tools
uses: codeready-toolchain/toolchain-cicd/prepare-tools-action@master
# Execute composite action using values from PR event
# Is executed only for PR events - in that case the comment field is empty
- name: Publish current operator bundles for host & member based on PR event
uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master
if: ${{ github.event.comment == '' }}
with:
quay-token: ${{ secrets.TEST_QUAY_TOKEN }}
quay-namespace: codeready-toolchain-test
sha: ${{ github.event.pull_request.head.sha }}
pr-number: ${{ github.event.pull_request.number }}
author: ${{ github.event.pull_request.head.user.login }}
gh-head-ref: ${{ github.event.pull_request.head.ref }}
# Execute composite action using values from PR event
# Is executed only for comment events - in that case the pull_request field is empty
- name: Publish current operator bundles for host & member based on comment event
uses: codeready-toolchain/toolchain-cicd/publish-operators-for-e2e-tests@master
if: ${{ github.event.pull_request == '' }}
with:
quay-token: ${{ secrets.TEST_QUAY_TOKEN }}
quay-namespace: codeready-toolchain-test
sha: ${{ fromJson(steps.request.outputs.data).head.sha }}
pr-number: ${{ fromJson(steps.request.outputs.data).number }}
author: ${{ fromJson(steps.request.outputs.data).head.user.login }}
gh-head-ref: ${{ fromJson(steps.request.outputs.data).head.ref }}