Skip to content

Commit d99c04e

Browse files
feat: Remove AWS key and use ECR passwords for docker login [Ubuntu 22] (#172)
* feat: Remove AWS key and use ECR passwords for docker login (ubuntu 22) Signed-off-by: dhairya-majmudar <dhairya.majmudar@hackerrank.com> * remove aws cli changes Signed-off-by: dhairya-majmudar <dhairya.majmudar@hackerrank.com> --------- Signed-off-by: dhairya-majmudar <dhairya.majmudar@hackerrank.com>
1 parent 576d5ac commit d99c04e

9 files changed

Lines changed: 124 additions & 27 deletions

File tree

Makefile.blackbox

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ BLACKBOX_USER_QUESTION_DIR=$(BLACKBOX_USER_HOME)/$(shell basename $(call blackbo
3333
BLACKBOX_VERSION:=2204
3434

3535
BLACKBOX_AWS_DEFAULT_REGION:="us-east-1"
36-
BLACKBOX_AWS_ACCESS_KEY_ID:=$(shell base64 -d <(base64 -d <<<"UVV0SlFWSTJUemRIU2s1WVZGbEtOVFJNU1U4PQo="))
37-
BLACKBOX_AWS_SECRET_ACCESS_KEY:=$(shell base64 -d <(base64 -d <<<"YVZWNlRtcExlWEpJWVhOeE5UUjVUR05QTlZSbFRraEhlVWxsYzJOMVkxRkJSazVqWTJJeFpRPT0K"))
3836

3937
define blackbox/pwd=
4038
$(abspath $(dir $(firstword $(MAKEFILE_LIST)))/$(1))
@@ -50,7 +48,7 @@ debug: ;@:
5048
all: uninstall install setup solve check
5149

5250
install:
53-
docker login --username AWS --password-stdin 134148934511.dkr.ecr.us-east-1.amazonaws.com < <(docker run -it --env="AWS_DEFAULT_REGION=$(BLACKBOX_AWS_DEFAULT_REGION)" --env="AWS_ACCESS_KEY_ID=$(BLACKBOX_AWS_ACCESS_KEY_ID)" --env="AWS_SECRET_ACCESS_KEY=$(BLACKBOX_AWS_SECRET_ACCESS_KEY)" --rm amazon/aws-cli:2.11.25 ecr get-login-password)
51+
docker login --username AWS --password-stdin 134148934511.dkr.ecr.us-east-1.amazonaws.com < <(aws ecr get-login-password --region "$(BLACKBOX_AWS_DEFAULT_REGION)")
5452
cat <(echo FROM 134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:abstract) <(echo RUN groupadd docker) | docker buildx build --build-arg="BLACKBOX_USER=$(BLACKBOX_USER)" --build-arg="BLACKBOX_USER_NAME=$(BLACKBOX_USER_NAME)" --build-arg="BLACKBOX_USER_HOME=$(BLACKBOX_USER_HOME)" --build-arg="BLACKBOX_VERSION=$(BLACKBOX_VERSION)" --network="host" --progress="plain" --tag="blackbox:$(BLACKBOX_HOST)" -
5553
docker run -di --group-add docker --hostname="blackbox" --name="$(BLACKBOX_HOST)" --privileged --cgroupns=host $(if $(filter debug,$(MAKECMDGOALS)),--volume="$(BLACKBOX_DIR):/blackbox:ro") --volume="$(call blackbox/pwd)/setup.sh:$(BLACKBOX_USER_HOME)/setup.sh:ro" --volume="$(call blackbox/pwd)/check.sh:$(BLACKBOX_USER_HOME)/check.sh:ro" --volume="$(call blackbox/pwd)/solve.sh:$(BLACKBOX_USER_HOME)/solve.sh:ro" blackbox:$(BLACKBOX_HOST) >/dev/null
5654

blackbox

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ blackbox() {
5050
# shellcheck disable=SC2155
5151
export BLACKBOX_VERSION=$(awk -v master="2204" -v user="$BLACKBOX_VERSION" 'END { print ($0 == "systemd") ? master : user }' <(ps -p 1 -o comm=))
5252

53+
export BLACKBOX_ECR_TOKEN_DIR="${BLACKBOX_ECR_TOKEN_DIR:-/run/hackerrank/devops-ecr}"
54+
5355
export BLACKBOX_FLAG__DEBUG_MODE=${BLACKBOX_FLAG__DEBUG_MODE:-no}
5456
# shellcheck disable=SC2155
5557
export BLACKBOX_FLAG__STEP_PROVISION=$(awk -v master="yes" -v user="$BLACKBOX_FLAG__STEP_PROVISION" 'END { print ($0 == "systemd") ? master : user }' <(ps -p 1 -o comm=))

docs/framework/inventory.framework.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Inventory handler
1212
* [blackbox.framework.inventory.install.file](#blackboxframeworkinventoryinstallfile)
1313
* [blackbox.framework.inventory.heap.allocate](#blackboxframeworkinventoryheapallocate)
1414
* [blackbox.framework.inventory.heap.release](#blackboxframeworkinventoryheaprelease)
15+
* [blackbox.framework.inventory.ecr.token.read](#blackboxframeworkinventoryecrtokenread)
16+
* [blackbox.framework.inventory.ecr.token.login](#blackboxframeworkinventoryecrtokenlogin)
1517
* [blackbox.framework.inventory.ecr.login](#blackboxframeworkinventoryecrlogin)
1618
* [blackbox.framework.inventory.ecr.logout](#blackboxframeworkinventoryecrlogout)
1719
* [blackbox.framework.inventory.provision](#blackboxframeworkinventoryprovision)
@@ -100,6 +102,51 @@ _Function has no arguments._
100102

101103
## blackbox.framework.inventory.ecr.*
102104

105+
### blackbox.framework.inventory.ecr.token.read
106+
107+
#### Example
108+
109+
```bash
110+
# Read the private ECR password
111+
blackbox.framework.inventory.ecr.token.read private-password
112+
```
113+
114+
#### Arguments
115+
116+
* **$1** (type=enum<private-password|public-password>): Token file name
117+
118+
#### Exit codes
119+
120+
* **0**: If a non-empty token was read, which is printed to stdout
121+
* **1**: If the token was missing or empty
122+
123+
#### See also
124+
125+
* [blackbox.framework.inventory.ecr.token.login](#blackboxframeworkinventoryecrtokenlogin)
126+
127+
### blackbox.framework.inventory.ecr.token.login
128+
129+
#### Example
130+
131+
```bash
132+
# Log in to the private registry
133+
blackbox.framework.inventory.ecr.token.login 134148934511.dkr.ecr.us-east-1.amazonaws.com private-password
134+
```
135+
136+
#### Arguments
137+
138+
* **$1** (type=string): Registry
139+
* **$2** (type=enum<private-password|public-password>): Token file name
140+
141+
#### Exit codes
142+
143+
* **0**: If both the root and "$BLACKBOX_USER_NAME" logins succeeded
144+
* **1**: If no token could be read, or either login failed
145+
146+
#### See also
147+
148+
* [blackbox.framework.inventory.ecr.token.read](#blackboxframeworkinventoryecrtokenread)
149+
103150
### blackbox.framework.inventory.ecr.login
104151

105152
#### Example
@@ -111,6 +158,11 @@ blackbox.framework.inventory.ecr.login
111158

112159
_Function has no arguments._
113160

161+
#### Exit codes
162+
163+
* **0**: If the private registry login succeeded
164+
* **1**: If the private registry login failed
165+
114166
#### See also
115167

116168
* [blackbox.framework.inventory.ecr.logout](#blackboxframeworkinventoryecrlogout)

framework/inventory.framework

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,62 @@ blackbox.framework.inventory() {
123123
blackbox.framework.inventory.ecr() {
124124
# @section blackbox.framework.inventory.ecr.*
125125

126+
# Reads an ECR docker-login password from the host credential handoff published under "$BLACKBOX_ECR_TOKEN_DIR"
127+
#
128+
# @arg $1 type=enum<private-password|public-password> Token file name
129+
#
130+
# @exitcode 0 If a non-empty token was read, which is printed to stdout
131+
# @exitcode 1 If the token was missing or empty
132+
#
133+
# @example
134+
# # Read the private ECR password
135+
# blackbox.framework.inventory.ecr.token.read private-password
136+
#
137+
# @see blackbox.framework.inventory.ecr.token.login
138+
function blackbox.framework.inventory.ecr.token.read() {
139+
typeset -r name=$1
140+
typeset token
141+
142+
if token=$(cat "${BLACKBOX_ECR_TOKEN_DIR}/${name}" 2>/dev/null) && [ -n "$token" ]; then
143+
printf "%s" "$token"
144+
return 0
145+
fi
146+
147+
printf "error: *** ECR token '%s/%s' is not available\n" "$BLACKBOX_ECR_TOKEN_DIR" "$name" >&2
148+
return 1
149+
}
150+
151+
# Logs in to a Docker registry, for both root and "$BLACKBOX_USER_NAME", with a password from the host credential handoff
152+
#
153+
# @arg $1 type=string Registry
154+
# @arg $2 type=enum<private-password|public-password> Token file name
155+
#
156+
# @exitcode 0 If both the root and "$BLACKBOX_USER_NAME" logins succeeded
157+
# @exitcode 1 If no token could be read, or either login failed
158+
#
159+
# @example
160+
# # Log in to the private registry
161+
# blackbox.framework.inventory.ecr.token.login 134148934511.dkr.ecr.us-east-1.amazonaws.com private-password
162+
#
163+
# @see blackbox.framework.inventory.ecr.token.read
164+
function blackbox.framework.inventory.ecr.token.login() {
165+
typeset -r registry=$1
166+
typeset -r name=$2
167+
typeset token
168+
169+
token=$(blackbox.framework.inventory.ecr.token.read "$name") || return 1
170+
171+
docker login --username AWS --password-stdin "$registry" <<<"$token" \
172+
&& sudo -u "$BLACKBOX_USER_NAME" docker login --username AWS --password-stdin "$registry" <<<"$token"
173+
}
174+
126175
# Logs in to Amazon ECR
127176
#
128177
# @noargs
129178
#
179+
# @exitcode 0 If the private registry login succeeded
180+
# @exitcode 1 If the private registry login failed
181+
#
130182
# @example
131183
# # Logs in to Amazon ECR
132184
# blackbox.framework.inventory.ecr.login
@@ -138,26 +190,15 @@ blackbox.framework.inventory() {
138190
}
139191

140192
blackbox.framework.inventory.provision awscli
141-
(
142-
export AWS_DEFAULT_REGION="us-east-1"
143-
# shellcheck disable=SC2155
144-
export AWS_ACCESS_KEY_ID=$(base64 -d <(base64 -d <<<"UVV0SlFWSTJUemRIU2s1WVZGbEtOVFJNU1U4PQo="))
145-
# shellcheck disable=SC2155
146-
export AWS_SECRET_ACCESS_KEY=$(base64 -d <(base64 -d <<<"YVZWNlRtcExlWEpJWVhOeE5UUjVUR05QTlZSbFRraEhlVWxsYzJOMVkxRkJSazVqWTJJeFpRPT0K"))
147193

148-
# shellcheck disable=SC2155
149-
local ECR_PASSWORD=$(/usr/local/aws-cli/v2/current/bin/aws ecr get-login-password --region "$AWS_DEFAULT_REGION")
150-
151-
docker login --username AWS --password-stdin 134148934511.dkr.ecr.us-east-1.amazonaws.com <<<"$ECR_PASSWORD"
152-
sudo -u "$BLACKBOX_USER_NAME" docker login --username AWS --password-stdin 134148934511.dkr.ecr.us-east-1.amazonaws.com <<<"$ECR_PASSWORD"
194+
(
195+
blackbox.framework.inventory.ecr.token.login 134148934511.dkr.ecr.us-east-1.amazonaws.com private-password || exit 1
153196

154197
{
155198
# TODO: for backwards compatibility with public ECR repositories, and should be removed when all questions are moved to private ECR repositories
156-
# shellcheck disable=SC2155
157-
local ECR_PASSWORD_PUBLIC=$(/usr/local/aws-cli/v2/current/bin/aws ecr-public get-login-password --region "$AWS_DEFAULT_REGION")
158-
159-
docker login --username AWS --password-stdin public.ecr.aws/b0k9n8x8 <<<"$ECR_PASSWORD_PUBLIC"
160-
sudo -u "$BLACKBOX_USER_NAME" docker login --username AWS --password-stdin public.ecr.aws/b0k9n8x8 <<<"$ECR_PASSWORD_PUBLIC"
199+
blackbox.framework.inventory.ecr.token.login public.ecr.aws/b0k9n8x8 public-password || {
200+
printf "warn: *** public ECR login failed, questions hosted on public repositories will not pull\n" >&2
201+
}
161202
}
162203
) 2>&1 # ¯\_(ツ)_/¯
163204
}

framework/inventory/awscli.inventory

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,8 @@ blackbox.framework.inventory.awscli() {
5050
tee -a /etc/environment < <(printf "AWS_DEFAULT_REGION=%s\n" "eu-central-1")
5151
tee -a /etc/environment < <(printf "AWS_ACCESS_KEY_ID=A%sIA%s%s%s\n" "$(head -c 1 <(tr -dc SK </dev/urandom))" "$(head -c 1 <(tr -dc IJ </dev/urandom))" "$(head -c 14 <(tr -dc A-Z2-7 </dev/urandom))" "$(head -c 1 <(tr -dc AQ </dev/urandom))")
5252
tee -a /etc/environment < <(printf "AWS_SECRET_ACCESS_KEY=%s\n" "$(head -c 40 <(tr -dc A-Za-z0-9+/ </dev/urandom))")
53+
54+
# localstack 2.1.0 rejects the CRC32 trailer that AWS CLI 2.23+ sends by default, which silently failed every upload.
55+
tee -a /etc/environment < <(printf "AWS_REQUEST_CHECKSUM_CALCULATION=%s\n" "when_required")
56+
tee -a /etc/environment < <(printf "AWS_RESPONSE_CHECKSUM_VALIDATION=%s\n" "when_required")
5357
}

framework/module/abstract/check/provision.step

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ blackbox.framework.module.abstract.check.provision() {
4343
fi
4444

4545
if ( grep -q '^init$' <(ps -p 1 -o comm=) ); then
46-
docker run -di --hostname="$BLACKBOX_SPAWN" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
46+
docker run -di --hostname="$BLACKBOX_SPAWN" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
4747
else
48-
docker run -di --hostname="$BLACKBOX_SPAWN" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
48+
docker run -di --hostname="$BLACKBOX_SPAWN" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
4949
fi
5050

5151
: <<< blackbox.module.*.check.provision

module/ansible-aws/check/provision.step

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ blackbox.module.ansible-aws.check.provision() {
3131
}
3232

3333
if ( grep -q '^init$' <(ps -p 1 -o comm=) ); then
34-
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
34+
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
3535
else
36-
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
36+
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
3737
fi
3838

3939
if [ -n "$BLACKBOX_PROVISION_WITH_OPTS" ]; then

module/aws/check/provision.step

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ blackbox.module.aws.check.provision() {
2424
fi
2525

2626
if ( grep -q '^init$' <(ps -p 1 -o comm=) ); then
27-
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --volume="/tmp:/tmp:rw" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
27+
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --volume="/tmp:/tmp:rw" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
2828
else
29-
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --volume="/tmp:/tmp:rw" --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
29+
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --volume="/tmp:/tmp:rw" --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
3030
fi
3131

3232
if [ -n "$BLACKBOX_PROVISION_WITH_OPTS" ]; then

module/terraform-aws/check/provision.step

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ blackbox.module.terraform-aws.check.provision() {
3131
}
3232

3333
if ( grep -q '^init$' <(ps -p 1 -o comm=) ); then
34-
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
34+
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
3535
else
36-
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
36+
docker run -di --hostname="$BLACKBOX_SPAWN" --network="host" --name="$BLACKBOX_SPAWN" --privileged --cgroupns=host --volume="${BLACKBOX_DIR}:${BLACKBOX_DIR}:ro" --volume="${BLACKBOX_USER_QUESTION_DIR}:${BLACKBOX_USER_QUESTION_DIR}:rw" --volume="${BLACKBOX_STORAGE_DIR}:${BLACKBOX_STORAGE_DIR}:ro" --env="BLACKBOX_ECR_TOKEN_DIR=${BLACKBOX_ECR_TOKEN_DIR}" --volume="${BLACKBOX_ECR_TOKEN_DIR}:${BLACKBOX_ECR_TOKEN_DIR}:ro" "134148934511.dkr.ecr.us-east-1.amazonaws.com/hr/blackbox_2204:${BLACKBOX_MODULE_NAME}"
3737
fi
3838

3939
if [ -n "$BLACKBOX_PROVISION_WITH_OPTS" ]; then

0 commit comments

Comments
 (0)