Skip to content

Commit

Permalink
login to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
lerouxb committed Nov 22, 2024
1 parent dce0b68 commit c852139
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .evergreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6907,6 +6907,8 @@ functions:
shell: bash
env:
NODE_JS_VERSION: ${node_js_version}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
{
Expand All @@ -6930,6 +6932,8 @@ functions:
NODE_JS_VERSION: ${node_js_version}
TEST_MONGOSH_EXECUTABLE: ${test_mongosh_executable|}
KERBEROS_JUMPHOST_DOCKERFILE: ${kerberos_jumphost_dockerfile|}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
{
Expand Down Expand Up @@ -7329,6 +7333,8 @@ functions:
shell: bash
env:
NODE_JS_VERSION: ${node_js_version}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
set -x
Expand All @@ -7343,6 +7349,8 @@ functions:
shell: bash
env:
NODE_JS_VERSION: ${node_js_version}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
set -x
Expand Down
32 changes: 32 additions & 0 deletions .evergreen/docker-config/bin/docker-credential-from-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -euo pipefail

DOCKER_HUB_URL="https://index.docker.io/v1/"

STDIN=$(cat)

ACTION="$1"

case "$ACTION" in
get)
SERVER_URL="$STDIN"

if [[ "$SERVER_URL" == "$DOCKER_HUB_URL" ]]; then
if [[ -z "${DOCKERHUB_USERNAME:-}" || -z "${DOCKERHUB_PASSWORD:-}" ]]; then
echo "Error: DOCKERHUB_USERNAME or DOCKERHUB_PASSWORD environment variables are not set." >&2
exit 1
fi

echo "{\"Username\": \"$DOCKERHUB_USERNAME\", \"Secret\": \"$DOCKERHUB_PASSWORD\"}"
else
echo "Error: No credentials available for $SERVER_URL" >&2
exit 1
fi
;;

*)
echo "Unsupported action: $ACTION" >&2
exit 1
;;
esac
6 changes: 6 additions & 0 deletions .evergreen/docker-config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"auths": {
"https://index.docker.io/v1/": {}
},
"credsStore": "from-env"
}
8 changes: 8 additions & 0 deletions .evergreen/evergreen.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ functions:
shell: bash
env:
NODE_JS_VERSION: ${node_js_version}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
{
Expand All @@ -406,6 +408,8 @@ functions:
NODE_JS_VERSION: ${node_js_version}
TEST_MONGOSH_EXECUTABLE: ${test_mongosh_executable|}
KERBEROS_JUMPHOST_DOCKERFILE: ${kerberos_jumphost_dockerfile|}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
{
Expand Down Expand Up @@ -741,6 +745,8 @@ functions:
shell: bash
env:
NODE_JS_VERSION: ${node_js_version}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
set -x
Expand All @@ -755,6 +761,8 @@ functions:
shell: bash
env:
NODE_JS_VERSION: ${node_js_version}
DOCKERHUB_USERNAME: ${dockerhub_username}
DOCKERHUB_PASSWORD: ${dockerhub_password}
script: |
set -e
set -x
Expand Down
3 changes: 3 additions & 0 deletions .evergreen/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ if [ "$OS" == "Windows_NT" ]; then
export npm_config_logs_dir="$(cygpath -w "$npm_config_logs_dir")"
fi

export DOCKER_FILE="$BASEDIR/docker-config/config.json"
export PATH="BASEDIR/docker-config/bin:$PATH"

echo "Running on:"
uname -a

Expand Down

0 comments on commit c852139

Please sign in to comment.