This repository has been archived by the owner on Nov 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ecr, docker hub support and make extensible
test: add test for all build/push
- Loading branch information
1 parent
10a20b3
commit 063d09e
Showing
3 changed files
with
199 additions
and
42 deletions.
There are no files selected for viewing
This file contains 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,76 @@ | ||
name: Test on PR github-actions-build-push-containers | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test_action: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: set variables | ||
run: | | ||
echo "TEST_IMAGE_NAME=glueops/github-actions-build-push-containers/test-github-actions-build-push-containers" >> $GITHUB_ENV | ||
echo "DOCKERHUB_TEST_IMAGE_NAME=glueopsrocksv2/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 | ||
echo "AWS_REGION=us-west-2" >> $GITHUB_ENV | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
|
||
- name: run ghcr.io | ||
uses: ./ | ||
with: | ||
image_name: ${{ env.TEST_IMAGE_NAME }} | ||
registry: "ghcr.io" | ||
context: "./test-directory/tests/" | ||
target_directory: test-directory | ||
|
||
- name: test ghcr.io | ||
run: | | ||
echo "::group::pull from ghcr.io" | ||
docker pull ghcr.io/$TEST_IMAGE_NAME:${{ github.sha }} | ||
echo "::endgroup::" | ||
docker run -e REGISTRY=ghcr.io ghcr.io/$TEST_IMAGE_NAME:${{ github.sha }} | ||
- name: run ecr | ||
uses: ./ | ||
with: | ||
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws_default_region: ${{ env.AWS_REGION }} | ||
image_name: ${{ env.TEST_IMAGE_NAME }} | ||
registry: ${{ env.ECR_REGISTRY }} | ||
context: "./test-directory/tests/" | ||
target_directory: test-directory | ||
|
||
- name: test ecr | ||
run: | | ||
echo "::group::log in to ecr and pull" | ||
echo $(aws ecr get-login-password --region $AWS_REGION) \ | ||
| docker login --username AWS --password-stdin $ECR_REGISTRY | ||
docker pull $ECR_REGISTRY/$TEST_IMAGE_NAME:${{ github.sha }} | ||
echo "::endgroup::" | ||
docker run -e REGISTRY=dkr.ecr $ECR_REGISTRY/$TEST_IMAGE_NAME:${{ github.sha }} | ||
- name: run docker hub | ||
uses: ./ | ||
with: | ||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
image_name: ${{ env.DOCKERHUB_TEST_IMAGE_NAME }} | ||
registry: "docker.io" | ||
context: "./test-directory/tests/" | ||
target_directory: test-directory | ||
|
||
- name: test docker hub | ||
run: | | ||
echo "::group::log in to docker.io and pull" | ||
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | ||
docker pull $DOCKERHUB_TEST_IMAGE_NAME:${{ github.sha }} | ||
echo "::endgroup::" | ||
docker run -e REGISTRY=docker.io $DOCKERHUB_TEST_IMAGE_NAME:${{ github.sha }} |
This file contains 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 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,3 @@ | ||
FROM debian:bullseye-slim | ||
|
||
CMD echo "\e[42m\e[30m github-actions-build-push-containers works from \e[1m$REGISTRY \e[0m" |