forked from stackrox/stackrox
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (87 loc) · 2.51 KB
/
create-cluster.yml
File metadata and controls
91 lines (87 loc) · 2.51 KB
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
name: Create Test Cluster
on:
workflow_call:
secrets:
INFRA_TOKEN:
description: Infra access token
required: true
inputs:
flavor:
description: Flavor (`qa-demo`, `gke-default`, `openshift-4-demo`...)
type: string
required: true
name:
description: Cluster name
type: string
required: true
lifespan:
description: Cluster lifespan
type: string
default: 48h
required: false
args:
description: Comma separated flavor arguments. Ex. nodes=5,main-image=main:tag
type: string
required: false
default: ""
wait:
description: Whether to wait for the cluster readiness
type: boolean
required: false
default: false
workflow_dispatch:
inputs:
flavor:
description: Flavor (`qa-demo`, `gke-default`, `openshift-4-demo`...)
type: string
required: true
name:
description: Cluster name
type: string
required: true
lifespan:
description: Cluster lifespan
type: string
default: 48h
required: false
args:
description: Comma separated flavor arguments. Ex. nodes=5,main-image=main:tag
type: string
required: false
default: ""
wait:
description: Whether to wait for the cluster readiness
type: boolean
required: false
default: false
env:
ACCEPT_RAW: "Accept: application/vnd.github.v3.raw"
script_url: /repos/${{ github.repository }}/contents/.github/workflows/scripts/common.sh?ref=${{ github.ref_name }}
jobs:
infra:
runs-on: ubuntu-latest
steps:
- name: Download infractl
run: |
mkdir -p ~/.local/bin
curl --fail -sL https://infra.rox.systems/v1/cli/linux/amd64/upgrade \
| jq -r ".result.fileChunk" \
| base64 -d \
> ~/.local/bin/infractl
chmod +x ~/.local/bin/infractl
# Ensure that the binary works
infractl --version
- name: Create Cluster
env:
INFRA_TOKEN: ${{secrets.INFRA_TOKEN}}
GH_TOKEN: ${{ github.token }}
GH_NO_UPDATE_NOTIFIER: 1
run: |
set -uo pipefail
gh api -H "$ACCEPT_RAW" "${{env.script_url}}" | bash -s -- \
create-cluster \
"${{inputs.flavor}}" \
"${{inputs.name}}" \
"${{inputs.lifespan}}" \
"${{inputs.wait}}" \
"${{inputs.args}}"