@@ -9,10 +9,18 @@ inputs:
9
9
description : The ref to use for the Azimuth configuration.
10
10
required : true
11
11
default : devel
12
- config-environment :
13
- description : The config environment to use.
12
+ target-cloud :
13
+ description : |-
14
+ The name of the cloud to target.
15
+ This is used as both the name of the cloud with the clouds.yaml
16
+ and to determine the config environment to use.
17
+ Currently, arcus and leafcloud are supported.
14
18
required : true
15
- default : ci
19
+ default : arcus
20
+ install-mode :
21
+ description : The install mode to use. Either singlenode or ha.
22
+ required : true
23
+ default : singlenode
16
24
azimuth-ops-version :
17
25
description : >
18
26
The azimuth-ops version to use. If not given, the default version is used.
@@ -26,21 +34,12 @@ inputs:
26
34
os-clouds :
27
35
description : The contents of the clouds.yaml to use.
28
36
required : true
29
- os-cloud-name :
30
- description : The name of the cloud within the clouds.yaml to use.
31
- required : true
32
- default : openstack
33
37
environment-prefix :
34
38
description : >
35
39
The environment prefix to use. The run ID will be appended to this,
36
40
separated by a hyphen.
37
41
required : true
38
42
default : ci
39
- allocate-ingress-ip :
40
- description : >
41
- Indicates whether a floating IP should be allocated for ingress.
42
- required : true
43
- default : " yes"
44
43
runs :
45
44
using : composite
46
45
steps :
63
62
run : cat > ./ci.env <<< "$CI_ENV"
64
63
env :
65
64
CI_ENV : |
66
- export OS_CLOUD="${{ inputs.os -cloud-name }}"
65
+ export OS_CLOUD="${{ inputs.target -cloud }}"
67
66
export OS_CLIENT_CONFIG_FILE="$PWD/clouds.yaml"
68
- export AZIMUTH_CONFIG_ENVIRONMENT=${{ inputs.config-environment }}
67
+ export AZIMUTH_CONFIG_ENVIRONMENT=${{ inputs.target-cloud }}${{ inputs.install-mode == 'ha' && '-ha' || '' }}
69
68
export AZIMUTH_ENVIRONMENT="${{ inputs.environment-prefix }}-${{ github.run_id }}"
70
69
export ANSIBLE_FORCE_COLOR=true
71
70
@@ -108,32 +107,61 @@ runs:
108
107
source ./bin/activate "$AZIMUTH_CONFIG_ENVIRONMENT" "$AZIMUTH_ENVIRONMENT"
109
108
ansible-galaxy install -f -r requirements.yml
110
109
110
+ # Generate and append the S3 credential to the CI environment file
111
+ - name : Configure S3 lock
112
+ id : s3-lock-config
113
+ shell : bash
114
+ run : |
115
+ set -e
116
+ source ci.env
117
+ source ./bin/activate "$AZIMUTH_CONFIG_ENVIRONMENT" "$AZIMUTH_ENVIRONMENT"
118
+ if [ -z "$CI_S3_LOCK_HOST" ]; then
119
+ echo "CI_S3_LOCK_HOST not set - no lock will be used"
120
+ exit
121
+ elif [ -z "$CI_S3_LOCK_BUCKET" ]; then
122
+ echo "CI_S3_LOCK_BUCKET is required when using the lock" >&2
123
+ exit 1
124
+ fi
125
+ CI_S3_LOCK_ACCESS_KEY="$(openstack ec2 credentials create -f value -c access)"
126
+ CI_S3_LOCK_SECRET_KEY="$(openstack ec2 credentials show -f value -c secret $CI_S3_LOCK_ACCESS_KEY)"
127
+ cat >> ci.env <<EOF
128
+ export CI_S3_LOCK_ACCESS_KEY="$CI_S3_LOCK_ACCESS_KEY"
129
+ export CI_S3_LOCK_SECRET_KEY="$CI_S3_LOCK_SECRET_KEY"
130
+ EOF
131
+ echo "host=${CI_S3_LOCK_HOST}" >> "$GITHUB_OUTPUT"
132
+ echo "access-key=${CI_S3_LOCK_ACCESS_KEY}" >> "$GITHUB_OUTPUT"
133
+ echo "secret-key=${CI_S3_LOCK_SECRET_KEY}" >> "$GITHUB_OUTPUT"
134
+ echo "bucket=${CI_S3_LOCK_BUCKET}" >> "$GITHUB_OUTPUT"
135
+
136
+ - name : Acquire S3 lock
137
+ uses : stackhpc/github-actions/s3-lock@master
138
+ with :
139
+ host : ${{ steps.s3-lock-config.outputs.host }}
140
+ access-key : ${{ steps.s3-lock-config.outputs.access-key }}
141
+ secret-key : ${{ steps.s3-lock-config.outputs.secret-key }}
142
+ bucket : ${{ steps.s3-lock-config.outputs.bucket }}
143
+ action : acquire
144
+ if : ${{ steps.s3-lock-config.outputs.host != '' }}
145
+
111
146
- name : Allocate floating IP for ingress
112
147
shell : bash
113
148
run : |
114
149
set -eo pipefail
115
150
source ci.env
116
151
source ./bin/activate "$AZIMUTH_CONFIG_ENVIRONMENT" "$AZIMUTH_ENVIRONMENT"
117
- ansible_variable() {
118
- ansible -m debug -a "var=$1" -e @extra-vars.yml all |
119
- jq -r ".plays[0].tasks[0].hosts.localhost.$1"
120
- }
121
- INSTALL_MODE="$(ansible_variable install_mode)"
122
- EXTNET_ID="$(ansible_variable infra_external_network_id)"
152
+ EXTNET_ID="$(
153
+ ansible -m debug -a "var=infra_external_network_id" -e @extra-vars.yml all |
154
+ jq -r ".plays[0].tasks[0].hosts.localhost.infra_external_network_id"
155
+ )"
123
156
IP_ADDRESS="$(
124
157
openstack floating ip create $EXTNET_ID \
125
158
--description "ingress IP for $AZIMUTH_ENVIRONMENT" \
126
- --tag "$AZIMUTH_ENVIRONMENT" \
127
159
--format value \
128
160
--column floating_ip_address
129
161
)"
130
- VAR_NAME="$([ "$INSTALL_MODE" = "ha" ] && echo "capi_cluster_addons_ingress_load_balancer_ip" || echo "infra_fixed_floatingip")"
131
- echo "$VAR_NAME: $IP_ADDRESS" >> extra-vars.yml
162
+ cat >> ci.env <<EOF
163
+ export INGRESS_IP="$IP_ADDRESS"
164
+ EOF
132
165
env :
133
166
ANSIBLE_LOAD_CALLBACK_PLUGINS : " true"
134
167
ANSIBLE_STDOUT_CALLBACK : json
135
- if : ${{ inputs.allocate-ingress-ip == 'yes' }}
136
-
137
- - name : Output extra-vars.yml for debugging
138
- shell : bash
139
- run : cat extra-vars.yml
0 commit comments