Skip to content

Commit c852139

Browse files
committed
login to docker
1 parent dce0b68 commit c852139

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed

.evergreen.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6907,6 +6907,8 @@ functions:
69076907
shell: bash
69086908
env:
69096909
NODE_JS_VERSION: ${node_js_version}
6910+
DOCKERHUB_USERNAME: ${dockerhub_username}
6911+
DOCKERHUB_PASSWORD: ${dockerhub_password}
69106912
script: |
69116913
set -e
69126914
{
@@ -6930,6 +6932,8 @@ functions:
69306932
NODE_JS_VERSION: ${node_js_version}
69316933
TEST_MONGOSH_EXECUTABLE: ${test_mongosh_executable|}
69326934
KERBEROS_JUMPHOST_DOCKERFILE: ${kerberos_jumphost_dockerfile|}
6935+
DOCKERHUB_USERNAME: ${dockerhub_username}
6936+
DOCKERHUB_PASSWORD: ${dockerhub_password}
69336937
script: |
69346938
set -e
69356939
{
@@ -7329,6 +7333,8 @@ functions:
73297333
shell: bash
73307334
env:
73317335
NODE_JS_VERSION: ${node_js_version}
7336+
DOCKERHUB_USERNAME: ${dockerhub_username}
7337+
DOCKERHUB_PASSWORD: ${dockerhub_password}
73327338
script: |
73337339
set -e
73347340
set -x
@@ -7343,6 +7349,8 @@ functions:
73437349
shell: bash
73447350
env:
73457351
NODE_JS_VERSION: ${node_js_version}
7352+
DOCKERHUB_USERNAME: ${dockerhub_username}
7353+
DOCKERHUB_PASSWORD: ${dockerhub_password}
73467354
script: |
73477355
set -e
73487356
set -x
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/evergreen.yml.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ functions:
383383
shell: bash
384384
env:
385385
NODE_JS_VERSION: ${node_js_version}
386+
DOCKERHUB_USERNAME: ${dockerhub_username}
387+
DOCKERHUB_PASSWORD: ${dockerhub_password}
386388
script: |
387389
set -e
388390
{
@@ -406,6 +408,8 @@ functions:
406408
NODE_JS_VERSION: ${node_js_version}
407409
TEST_MONGOSH_EXECUTABLE: ${test_mongosh_executable|}
408410
KERBEROS_JUMPHOST_DOCKERFILE: ${kerberos_jumphost_dockerfile|}
411+
DOCKERHUB_USERNAME: ${dockerhub_username}
412+
DOCKERHUB_PASSWORD: ${dockerhub_password}
409413
script: |
410414
set -e
411415
{
@@ -741,6 +745,8 @@ functions:
741745
shell: bash
742746
env:
743747
NODE_JS_VERSION: ${node_js_version}
748+
DOCKERHUB_USERNAME: ${dockerhub_username}
749+
DOCKERHUB_PASSWORD: ${dockerhub_password}
744750
script: |
745751
set -e
746752
set -x
@@ -755,6 +761,8 @@ functions:
755761
shell: bash
756762
env:
757763
NODE_JS_VERSION: ${node_js_version}
764+
DOCKERHUB_USERNAME: ${dockerhub_username}
765+
DOCKERHUB_PASSWORD: ${dockerhub_password}
758766
script: |
759767
set -e
760768
set -x

.evergreen/setup-env.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ if [ "$OS" == "Windows_NT" ]; then
7575
export npm_config_logs_dir="$(cygpath -w "$npm_config_logs_dir")"
7676
fi
7777

78+
export DOCKER_FILE="$BASEDIR/docker-config/config.json"
79+
export PATH="BASEDIR/docker-config/bin:$PATH"
80+
7881
echo "Running on:"
7982
uname -a
8083

0 commit comments

Comments
 (0)