-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add ecr registry, generate metadata tags #82
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
5 commits
Select commit
Hold shift + click to select a range
9cdc19a
feat: add ecr registry, generate metadata tags
mamundsen-specter f3a417a
add build-ecr-manual.yaml
mamundsen-specter a16ffab
remove persist/upload digest steps, update target
mamundsen-specter 6a8f17c
fix env tag
mamundsen-specter a73142a
add target input tag prefix
mamundsen-specter 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
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,65 @@ | ||
| name: Build image for ECR | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| tag: | ||
| description: "Tag to use for building container image" | ||
| required: true | ||
| type: string | ||
| target: | ||
| description: "Dockerfile target for building (enterprise, cli, base)" | ||
| required: true | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| push-to-ECR-registry: | ||
| name: Push Image to Docker Registry (${{ inputs.target }}) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
|
mamundsen-specter marked this conversation as resolved.
|
||
|
|
||
| - name: Generate Metadata | ||
| id: metadata | ||
| uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # ratchet:docker/metadata-action@v5 | ||
| with: | ||
| images: | | ||
| ${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }} | ||
| tags: | | ||
| type=raw,prefix=ecr-${{ inputs.target }},value=${{ inputs.tag }},enable=true | ||
| type=sha,format=short,prefix=ecr-${{ inputs.target }},enable=true | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v4 | ||
|
|
||
| - name: Configure AWS credentials | ||
| uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # ratchet:aws-actions/configure-aws-credentials@v6 | ||
| with: | ||
| aws-access-key-id: ${{ secrets.BHE_AWS_ACCESS_KEY_ID }} | ||
| aws-secret-access-key: ${{ secrets.BHE_AWS_SECRET_ACCESS_KEY }} | ||
| aws-region: 'us-east-1' | ||
|
|
||
| - name: Login to Amazon ECR | ||
| id: login-ecr | ||
| uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # ratchet:aws-actions/amazon-ecr-login@v2 | ||
|
|
||
| - name: Build and push multi-arch image | ||
| id: push | ||
| uses: docker/build-push-action@v7 | ||
| with: | ||
| context: . | ||
| file: ./Dockerfile | ||
| target: ${{ inputs.target }} | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: true | ||
| sbom: true | ||
| tags: ${{ steps.metadata.outputs.tags }} | ||
| build-args: | | ||
| OPENHOUND_VERSION=${{ inputs.tag }} | ||
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🤖 get_repo_knowledge executed:
get_repo_knowledge SpecterOps/OpenHound /tmp/coderabbit-repo-knowledge/specterops-openhound-5094e42a/architectureLength of output: 16040
🏁 Script executed:
Repository: SpecterOps/OpenHound
Length of output: 6200
🌐 Web query:
site:docs.aws.amazon.com Amazon ECR authorization token region-specific registry login get-login-password💡 Result:
To authenticate your Docker client to an Amazon ECR registry, you should use the AWS CLI command
aws ecr get-login-password[1][2]. This command retrieves an authentication token, which allows you to log in to an ECR registry [1]. The recommended approach is to pipe the output of this command directly intodocker loginusing the--password-stdinflag [1][2][3]. This ensures that your password is not exposed in your shell history [2]. Use the following syntax: aws ecr get-login-password --region | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr..amazonaws.com [1][2] Key requirements and details: - Region: You must specify the same AWS region where your ECR registry is located using the --region flag [1]. - Username: When logging in, always use AWS as the username [1][2]. - Registry URI: The registry URI follows the format <aws_account_id>.dkr.ecr..amazonaws.com [1][4]. - Token Validity: The authorization token is valid for 12 hours [1][2]. - Legacy Commands: You may encounter references to the olderaws ecr get-logincommand, but this is deprecated in AWS CLI version 2;aws ecr get-login-passwordis the current standard [1][5]. If you need to authenticate to multiple registries, you must repeat this command for each unique registry URI [2][3]. Authorization tokens provided by these commands are scoped to the permissions of the IAM principal used to retrieve them [2][6].Citations:
🏁 Script executed:
Repository: SpecterOps/OpenHound
Length of output: 10446
Match the AWS region to the ECR registry.
If
vars.ECR_REGISTRYis outsideus-east-1, setaws-regionto that registry's AWS region.amazon-ecr-loginauthenticates the registry in the configured region, while the build pushes tovars.ECR_REGISTRY.🤖 Prompt for AI Agents