Skip to content

Commit

Permalink
Pipeline updates and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
meadej committed Apr 5, 2023
1 parent 6dfa866 commit 5d3210e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# SkyScan GitHub Workflows

## Overview

SkyScan and associated projects use a number of GitHub action workflows to verify code security, secrets integrity, and provide project building and deployment capability. These workflows and their required secrets and configuration variables are detailed below.

For information on adding configuration variables and secrets, see the GitHub Actions documentation [here](https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-an-environment) and [here](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository).

## Docker Container Building

SkyScan uses the action outlined in `dockerbuild.yml` to automatically build Dockerfiles located in the project and push them to Docker Hub. This action is triggered everytime there is a push to the `main` branch.

### Secrets
* `DOCKER_USERNAME` (required) - The login username for Docker Hub.
* `DOCKER_NAMESPACE` (required) - The Docker Hub account that this image will be pushed to. The `DOCKER_USERNAME` Docker Hub user must have write permissions to `DOCKER_NAMESPACE`. Oftentimes they are the same value.
* `DOCKER_TOKEN` (required) - A Docker Hub personal access token associated with the `DOCKER_USERNAME` account.

### Configuration Variables
* `PROJECT_NAME` (required) - The overarching name of the project.
* `DOCKER_BUILD_PLATFORMS` (optional, defaults to `linux/amd64`) - A comma separated list of the target platforms the images will be built for.
* `DOCKER_BUILD_FOLDERS` (optional, defaults to `.`) - A comma separated list of folders under the main repository containing Dockerfiles to be built.
12 changes: 6 additions & 6 deletions .github/workflows/dockerbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ jobs:
- name: Build Images
env:
# Every folder in the repo that has a Dockerfile within it, comma separated
DOCKERFOLDERS: "tracker,piaware,pan-tilt-pi,notebook-server,egi,axis-ptz"
PROJECT_NAME: "skyscan"
DOCKERFOLDERS: "${{ vars.DOCKER_BUILD_FOLDERS }}"
PROJECT_NAME: "${{ vars.PROJECT_NAME }}"
REPO_NAME: "${{ secrets.DOCKER_NAMESPACE }}"
PLATFORMS: "${{ vars.DOCKER_BUILD_PLATFORMS }}"
run: |
IFS=","
read -ra ARR <<< "$DOCKERFOLDERS"
read -ra ARR <<< "${DOCKERFOLDERS:-.}"
for folder in "${ARR[@]}"
do
IFS="/"
read -ra NAMEFOLDER <<< $folder
SUBNAME=${NAMEFOLDER[0]}
echo "Building $folder"
echo $SUBNAME
echo "Building $folder..."
docker buildx build "$folder" --push \
--tag $REPO_NAME/$PROJECT_NAME-$SUBNAME:latest \
--tag $REPO_NAME/$PROJECT_NAME-$SUBNAME:${{ steps.get_tag.outputs.IMAGE_TAG }} \
--platform linux/arm64,linux/amd64
--platform "${PLATFORMS:-linux/amd64}"
done

0 comments on commit 5d3210e

Please sign in to comment.