feat: Remove AWS key and use ECR passwords for docker login - #171
Open
dhairya-hackerrank wants to merge 1 commit into
Open
feat: Remove AWS key and use ECR passwords for docker login#171dhairya-hackerrank wants to merge 1 commit into
dhairya-hackerrank wants to merge 1 commit into
Conversation
Signed-off-by: DhairyaMajmudar <dhairya.opensource@gmail.com>
sangamcse
requested review from
sangamcse and
ya-developer
and removed request for
sangamcse
August 28, 2026 10:29
sangamcse
requested changes
Aug 30, 2026
sangamcse
left a comment
Contributor
There was a problem hiding this comment.
@dhairya-hackerrank, can you check these comments? Rest looks good
Comment on lines
+319
to
+322
| { | ||
| docker logout "$registry" &>/dev/null | ||
| sudo -u "$BLACKBOX_USER_NAME" docker logout "$registry" &>/dev/null | ||
| } |
Contributor
There was a problem hiding this comment.
Would we still require this? It might have come due to our startup script trying to login docker, which might have raced with Blackbox trying to logic docker.
Comment on lines
+345
to
+348
| # TODO: the ECR login itself no longer needs the AWS CLI, but this call is what | ||
| # installs the localstack endpoint shim and the placeholder AWS_* environment the | ||
| # "aws", "aws-stdl", "ansible-aws" and "terraform-aws" modules rely on, and none of | ||
| # them provisions "awscli" itself. Remove once they declare the dependency. |
Contributor
There was a problem hiding this comment.
Suggested change
| # TODO: the ECR login itself no longer needs the AWS CLI, but this call is what | |
| # installs the localstack endpoint shim and the placeholder AWS_* environment the | |
| # "aws", "aws-stdl", "ansible-aws" and "terraform-aws" modules rely on, and none of | |
| # them provisions "awscli" itself. Remove once they declare the dependency. |
Comment on lines
+292
to
+299
| # Logs in to a Docker registry with a password from the host credential handoff | ||
| # | ||
| # The token is read before any existing credential is dropped. The machine image | ||
| # bakes a "docker login" at build time whose token is hours or days stale, so it | ||
| # cannot be trusted once the handoff is the credential source, but discarding it | ||
| # before a fresh token is in hand would turn a missing handoff into | ||
| # "Your authorization token has expired" on a later pull, hiding the real cause. | ||
| # On a successful read the baked credential is dropped for both users. |
Comment on lines
+252
to
+257
| # Reads an ECR docker-login password from the host credential handoff | ||
| # | ||
| # ECR credentials are refreshed out of band on the host and published atomically | ||
| # under "$BLACKBOX_ECR_TOKEN_DIR" (write to a temporary file, then rename), so a | ||
| # reader here never observes a partially written password. The publish can lag | ||
| # behind the start of a provision, hence the bounded wait. |
dhairya-hackerrank
force-pushed
the
2404-ecr
branch
from
August 30, 2026 16:01
d3e8dee to
b64386f
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Removes the embedded AWS access key/secret from Blackbox’s ECR login flow.
ECR passwords are now supplied by the host through a read-only token handoff directory, instead of being generated inside Blackbox with static AWS credentials.
Changes
BLACKBOX_ECR_TOKEN_DIR(default:/run/hackerrank/devops-ecr) and a bounded 30-second wait for the required token files.private-password/public-passwordfiles;rootandBLACKBOX_USER_NAME.awscliprovisioning temporarily because AWS-related modules still rely on its LocalStack shim and placeholder environment setup; it is no longer used to obtain ECR credentials.Reviewer notes
The host must publish complete token files atomically in the configured directory. Blackbox reads the token before logging out any baked Docker credential, avoiding a misleading expired-token pull failure when the host handoff is missing.