mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 04:17:57 +00:00
Flaming fir deployment scripts (#2599)
* Initial commit of flaming fir deployment scripts * Debug * Fix formatting * Correct wget syntax * Use 8 char commit id * 9 chars * Use the longer CI_BUILD_REF ref to slice from * Fix backtick error with flaming fir deploy script * Use the correct commit id length * Split out validator deploments * Fix syntax, missing : * Pass hostname as TARGET_HOST per validator * Correct syntax * Uncomment wget * Switch deploy -> kubernetes * Use full group name * Check awx log * Fix if syntax and ignore failed * Use correct JOB_ID and fix if syntax * Use correct variable * Print ansible awx log and status * Make awx status clearer * make variable names consistent * Do 15 second checkups on the job * Remove extra echo * Use artifacts/VERSION instead of gitlab variables * Use all of the VERSION info
This commit is contained in:
@@ -10,7 +10,8 @@ stages:
|
||||
- test
|
||||
- build
|
||||
- publish
|
||||
- deploy
|
||||
- kubernetes
|
||||
- flaming-fir
|
||||
|
||||
image: parity/rust-builder:latest
|
||||
|
||||
@@ -264,7 +265,7 @@ publish-s3-doc:
|
||||
--human-readable --summarize
|
||||
|
||||
.deploy-template: &deploy
|
||||
stage: deploy
|
||||
stage: kubernetes
|
||||
when: manual
|
||||
retry: 1
|
||||
image: parity/kubetools:latest
|
||||
@@ -332,7 +333,7 @@ deploy-ue1-tag:
|
||||
name: parity-prod-ue1
|
||||
|
||||
.validator-deploy: &validator-deploy
|
||||
stage: publish
|
||||
stage: flaming-fir
|
||||
dependencies:
|
||||
- build-linux-release
|
||||
image: parity/azure-ansible:v1
|
||||
@@ -344,10 +345,16 @@ deploy-ue1-tag:
|
||||
validator1:
|
||||
<<: *validator-deploy
|
||||
script:
|
||||
- ansible-playbook -i scripts/ansible/inventory.ini -u gitlab scripts/ansible/alexander.yml -l validator1
|
||||
|
||||
- ./scripts/flamingfir-deploy.sh flamingfir-validator1
|
||||
validator2:
|
||||
<<: *validator-deploy
|
||||
script:
|
||||
- ansible-playbook -i scripts/ansible/inventory.ini -u gitlab scripts/ansible/alexander.yml -l validator2
|
||||
|
||||
- ./scripts/flamingfir-deploy.sh flamingfir-validator2
|
||||
validator3:
|
||||
<<: *validator-deploy
|
||||
script:
|
||||
- ./scripts/flamingfir-deploy.sh flamingfir-validator3
|
||||
validator4:
|
||||
<<: *validator-deploy
|
||||
script:
|
||||
- ./scripts/flamingfir-deploy.sh flamingfir-validator4
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
RETRY_COUNT=10
|
||||
RETRY_ATTEMPT=0
|
||||
SLEEP_TIME=15
|
||||
TARGET_HOST="$1"
|
||||
COMMIT=$(cat artifacts/VERSION)
|
||||
DOWNLOAD_URL="https://releases.parity.io/substrate/x86_64-debian:stretch/${COMMIT}/substrate"
|
||||
POST_DATA='{"extra_vars":{"artifact_path":"'${DOWNLOAD_URL}'","target_host":"'${TARGET_HOST}'"}}'
|
||||
|
||||
JOB_ID=$(wget -O - --header "Authorization: Bearer ${AWX_TOKEN}" --header "Content-type: application/json" --post-data "${POST_DATA}" https://ansible-awx.parity.io/api/v2/job_templates/32/launch/ | jq .job)
|
||||
|
||||
echo "Launched job: $JOB_ID"
|
||||
|
||||
|
||||
while [ ${RETRY_ATTEMPT} -le ${RETRY_COUNT} ] ; do
|
||||
export RETRY_RESULT=$(wget -O - --header "Authorization: Bearer ${AWX_TOKEN}" https://ansible-awx.parity.io/api/v2/jobs/${JOB_ID}/ | jq .status)
|
||||
RETRY_ATTEMPT=$(( $RETRY_ATTEMPT +1 ))
|
||||
sleep $SLEEP_TIME
|
||||
if [ $(echo $RETRY_RESULT | egrep -e successful -e failed) ] ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
AWX_OUTPUT=$(wget -O - --header "Authorization: Bearer ${AWX_TOKEN}" https://ansible-awx.parity.io/api/v2/jobs/${JOB_ID}/stdout?format=txt_download)
|
||||
|
||||
echo "AWX job log:"
|
||||
echo "${AWX_OUTPUT}"
|
||||
|
||||
|
||||
JOB_STATUS=$(wget -O - --header "Authorization: Bearer ${AWX_TOKEN}" https://ansible-awx.parity.io/api/v2/jobs/${JOB_ID}/ | jq .status )
|
||||
|
||||
echo "==================================="
|
||||
echo -e "Ansible AWX Remote Job: ${JOB_ID} \x1B[31mStatus: ${JOB_STATUS}\x1B[0m"
|
||||
echo "==================================="
|
||||
Reference in New Issue
Block a user