forked from project-codeflare/codeflare-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (140 loc) · 8.31 KB
/
project-codeflare-release.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
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
# This workflow will build and release all components of the CodeFlare project
name: Project CodeFlare Release
on:
workflow_dispatch:
inputs:
operator-version:
description: 'CodeFlare operator version to be released (for example: v0.0.0)'
required: true
replaces:
description: 'The previous operator semantic version that this release replaces (for example: v0.0.0)'
required: true
mcad-version:
description: 'Version of multi-cluster-app-dispatcher to be released (for example: v0.0.0)'
required: true
codeflare-sdk-version:
description: 'Version of CodeFlare-SDK to be released (for example: v0.0.0)'
required: true
instascale-version:
description: 'Version of InstaScale to be released (for example: v0.0.0)'
required: true
is-stable:
description: 'Select if the built images should be tagged as stable'
required: true
type: boolean
codeflare-repository-organization:
description: 'GitHub organization/user containing repositories used for release'
required: true
default: 'project-codeflare'
quay-organization:
description: 'Quay organization used to push the built images to'
required: true
default: 'project-codeflare'
community-operators-prod-organization:
description: 'Owner of target community-operators-prod repository used to open a PR against'
required: true
default: 'redhat-openshift-ecosystem'
jobs:
release-mcad:
runs-on: ubuntu-latest
steps:
- name: Check if MCAD release does exist
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/project-codeflare/multi-cluster-app-dispatcher/releases/tag/${{ github.event.inputs.mcad-version }})
if [[ "$status_code" == "200" ]]; then
echo "MCAD release with version ${{ github.event.inputs.mcad-version }} already exist. Will not create MCAD release."
fi
echo "MCAD_RELEASE_STATUS_CODE=$status_code" >> $GITHUB_ENV
- name: Release MCAD
run: |
gh workflow run mcad-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --ref ${{ github.ref }} --field tag=${{ github.event.inputs.mcad-version }} --field quay-organization=${{ github.event.inputs.quay-organization }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.MCAD_RELEASE_STATUS_CODE != '200' }}
- name: Wait for MCAD run to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow mcad-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/multi-cluster-app-dispatcher --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.MCAD_RELEASE_STATUS_CODE != '200' }}
release-instascale:
needs: release-mcad
runs-on: ubuntu-latest
steps:
- name: Check if Instascale release does exist
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/project-codeflare/instascale/releases/tag/${{ github.event.inputs.instascale-version }})
if [[ "$status_code" == "200" ]]; then
echo "Instascale release with version ${{ github.event.inputs.instascale-version }} already exist. Will not create Instascale release."
fi
echo "INSTASCALE_RELEASE_STATUS_CODE=$status_code" >> $GITHUB_ENV
- name: Release InstaScale
run: |
gh workflow run instascale-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field tag=${{ github.event.inputs.instascale-version }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field quay-organization=${{ github.event.inputs.quay-organization }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.INSTASCALE_RELEASE_STATUS_CODE != '200' }}
- name: Wait for InstaScale run to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow instascale-release.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/instascale --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.INSTASCALE_RELEASE_STATUS_CODE != '200' }}
release-codeflare-sdk:
runs-on: ubuntu-latest
steps:
- name: Check if Codeflare SDK release does exist
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" https://github.com/project-codeflare/codeflare-sdk/releases/tag/${{ github.event.inputs.codeflare-sdk-version }})
if [[ "$status_code" == "200" ]]; then
echo "SDK release with version ${{ github.event.inputs.codeflare-sdk-version }} already exist. Will not create SDK release."
fi
echo "SDK_RELEASE_STATUS_CODE=$status_code" >> $GITHUB_ENV
- name: Release CodeFlare SDK
run: |
semver_version="${{ github.event.inputs.codeflare-sdk-version }}"
plain_version="${semver_version:1}"
gh workflow run release.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --ref ${{ github.ref }} --field release-version=${plain_version} --field is-stable=${{ github.event.inputs.is-stable }} --field quay-organization=${{ github.event.inputs.quay-organization }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.SDK_RELEASE_STATUS_CODE != '200' }}
- name: Wait for CodeFlare SDK run to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow release.yaml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-sdk --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
if: ${{ env.SDK_RELEASE_STATUS_CODE != '200' }}
release-codeflare-operator:
needs: [release-mcad, release-instascale, release-codeflare-sdk]
runs-on: ubuntu-latest
steps:
- name: Release CodeFlare operator
run: |
gh workflow run tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --ref ${{ github.ref }} --field is-stable=${{ github.event.inputs.is-stable }} --field version=${{ github.event.inputs.operator-version }} --field replaces=${{ github.event.inputs.replaces }} --field mcad-version=${{ github.event.inputs.mcad-version }} --field codeflare-sdk-version=${{ github.event.inputs.codeflare-sdk-version }} --field instascale-version=${{ github.event.inputs.instascale-version }} --field quay-organization=${{ github.event.inputs.quay-organization }} --field community-operators-prod-fork-organization=${{ github.event.inputs.codeflare-repository-organization }} --field community-operators-prod-organization=${{ github.event.inputs.community-operators-prod-organization }}
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash
- name: Wait for CodeFlare operator run to finish
run: |
# wait for a while for Run to be started
sleep 5
run_id=$(gh run list --workflow tag-and-build.yml --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --limit 1 --json databaseId --jq .[].databaseId)
gh run watch ${run_id} --repo ${{ github.event.inputs.codeflare-repository-organization }}/codeflare-operator --interval 10 --exit-status
env:
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
shell: bash