Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline updates (allows configuration variables in place of static values) and documentation #53

Merged
merged 5 commits into from
May 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Pipeline updates and documentation
  • Loading branch information
meadej committed Apr 5, 2023
commit 5d3210efb2888297825550c7646591fb200654d1
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