Skip to content

Commit 9142ede

Browse files
authored
Use centrally managed AWS Include script (#703)
* Only support staging account in AWS Include The AWS include script is part of our larger tooling, but within this repository it is only used to download images from our "staging" ECRs. This commit removes other environments and removes some dead code. * Use "env" to local the correct bash binary On MacOS 26, running /bin/bash will run version 3.2 of Bash. We need a later version in order to use the centrally-managed aws-include file, so in this commit I've updated the hash-bang line to use "env" - on my machine this loads bash v5. * Use the centrally managed AWS Include file Update the docker-login script to use the aws include from the "Server" repo so that we can manage it centrally and reduce duplication. There is one use-case within CI, and that cannot use the centrally-managed repo, so I've added conditional logic here to detect if we're running in CI.
1 parent 370c458 commit 9142ede

2 files changed

Lines changed: 9 additions & 30 deletions

File tree

bin/aws_include.sh

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
# The POSSIBLE_AWS_SERVERS names must match the [profile <name>] in
22
# ~/.aws/config
3-
POSSIBLE_AWS_SERVERS='staging|azure|prod|dnb|stacc|modulr'
3+
POSSIBLE_AWS_SERVERS='staging'
44
AWS_VAULT_ENV_FILE_BASE=~/.aws/aws_vault_env
55

66
S3_PATH_STAGING="s3://merkely-temp"
7-
S3_PATH_PROD="s3://merkely-prod-temp"
8-
S3_PATH_DNB="s3://merkely-dnb-temp"
9-
S3_PATH_STACC="s3://merkely-stacc-temp"
10-
S3_PATH_MODULR="s3://merkely-modulr-temp"
11-
12-
## Disabled for now since Ewelinca has bash version 3.x.x
13-
## Bash associative array
14-
#declare -A S3_PATHS
15-
#S3_PATHS[staging]="s3://merkely-temp"
16-
##S3_PATHS[azure]=
17-
#S3_PATHS[prod]="s3://merkely-prod-temp"
18-
#S3_PATHS[dnb]="s3://merkely-dnb-temp"
19-
#S3_PATHS[stacc]="s3://merkely-stacc-temp"
20-
#S3_PATHS[modulr]="s3://merkely-modulr-temp"
21-
227

238
# Notes about AWS tools.
249
# For commands that execute 'aws ecs' commands it is necessary
@@ -187,15 +172,3 @@ get_s3_path()
187172
;;
188173
esac
189174
}
190-
191-
## Disabled for now since Ewelinca has bash version 3.x.x
192-
#get_s3_path()
193-
#{
194-
# local awsServerName=$1; shift
195-
# if [ ${S3_PATHS[$awsServerName]+_} ]; then
196-
# echo ${S3_PATHS[$awsServerName]}
197-
# return 0
198-
# else
199-
# return 1
200-
# fi
201-
#}

bin/docker_login_aws.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
#!/bin/bash -Eeu
1+
#!/usr/bin/env bash
2+
set -Eeu
23

34
SCRIPT_NAME=docker_login_aws.sh
45
HELP_STRING="Does a docker login to AWS so we can fetch repositories from it"
56
SCRIPT_DIR=$(dirname $(readlink -f $0))
6-
source ${SCRIPT_DIR}/aws_include.sh
7+
8+
if [ -n "${CI:-}" ]; then
9+
source ${SCRIPT_DIR}/aws_include.sh
10+
else
11+
source ${SCRIPT_DIR}/../../server/bin/aws_include.sh
12+
fi
713

814
get_aws_account_id()
915
{

0 commit comments

Comments
 (0)