-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Merge] [#17] Build, test, and publish images with composite actions
Restructured workflows to use composite actions for testing and publishing images to promote more modular code structure. Also modified image-publishing workflow such that image tests are run before pushing image to Docker Hub
- Loading branch information
Showing
9 changed files
with
308 additions
and
190 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,30 @@ | ||
name: Check Required Images Composite Action | ||
description: Verifies that Docker image(s) are available on the system (as shown by `docker images`) | ||
|
||
inputs: | ||
required_images: | ||
description: Space-separated list of images which need to be available (as shown by `docker images`) | ||
required: false | ||
default: '' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check for Docker Images | ||
shell: bash | ||
run: | | ||
echo "Checking for required Docker images..." | ||
num_missing_imgs=0 | ||
for image in $(echo "${{ inputs.required_images }}"); do | ||
if [[ "$(docker images -q "${image}")" == "" ]]; then | ||
echo "Required image \"${image}\" does not exist" | ||
num_missing_imgs=$((num_missing_imgs+1)) | ||
fi | ||
done | ||
if [ "$num_missing_imgs" -eq "0" ]; then | ||
echo "All required images found" | ||
exit 0 | ||
else | ||
printf "Missing ${num_missing_imgs} required image(s)\n" | ||
exit 1 | ||
fi |
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,50 @@ | ||
name: Docker Build-Push Composite Action | ||
description: Wrapper for Docker Build-Push Action | ||
|
||
inputs: | ||
user: | ||
description: Image default user privilege level (standard or root) | ||
required: true | ||
context: | ||
description: Context when building Docker images | ||
required: true | ||
load: | ||
description: Whether to make image available locally on the runner | ||
required: true | ||
push: | ||
description: Whether to publish image to Docker Hub | ||
required: true | ||
tags: | ||
description: List of tags after building image | ||
required: true | ||
required_images: | ||
description: Space-separated list of images which need to be available (as shown by `docker images`) | ||
required: false | ||
default: '' | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Check for Required Images | ||
uses: './.github/workflows/check-required-images' | ||
with: | ||
required_images: ${{ inputs.required_images }} | ||
|
||
- name: Build and Publish Docker Image | ||
if: ${{ success() }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ${{ inputs.context }} | ||
load: ${{ inputs.load == 'true' }} | ||
push: ${{ inputs.push == 'true' }} | ||
tags: ${{ inputs.tags }} | ||
build-args: | | ||
BASE_DOCKER_REPO=${{ env.DOCKER_HUB_REPO }} | ||
BASE_TAG=${{ env.TAG_BASE_ROOT }} | ||
UBUNTU_VERSION=${{ env.CONTAINER_UBUNTU_VERSION }} | ||
USERNAME=${{ env.CONTAINER_USERNAME }} | ||
PASSWORD=${{ env.CONTAINER_PASSWORD }} | ||
UID=${{ env.CONTAINER_UID }} | ||
GID=${{ env.CONTAINER_GID }} | ||
TIMEZONE=${{ env.CONTAINER_TIMEZONE }} | ||
USER_PRIVILEGE_LEVEL=${{ inputs.user }} |
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
Oops, something went wrong.