-
Notifications
You must be signed in to change notification settings - Fork 245
chore(evergreen): authenticate with docker so that we don't make unauthenticated pulls #6498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a106e63
docker login
lerouxb 57e1290
rather log in when starting the envs
lerouxb 26f05e3
also login before starting atlas cloud cluster
lerouxb 7913bbc
also login for start-atlas-local
lerouxb 9053899
conditionally log into docker
lerouxb 9dd7547
invert the docker env var checks
lerouxb eb9507d
also log out of docker
lerouxb e978d17
credsStore from-env
lerouxb 757e25a
no need to login
lerouxb 74c3b23
unshift..
lerouxb 12d8509
print docker config
lerouxb fd2ae6a
Merge branch 'main' into docker-login
lerouxb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "auths": { | ||
| "https://index.docker.io/v1/": {} | ||
| }, | ||
| "credsStore": "from-env" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly a secret but we already have this code running everywhere and we need to build an abs path somehow 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not be everywhere, but just where we use docker without arifactory, which we use for signatures
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's gonna be tricky. I'll try and refactor it - let's see if it works first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to have logged in to artifactory using the existing username/password vars we have for that and worked just fine.
We currently have most of our env vars together and this way it makes use of our existing code to that makes sure we don't accidentally leak secrets in logs. This way it should also be impossible to forget to log in and get all of evergreen rate limited if we ever start using docker in more places.
So I think we should just keep an eye on it for now and we can make more PRs to isolate that var if we have to. Worst case we just temporarily revert this PR.