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

[DC-698] Upgrade from workflow-dispatch to workflow-call #170

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 7 additions & 20 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and Test
on:
push:
branches: [ main ]
paths-ignore: [ '*.md' ]
paths-ignore: [ '*.md', 'settings.gradle' ]
pull_request:
branches: [ '**' ]

Expand Down Expand Up @@ -38,18 +38,11 @@ jobs:

dispatch-trivy:
needs: [ build ]
runs-on: ubuntu-latest

uses: ./.github/workflows/trivy.yml
secrets:
token: ${{ secrets.BROADBOT_TOKEN }}
if: github.event_name == 'pull_request'

steps:
- name: Fire off Trivy action
uses: broadinstitute/workflow-dispatch@v1
with:
workflow: Trivy
token: ${{ secrets.BROADBOT_TOKEN }}
ref: ${{ github.event.pull_request.head.ref }}

source-clear:
needs: [ build ]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -225,13 +218,7 @@ jobs:

dispatch-tag:
needs: [ unit-tests-and-sonar, source-clear, integration-tests, admin-cli-test ]
runs-on: ubuntu-latest

uses: ./.github/workflows/tag.yml
secrets:
token: ${{ secrets.BROADBOT_TOKEN }}
if: success() && github.ref == 'refs/heads/main'

steps:
- name: Fire off tag action
uses: broadinstitute/workflow-dispatch@v1
with:
workflow: Tag
token: ${{ secrets.BROADBOT_TOKEN }}
19 changes: 5 additions & 14 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: Integration Tests

on:
workflow_dispatch:
workflow_call:
inputs:
environment:
type: choice
type: string
description: 'environment to run test in'
required: true
options:
- staging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was used by the GitHub action UI to show the possible values, to see what I mean go to https://github.com/DataBiosphere/terra-data-catalog/actions/workflows/integration-tests.yml and select Run Workflow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choice seemed to not be an option for workflow_call - maybe I was misunderstanding the API docs though and there's another way to specify it?

- alpha
- dev
default: 'dev'
snf2ye marked this conversation as resolved.
Show resolved Hide resolved

env:
Expand All @@ -35,14 +31,9 @@ jobs:

dispatch-trivy:
needs: [ build ]
runs-on: ubuntu-latest

steps:
- name: Fire off Trivy action
uses: broadinstitute/workflow-dispatch@v1
with:
workflow: Trivy
token: ${{ secrets.BROADBOT_TOKEN }}
uses: ./.github/workflows/trivy.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the point of running trivy as its own workflow was so that its failure didn't fail the build, because all trivy failures we've seen so far were issues with the base image and out of our control.

If it's run this way, will it fail the build?

Copy link
Contributor Author

@s-rubenstein s-rubenstein Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is run as a separate workflow still.

secrets:
token: ${{ secrets.BROADBOT_TOKEN }}

test-env:
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Tag
on: workflow_dispatch
on:
workflow_call:
secrets:
token:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is token, shouldn't

          GITHUB_TOKEN: ${{ secrets.BROADBOT_TOKEN }}

be

          GITHUB_TOKEN: ${{ secrets.token }}

required: true

jobs:
tag-job:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Trivy
on: workflow_dispatch
on:
workflow_call:
secrets:
token:
required: true

jobs:
trivy:
Expand Down