Skip to content

Commit

Permalink
ci: Create new on pull request update ci using reusable workflows (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdash99 authored Aug 21, 2023
1 parent dbf9420 commit fb7c474
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 1 deletion.
202 changes: 202 additions & 0 deletions .github/workflows/on-pr-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
name: PR Update

on:
pull_request:
types:
- opened
- synchronize

jobs:

slack:
# Open a new PR thread on Slack for this CI run.
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
slack-channel: ${{ vars.SLACK_CHANNEL }}
secrets:
slack-token: ${{ secrets.SLACK_TOKEN }}

changes:
# Detect which files have been changed on this PR's full history
needs: slack
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
slack-channel: ${{ vars.SLACK_CHANNEL }}
slack-thread: ${{ needs.slack.outputs.thread }}
github-app-id: ${{ vars.APP_ID }}
filters: |
container:
- './.github/workflows/on-pr-update.yaml'
- 'containers/**'
chart:
- './.github/workflows/on-pr-update.yaml'
- 'charts/**'
secrets:
slack-token: ${{ secrets.SLACK_TOKEN }}
github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}

build-container-jupyterhub:
# Build the container and push it as :pr-42 and :pr-42-fe45b3h
needs:
- slack
- changes
if: fromJSON(needs.changes.outputs.changes).container == 'true'
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
job-name: build-container-jupyterhub
container-registry: ${{ vars.HARBOR_REGISTRY }}
container-registry-user: ${{ vars.HARBOR_USER }}
container-registry-project: ${{ vars.HARBOR_PROJECT }}
container-registry-repo: jupyterhub
github-app-id: ${{ vars.APP_ID }}
slack-channel: ${{ vars.SLACK_CHANNEL }}
slack-thread: ${{ needs.slack.outputs.thread }}
build-command: |
sudo apt update &&
sudo apt install python3.8-venv &&
python -m pip install --user --upgrade build &&
python -m build --outdir ./dist ./containers/custom-packages/jupyter-cloudbeaver-proxy &&
python -m build --outdir ./dist ./containers/custom-packages/jupyter-rsession-proxy &&
docker build -t $IMAGE -f containers/jupyterhub/Dockerfile .
test-command: |
echo '0'
secrets:
container-registry-token: ${{ secrets.HARBOR_TOKEN }}
github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
slack-token: ${{ secrets.SLACK_TOKEN }}

build-container-jupyterlab-standard:
# Build the container and push it as :pr-42 and :pr-42-fe45b3h
needs:
- slack
- changes
if: fromJSON(needs.changes.outputs.changes).container == 'true'
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
job-name: build-container-jupyterlab-standard
container-registry: ${{ vars.HARBOR_REGISTRY }}
container-registry-user: ${{ vars.HARBOR_USER }}
container-registry-project: ${{ vars.HARBOR_PROJECT }}
container-registry-repo: ${{ vars.HARBOR_REPO }}
github-app-id: ${{ vars.APP_ID }}
slack-channel: ${{ vars.SLACK_CHANNEL }}
slack-thread: ${{ needs.slack.outputs.thread }}
build-command: |
sudo apt update &&
sudo apt install python3.8-venv &&
python -m pip install --user --upgrade build &&
python -m build --outdir ./dist ./containers/custom-packages/jupyter-cloudbeaver-proxy &&
python -m build --outdir ./dist ./containers/custom-packages/jupyter-rsession-proxy &&
docker build -t $IMAGE -f containers/jupyterlab/standard.Dockerfile .
test-command: |
echo '0'
secrets:
container-registry-token: ${{ secrets.HARBOR_TOKEN }}
github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
slack-token: ${{ secrets.SLACK_TOKEN }}

# build-container-jupyterlab-gpu:
# # Build the container and push it as :pr-42 and :pr-42-fe45b3h
# needs:
# - slack
# - changes
# if: fromJSON(needs.changes.outputs.changes).container == 'true'
# uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
# with:
# job-name: build-container-jupyterlab-gpu
# container-registry: ${{ vars.HARBOR_REGISTRY }}
# container-registry-user: ${{ vars.HARBOR_USER }}
# container-registry-project: ${{ vars.HARBOR_PROJECT }}
# container-registry-repo: jupyterlab-gpu
# github-app-id: ${{ vars.APP_ID }}
# slack-channel: ${{ vars.SLACK_CHANNEL }}
# slack-thread: ${{ needs.slack.outputs.thread }}
# build-command: |
# sudo apt update &&
# sudo apt install python3.8-venv &&
# python -m pip install --user --upgrade build &&
# python -m build --outdir ./dist ./containers/custom-packages/jupyter-cloudbeaver-proxy &&
# python -m build --outdir ./dist ./containers/custom-packages/jupyter-rsession-proxy &&
# docker build -t $IMAGE -f containers/jupyterlab/gpu.Dockerfile .
# test-command: |
# echo '0'
# secrets:
# container-registry-token: ${{ secrets.HARBOR_TOKEN }}
# github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
# slack-token: ${{ secrets.SLACK_TOKEN }}

# build-container-jupyterlab-sparkR:
# # Build the container and push it as :pr-42 and :pr-42-fe45b3h
# needs:
# - slack
# - changes
# if: fromJSON(needs.changes.outputs.changes).container == 'true'
# uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
# with:
# job-name: build-container-jupyterlab-sparkR
# container-registry: ${{ vars.HARBOR_REGISTRY }}
# container-registry-user: ${{ vars.HARBOR_USER }}
# container-registry-project: ${{ vars.HARBOR_PROJECT }}
# container-registry-repo: jupyterlab-sparkR
# github-app-id: ${{ vars.APP_ID }}
# slack-channel: ${{ vars.SLACK_CHANNEL }}
# slack-thread: ${{ needs.slack.outputs.thread }}
# build-command: |
# sudo apt update &&
# sudo apt install python3.8-venv &&
# python -m pip install --user --upgrade build &&
# python -m build --outdir ./dist ./containers/custom-packages/jupyter-cloudbeaver-proxy &&
# python -m build --outdir ./dist ./containers/custom-packages/jupyter-rsession-proxy &&
# docker build -t $IMAGE -f containers/jupyterlab/sparkR.Dockerfile .
# test-command: |
# echo '0'
# secrets:
# container-registry-token: ${{ secrets.HARBOR_TOKEN }}
# github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
# slack-token: ${{ secrets.SLACK_TOKEN }}


build-pr-chart:
# Build the chart and push it as :pr-42 and :pr-42-fe45b3h
needs:
- slack
- changes
if: fromJSON(needs.changes.outputs.changes).chart == 'true'
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
with:
job-name: chart
chart: charts/**
chart-registry: ${{ vars.HARBOR_REGISTRY }}
chart-registry-user: ${{ vars.HARBOR_USER }}
chart-registry-project: ${{ vars.HARBOR_PROJECT }}
chart-registry-repo: ${{ vars.HARBOR_REPO }}
github-app-id: ${{ vars.APP_ID }}
slack-channel: ${{ vars.SLACK_CHANNEL }}
slack-thread: ${{ needs.slack.outputs.thread }}
test-command: |
helm template $CHART --values charts/jupyter/values.yaml
secrets:
chart-registry-token: ${{ secrets.HARBOR_TOKEN }}
github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }}
slack-token: ${{ secrets.SLACK_TOKEN }}

slack-update:
# Update the original Slack message with the final workflow status
# WARNING! ALL UPSTREAM JOBS MUST BE DECLARED HERE TO REPORT FAILURES CORRECTLY!
needs:
- slack
- changes
- build-container-jupyterhub
- build-container-jupyterlab-standard
# - build-container-jupyterlab-gpu
# - build-container-jupyterlab-sparkR
- build-pr-chart
uses: SwanseaUniversityMedical/workflows/.github/workflows/[email protected]
if: always()
with:
slack-channel: ${{ vars.SLACK_CHANNEL }}
slack-thread: ${{ needs.slack.outputs.thread }}
status: ${{ contains(join(needs.*.result, ','), 'failure') && ':no_entry:' || ':white_check_mark:' }}
secrets:
slack-token: ${{ secrets.SLACK_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- 'containers/**'
- 'charts/**'
branches:
- '**'
- 'main'

env:
HARBOR_REGISTRY: ${{ vars.HARBOR_REGISTRY }}
Expand Down

0 comments on commit fb7c474

Please sign in to comment.