-
Notifications
You must be signed in to change notification settings - Fork 23
115 lines (106 loc) · 3.99 KB
/
ensure-capi-images.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
name: Ensure CAPI images
on:
workflow_call:
inputs:
ref:
type: string
description: The Git ref under test.
required: true
outputs:
kube-1-29-image:
value: ${{ jobs.produce_outputs.outputs.kube-1-29-image }}
kube-1-29-version:
value: ${{ jobs.produce_outputs.outputs.kube-1-29-version }}
kube-1-30-image:
value: ${{ jobs.produce_outputs.outputs.kube-1-30-image }}
kube-1-30-version:
value: ${{ jobs.produce_outputs.outputs.kube-1-30-version }}
kube-1-31-image:
value: ${{ jobs.produce_outputs.outputs.kube-1-31-image }}
kube-1-31-version:
value: ${{ jobs.produce_outputs.outputs.kube-1-31-version }}
jobs:
image_manifest:
runs-on: ubuntu-latest
outputs:
manifest: ${{ steps.images.outputs.manifest }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Fetch image details
id: images
run: |
VN="$(jq -r '.["azimuth-images"]' ./dependencies.json)"
MANIFEST="$(curl -fsSL "https://github.com/azimuth-cloud/azimuth-images/releases/download/${VN}/manifest.json")"
echo "manifest=$(jq -c . <<< "$MANIFEST")" >> $GITHUB_OUTPUT
ensure_image:
runs-on: ubuntu-latest
needs: [image_manifest]
strategy:
fail-fast: false
matrix:
include:
- name: kube-1-29
image: ${{ fromJSON(needs.image_manifest.outputs.manifest).kubernetes-1-29-jammy }}
skip: ${{ github.event.pull_request.draft }}
- name: kube-1-30
image: ${{ fromJSON(needs.image_manifest.outputs.manifest).kubernetes-1-30-jammy }}
skip: ${{ github.event.pull_request.draft }}
- name: kube-1-31
image: ${{ fromJSON(needs.image_manifest.outputs.manifest).kubernetes-1-31-jammy }}
skip: false
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
if: ${{ !matrix.skip }}
- name: Write cloud credential
run: echo "$OS_CLOUDS" > clouds.yml
shell: bash
env:
OS_CLOUDS: ${{ secrets.OS_CLOUDS }}
if: ${{ !matrix.skip }}
- uses: actions/setup-python@v4
with:
python-version: '3.10'
check-latest: true
if: ${{ !matrix.skip }}
- name: Install OpenStack CLI
run: pip install python-openstackclient
if: ${{ !matrix.skip }}
- name: Ensure Kubernetes image
id: ensure-image
uses: ./.github/actions/ensure-image
with:
os-cloud: ${{ vars.TARGET_CLOUD }}
image-name: ${{ matrix.image.name }}
image-url: ${{ matrix.image.url }}
if: ${{ !matrix.skip }}
- name: Write matrix outputs
uses: cloudposse/[email protected]
with:
matrix-step-name: ${{ github.job }}
matrix-key: ${{ matrix.name }}
outputs: |-
image-id: ${{ steps.ensure-image.outputs.image-id }}
kube-version: ${{ matrix.image.kubernetes_version }}
if: ${{ !matrix.skip }}
produce_outputs:
runs-on: ubuntu-latest
needs: [ensure_image]
outputs:
kube-1-29-image: ${{ fromJSON(steps.matrix-outputs.outputs.result).image-id.kube-1-29 }}
kube-1-29-version: ${{ fromJSON(steps.matrix-outputs.outputs.result).kube-version.kube-1-29 }}
kube-1-30-image: ${{ fromJSON(steps.matrix-outputs.outputs.result).image-id.kube-1-30 }}
kube-1-30-version: ${{ fromJSON(steps.matrix-outputs.outputs.result).kube-version.kube-1-30 }}
kube-1-31-image: ${{ fromJSON(steps.matrix-outputs.outputs.result).image-id.kube-1-31 }}
kube-1-31-version: ${{ fromJSON(steps.matrix-outputs.outputs.result).kube-version.kube-1-31 }}
steps:
- name: Read matrix outputs
id: matrix-outputs
uses: cloudposse/[email protected]
with:
matrix-step-name: ensure_image