-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathimage_vars.src
executable file
·92 lines (71 loc) · 3.55 KB
/
image_vars.src
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
#!/bin/bash
# This file is autogenerated -- update and re-run ./scripts/image-names.sh instead.
# Usage: source scripts/image_vars.src
# These variables are used in GitHub Actions and deploy scripts.
# Array of VRO images
# shellcheck disable=SC2034
VRO_IMAGES_ARR=( postgres redis rabbitmq api-gateway app db-init dev-tools svc-bgs-api svc-lighthouse-api svc-bie-kafka svc-bip-api xample-workflows cc-app ee-max-cfi-app ee-ep-merge-app )
# Usage: for IMG in ${VRO_IMAGES_ARR[@]}; do echo "- $IMG"; done
export VRO_IMAGES="postgres redis rabbitmq api-gateway app db-init dev-tools svc-bgs-api svc-lighthouse-api svc-bie-kafka svc-bip-api xample-workflows cc-app ee-max-cfi-app ee-ep-merge-app"
# Array of variable prefixes
# shellcheck disable=SC2034
VAR_PREFIXES_ARR=( postgres redis rabbitmq apigateway app dbinit devtools svcbgsapi svclighthouseapi svcbiekafka svcbipapi xampleworkflows ccapp eemaxcfiapp eeepmergeapp )
export VAR_PREFIXES="postgres redis rabbitmq apigateway app dbinit devtools svcbgsapi svclighthouseapi svcbiekafka svcbipapi xampleworkflows ccapp eemaxcfiapp eeepmergeapp"
## Helper functions
# Usage example to get the variable value for app_GRADLE_IMG: GRADLE_IMG_TAG=`getVarValue app _GRADLE_IMG`
getVarValue(){
local VARNAME=${1}${2}
echo "${!VARNAME}"
}
# Bash variables cannot have dashes, so strip them out of the directory names
bashVarPrefix() {
echo "${1//-/}"
}
# Return non-zero error code if image tag does not exist
# Usage: imageTagExists IMAGE_NAME IMAGE_TAG
# Environment variable GHCR_TOKEN should be in base64
imageTagExists(){
[ "$GHCR_TOKEN" ] || { echo "GHCR_TOKEN not set!" >&2; return 2; }
# https://superuser.com/a/442395
curl -s -o /dev/null -w "%{http_code}" -I -H "Authorization: Bearer ${GHCR_TOKEN}" \
"https://ghcr.io/v2/department-of-veterans-affairs/abd-vro-internal/$1/manifests/$2"
}
# Note: Bash arrays cannot be exported; use this workaround to
# set the array variable from the string first if needed:
# IFS=' ' read -ra VAR_PREFIXES_ARR <<< $VAR_PREFIXES
# Then use it like normal:
# for PREFIX in ${VAR_PREFIXES_ARR[@]}; do
# echo "The value of ${PREFIX}_GRADLE_IMG is $(getVarValue ${PREFIX} _GRADLE_IMG)"
# echo
# done
######################################
export postgres_GRADLE_IMG="va/abd_vro-postgres"
export postgres_IMG="vro-postgres"
export redis_GRADLE_IMG="va/abd_vro-redis"
export redis_IMG="vro-redis"
export rabbitmq_GRADLE_IMG="va/abd_vro-rabbitmq"
export rabbitmq_IMG="vro-rabbitmq"
export apigateway_GRADLE_IMG="va/abd_vro-api-gateway"
export apigateway_IMG="vro-api-gateway"
export app_GRADLE_IMG="va/abd_vro-app"
export app_IMG="vro-app"
export dbinit_GRADLE_IMG="va/abd_vro-db-init"
export dbinit_IMG="vro-db-init"
export devtools_GRADLE_IMG="va/abd_vro-dev-tools"
export devtools_IMG="vro-dev-tools"
export svcbgsapi_GRADLE_IMG="va/abd_vro-svc-bgs-api"
export svcbgsapi_IMG="vro-svc-bgs-api"
export svclighthouseapi_GRADLE_IMG="va/abd_vro-svc-lighthouse-api"
export svclighthouseapi_IMG="vro-svc-lighthouse-api"
export svcbiekafka_GRADLE_IMG="va/abd_vro-svc-bie-kafka"
export svcbiekafka_IMG="vro-svc-bie-kafka"
export svcbipapi_GRADLE_IMG="va/abd_vro-svc-bip-api"
export svcbipapi_IMG="vro-svc-bip-api"
export xampleworkflows_GRADLE_IMG="va/abd_vro-xample-workflows"
export xampleworkflows_IMG="vro-xample-workflows"
export ccapp_GRADLE_IMG="va/abd_vro-cc-app"
export ccapp_IMG="vro-cc-app"
export eemaxcfiapp_GRADLE_IMG="va/abd_vro-ee-max-cfi-app"
export eemaxcfiapp_IMG="vro-ee-max-cfi-app"
export eeepmergeapp_GRADLE_IMG="va/abd_vro-ee-ep-merge-app"
export eeepmergeapp_IMG="vro-ee-ep-merge-app"