You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
make aws_login checks for valid credentials (#284)
# Summary
This PR adds docker credentials verification in `make aws_login` to
reliably refresh docker credentials only if needed.
Previous method of skipping was checking if the ~/.docker/config.json
was modified in the last six hours, but it wasn't reliable enough. If
you performed docker login to any other registry or just modified the
file, you won't get ECR credentials refreshed.
## Proof of Work
breaking docker credentials (simulating expired):
```bash
$ cat > ~/.docker/config.json <<EOF
{
"auths": {
"268558157000.dkr.ecr.eu-west-1.amazonaws.com": {
"auth": "INVALID"
},
"268558157000.dkr.ecr.us-east-1.amazonaws.com": {
"auth": "INVALID"
}
},
"currentContext": "desktop-linux"
}
EOF
$ docker pull 268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes/latest
WARNING: Error parsing config file (/Users/lukasz.sierant/.docker/config.json): illegal base64 data at input byte 4
Using default tag: latest
Error response from daemon: failed to resolve reference "268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes/latest:latest": pull access denied, repository does not exist or may require authorization: authorization failed: no basic auth credentials
```
**from master** - auth is skipped due to file modification time check
only
```bash
$ make aws_login
Skipping docker daemon check when not running in Linux
Docker credentials are up to date - not performing the new login!
```
**from this PR:**
```bash
$ make aws_login
Skipping docker daemon check when not running in Linux
Checking if Docker credentials are valid...
Docker login required (HTTP status: 401)
=> Performing docker login to ECR registries
aws-cli/2.27.46 Python/3.13.5 Darwin/24.5.0 source/arm64}
[...]
Login Succeeded
[...]
$ docker pull 268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes:latest
docker pull 268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/mongodb-kubernetes:latest
latest: Pulling from dev/mongodb-kubernetes
671b7b89b752: Pulling fs layer
[....]
```
running again skips properly:
```bash
$ make aws_login
Skipping docker daemon check when not running in Linux
Checking if Docker credentials are valid...
Docker credentials are up to date - not performing the new login!
```
## Checklist
- [ ] Have you linked a jira ticket and/or is the ticket in the title?
- [ ] Have you checked whether your jira ticket required DOCSP changes?
- [ ] Have you checked for release_note changes?
0 commit comments