-
Notifications
You must be signed in to change notification settings - Fork 5
192 lines (184 loc) · 6.13 KB
/
release.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: Release
env:
VSPHERE_USERNAME: ${{ secrets.VSPHERE_NKP_SRE_USERNAME }}
VSPHERE_PASSWORD: ${{ secrets.VSPHERE_SRE_PASSWORD }}
VSPHERE_SERVER: ${{ secrets.VSPHERE_NKP_SERVER }}
GOVC_URL: ${{ secrets.VSPHERE_NKP_SRE_USERNAME }}:${{ secrets.VSPHERE_SRE_PASSWORD }}@${{ secrets.VSPHERE_NKP_SERVER }}
PKR_VAR_vsphere_cluster: ${{ secrets.VSPHERE_CLUSTER }}
PKR_VAR_vsphere_datacenter: ${{ secrets.VSPHERE_DATACENTER }}
PKR_VAR_vsphere_datastore: ${{ secrets.VSPHERE_NKP_DATASTORE }}
PKR_VAR_vsphere_network: ${{ secrets.VSPHERE_NKP_NETWORK }}
PKR_VAR_vsphere_resource_pool: ${{ secrets.VSPHERE_RESOURCE_POOL }}
RHN_SUBSCRIPTION_ORG: ${{ secrets.RHN_SUBSCRIPTION_ORG }}
RHN_SUBSCRIPTION_KEY: ${{ secrets.RHN_SUBSCRIPTION_KEY }}
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
os:
description: "The OS to run the release with"
type: choice
required: true
options:
- all
- ubuntu-20
- ubuntu-22
- os-ubuntu
- rocky-8.7
- rocky-9.1
- os-rocky
- centos-7.9
- os-centos
- rhel-8.6
- rhel-8.8
- rhel-8.10
- rhel-9.4
- os-rhel
- oraclelinux-9.4
- os-oraclelinux
- flatcar-3033.3.16
- os-flatcar
jobs:
build_list:
runs-on: self-hosted-nutanix-medium
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- name: Empty OS matrix
id: empty-os-matrix
run: |
echo "buildmatrix=$(jq -cn --arg os_list '' '{os: $os_list | split(",")}')" >> $GITHUB_ENV
- name: Build OS matrix for all OS
if: github.event.inputs.os == 'all' || startsWith(github.ref, 'refs/tags/')
id: build-os-matrix
run: |
DYNAMICOSLIST=$(make list-os-versions | head -c -1 | tr '\n' ',')
echo "buildmatrix=$(jq -cn --arg os_list $DYNAMICOSLIST '{os: $os_list | split(",")}')" >> $GITHUB_ENV
- name: Build OS matrix for distro (os prefix)
if: contains(github.event.inputs.os, 'os-')
id: build-os-matrix-distro
run: |
OSPREFIX=$(echo ${{ github.event.inputs.os }} | cut -d '-' -f 2)
DYNAMICOSLIST=$(make list-os-versions | grep -E "$OSPREFIX" | head -c -1 | tr '\n' ',')
echo "buildmatrix=$(jq -cn --arg os_list $DYNAMICOSLIST '{os: $os_list | split(",")}')" >> $GITHUB_ENV
- name: Build OS matrix for single OS
if: github.event.inputs.os != 'all' && !contains(github.event.inputs.os, 'os-')
id: build-os-matrix-single
run: |
echo "buildmatrix=$(jq -cn --arg os_list '${{ github.event.inputs.os }}' '{os: $os_list | split(",")}')" >> $GITHUB_ENV
- name: Set matrix output
id: set-matrix
run: |
echo 'matrix=${{ env.buildmatrix }}' >> $GITHUB_OUTPUT
release:
name: Create D2iQ Templates
runs-on: self-hosted-nutanix-medium
needs: build_list
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build_list.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Setup requirements
run: |
sudo apt-get update && sudo apt-get -y install xorriso
curl -L -o - "https://github.com/vmware/govmomi/releases/latest/download/govc_$(uname -s)_$(uname -m).tar.gz" | sudo tar -C /usr/local/bin -xvzf - govc
- name: Run release for ${{ matrix.os }}
run: make ${{ matrix.os }}-release
create_release:
permissions:
contents: write
name: Create Github release
runs-on: self-hosted-nutanix-medium
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
export:
name: Generate OVF for Export
needs: [release]
runs-on: self-hosted-nutanix-medium
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20
- ubuntu-22
- rocky-8.7
- rocky-9.1
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Setup requirements
run: |
sudo apt-get update && sudo apt-get -y install xorriso
- name: Export ovf for ${{ matrix.os }}
run: make ${{ matrix.os }}-ovf
- uses: actions/upload-artifact@v3
with:
name: releaseovf
path: |
manifests/ovf/*.ovf.tar.gz
artifactinventory:
name: Create artifact inventory
runs-on: self-hosted-nutanix-medium
needs: [export]
outputs:
listovf: ${{ steps.list.outputs.listovf }}
steps:
- uses: actions/download-artifact@v3
id: download
with:
name: releaseovf
path: releaseovf/
- name: json from downloaded artifacts
id: list
run: |
DATA=$(ls releaseovf/*.ovf.tar.gz | jq -R -s -c 'split("\n")[:-1]')
echo "listovf=$DATA" >> "$GITHUB_OUTPUT"
releaseassets:
name: Upload release assets
permissions:
contents: write
runs-on: self-hosted-nutanix-medium
needs: [create_release, artifactinventory]
strategy:
fail-fast: false
matrix:
ovf: ${{ fromJSON(needs.artifactinventory.outputs.listovf) }}
steps:
- uses: actions/download-artifact@v3
id: download
with:
name: releaseovf
path: releaseovf/
- name: Upload ovf
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{ matrix.ovf }}
asset_name: ${{ matrix.ovf }}
asset_content_type: application/zip