Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
feat(tests): test ecr as well
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoataoldotcom authored Oct 14, 2023
1 parent 77aec18 commit 34553d8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 23 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/test-action-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: set image name
run: echo "TEST_IMAGE_NAME=glueops/github-actions-build-push-containers/test-github-actions-build-push-containers" >> $GITHUB_ENV
- name: set variables
run: |
echo "TEST_IMAGE_NAME=glueops/github-actions-build-push-containers/test-github-actions-build-push-containers" >> $GITHUB_ENV
echo "ECR_REGISTRY=616531474007.dkr.ecr.us-west-2.amazonaws.com" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -29,21 +31,19 @@ jobs:
docker run ghcr.io/$TEST_IMAGE_NAME:${{ github.sha }}
# # Test ECR
# - name: Use my action for ECR
# uses: your-username/your-docker-action@vX.X.X
# with:
# aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# image_name: "test-image"
# registry: "your-account-id.dkr.ecr.your-region.amazonaws.com"
# # and other necessary inputs

# - name: Verify ECR
# run: |
# $(aws ecr get-login --region your-region --no-include-email)
# docker pull your-account-id.dkr.ecr.your-region.amazonaws.com/test-image:latest
# docker run your-account-id.dkr.ecr.your-region.amazonaws.com/test-image:latest
- name: test ecr
uses: ./
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
image_name: ${{ env.TEST_IMAGE_NAME }}
registry: ${{ env.ECR_REGISTRY }}

- name: verify ecr
run: |
$(aws ecr get-login --region us-west-2 --no-include-email)
docker pull $ECR_REGISTRY/$TEST_IMAGE_NAME:${{ github.sha }}
docker run $ECR_REGISTRY/$TEST_IMAGE_NAME:${{ github.sha }}
# # Test Docker.io
# # ... similar structure ...
Expand Down
13 changes: 7 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ inputs:
description: 'AWS Secret Access Key'
required: false

aws_default_region:
description: 'AWS Default Region'
required: false
# aws_default_region:
# description: 'AWS Default Region'
# required: false


# docker hub
Expand Down Expand Up @@ -89,9 +89,10 @@ runs:
if [[ -n "${{ inputs.aws_secret_access_key }}" ]]; then
echo "AWS_SECRET_ACCESS_KEY=${{ inputs.aws_secret_access_key }}" >> $GITHUB_ENV
fi
if [[ -n "${{ inputs.aws_default_region }}" ]]; then
echo "AWS_DEFAULT_REGION=${{ inputs.aws_default_region }}" >> $GITHUB_ENV
fi
# probably don't need this
# if [[ -n "${{ inputs.aws_default_region }}" ]]; then
# echo "AWS_DEFAULT_REGION=${{ inputs.aws_default_region }}" >> $GITHUB_ENV
# fi
echo "::endgroup::"
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#authenticating-to-the-container-registry
Expand Down

0 comments on commit 34553d8

Please sign in to comment.