Skip to content

Commit e978d17

Browse files
committed
credsStore from-env
1 parent eb9507d commit e978d17

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
DOCKER_HUB_URL="https://index.docker.io/v1/"
6+
7+
STDIN=$(cat)
8+
9+
ACTION="$1"
10+
11+
case "$ACTION" in
12+
get)
13+
SERVER_URL="$STDIN"
14+
15+
if [[ "$SERVER_URL" == "$DOCKER_HUB_URL" ]]; then
16+
if [[ -z "${DOCKERHUB_USERNAME:-}" || -z "${DOCKERHUB_PASSWORD:-}" ]]; then
17+
echo "Error: DOCKERHUB_USERNAME or DOCKERHUB_PASSWORD environment variables are not set." >&2
18+
exit 1
19+
fi
20+
21+
echo "{\"Username\": \"$DOCKERHUB_USERNAME\", \"Secret\": \"$DOCKERHUB_PASSWORD\"}"
22+
else
23+
echo "Error: No credentials available for $SERVER_URL" >&2
24+
exit 1
25+
fi
26+
;;
27+
28+
*)
29+
echo "Unsupported action: $ACTION" >&2
30+
exit 1
31+
;;
32+
esac
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"auths": {
3+
"https://index.docker.io/v1/": {}
4+
},
5+
"credsStore": "from-env"
6+
}

.evergreen/print-compass-env.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ function printCompassEnv() {
7474
pathsToPrepend.unshift('/opt/mongodbtoolchain/v4/bin');
7575
}
7676

77+
pathsToPrepend(`${originalPWD}/.evergreen/docker-config/bin`);
78+
7779
PATH = maybePrependPaths(PATH, pathsToPrepend);
7880
printVar('PATH', PATH);
7981

@@ -113,6 +115,8 @@ function printCompassEnv() {
113115

114116
// https://jira.mongodb.org/browse/NODE-6320
115117
printVar('GYP_DEFINES', `kerberos_use_rtld=${process.platform === 'linux'}`);
118+
119+
printVar('DOCKER_CONFIG', `${originalPWD}/.evergreen/docker-config`);
116120
}
117121

118122
printCompassEnv();

0 commit comments

Comments
 (0)