-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: create new on pull request update ci using reusable workflows (#12)
- Loading branch information
Showing
2 changed files
with
105 additions
and
1 deletion.
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,104 @@ | ||
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/hive/**' | ||
chart: | ||
- './.github/workflows/on-pr-update.yaml' | ||
- 'charts/**' | ||
secrets: | ||
slack-token: ${{ secrets.SLACK_TOKEN }} | ||
github-app-private-key: ${{ secrets.APP_PRIVATE_KEY }} | ||
|
||
build-container: | ||
# 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: hive-container | ||
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: | | ||
docker build -t $IMAGE -f containers/hive/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: hive-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/hive/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 | ||
- 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 }} |
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