-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add action to push test images (#30)
- Loading branch information
1 parent
411360e
commit fe9a543
Showing
3 changed files
with
81 additions
and
47 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,57 @@ | ||
name: push | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
TEST_IMAGE: 'ghcr.io/${{ github.repository_owner }}/trivy-test-images' # used in Makefile | ||
GH_USER: "aqua-bot" | ||
|
||
jobs: | ||
changed_files: | ||
runs-on: ubuntu-latest | ||
name: Push changed images | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Login to ghcr.io registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ env.GH_USER }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
|
||
- name: Get changed files | ||
id: changed-files-yaml | ||
uses: tj-actions/changed-files@v37 | ||
with: | ||
files_yaml: | | ||
busybox: | ||
- 'busybox-with-lockfile/**' | ||
containerd: | ||
- 'containerd/**' | ||
spring4shell: | ||
- 'spring4shell/**' | ||
crane-images: | ||
- push-crane-images.sh | ||
- name: Push `busybox-with-lockfile` image | ||
if: steps.changed-files-yaml.outputs.busybox_any_changed == 'true' | ||
run: make build-busybox | ||
|
||
- name: Push `containerd` image | ||
if: steps.changed-files-yaml.outputs.containerd_any_changed == 'true' | ||
run: make build-containerd | ||
|
||
- name: Push `spring4shell` image | ||
if: steps.changed-files-yaml.outputs.spring4shell_any_changed == 'true' | ||
run: make build-spring4shell | ||
|
||
- name: Copy images | ||
if: steps.changed-files-yaml.outputs.crane-images_any_changed == 'true' | ||
run: make copy-images |
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,24 @@ | ||
ifndef TEST_IMAGE | ||
export TEST_IMAGE=ghcr.io/aquasecurity/trivy-test-images | ||
endif | ||
|
||
build-busybox: | ||
docker build -t $(TEST_IMAGE):busybox-with-lockfile busybox-with-lockfile | ||
docker push $(TEST_IMAGE):busybox-with-lockfile | ||
docker rmi -f $(TEST_IMAGE):busybox-with-lockfile | ||
|
||
build-containerd: | ||
docker build -t $(TEST_IMAGE)/containerd:latest containerd | ||
docker push $(TEST_IMAGE)/containerd:latest | ||
docker rmi -f $(TEST_IMAGE)/containerd:latest | ||
|
||
build-spring4shell: | ||
docker build --target jre11 -t $(TEST_IMAGE):spring4shell-jre11 spring4shell | ||
docker push $(TEST_IMAGE):spring4shell-jre11 | ||
docker rmi -f $(TEST_IMAGE):spring4shell-jre11 | ||
docker build --target jre8 -t $(TEST_IMAGE):spring4shell-jre8 spring4shell | ||
docker push $(TEST_IMAGE):spring4shell-jre8 | ||
docker rmi -f $(TEST_IMAGE):spring4shell-jre8 | ||
|
||
copy-images: | ||
./copy-images.sh |
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