-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
feat(ci): Skip of jobs instead of most steps within job #34004
Conversation
Until now we have used skipping of steps in a job as a way of reducing CI usage when certain jobs should not be triggered depending on the files being touched. Now that #33455 & #33784 have been merged, we now have collector jobs (backend/frontend jobs) that represent all the other jobs in them. This change will make a variable number of jobs be skipped depending on the files being touched.
.github/workflows/acceptance.yml
Outdated
@@ -33,6 +33,7 @@ jobs: | |||
filters: .github/file-filters.yml | |||
|
|||
frontend: | |||
if: ${{ needs.files-changed.outputs.acceptance == 'true' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as FE or BE [1]
Checked that the variable is exported in files-changed [2]
[1]
sentry/.github/file-filters.yml
Lines 59 to 61 in eb1efc4
acceptance: &acceptance | |
- *backend | |
- *frontend |
[2]
sentry/.github/workflows/acceptance.yml
Lines 17 to 23 in eb1efc4
files-changed: | |
name: detect what files changed | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 3 | |
# Map a step output to a job output | |
outputs: | |
acceptance: ${{ steps.changes.outputs.acceptance }} |
@@ -29,6 +29,7 @@ jobs: | |||
filters: .github/file-filters.yml | |||
|
|||
api-docs: | |||
if: needs.files-changed.outputs.api_docs == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked that api_docs
is exported here:
sentry/.github/workflows/backend.yml
Lines 10 to 20 in eb1efc4
files-changed: | |
name: detect what files changed | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 3 | |
# Map a step output to a job output | |
outputs: | |
api_docs: ${{ steps.changes.outputs.api_docs }} | |
backend: ${{ steps.changes.outputs.backend }} | |
backend_any_type: ${{ steps.changes.outputs.backend_any_type }} | |
migration_lockfile: ${{ steps.changes.outputs.migration_lockfile }} | |
plugins: ${{ steps.changes.outputs.plugins }} |
# install ts-node for ts build scripts to execute properly without potentially installing | ||
# conflicting deps when running scripts locally | ||
# see: https://github.com/getsentry/sentry/pull/32328/files | ||
run: | | ||
yarn add ts-node && make test-api-docs | ||
|
||
backend-test: | ||
if: needs.files-changed.outputs.backend == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backend
is exported:
sentry/.github/workflows/backend.yml
Lines 10 to 20 in eb1efc4
files-changed: | |
name: detect what files changed | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 3 | |
# Map a step output to a job output | |
outputs: | |
api_docs: ${{ steps.changes.outputs.api_docs }} | |
backend: ${{ steps.changes.outputs.backend }} | |
backend_any_type: ${{ steps.changes.outputs.backend_any_type }} | |
migration_lockfile: ${{ steps.changes.outputs.migration_lockfile }} | |
plugins: ${{ steps.changes.outputs.plugins }} |
@@ -200,12 +194,13 @@ jobs: | |||
|
|||
# If working tree is dirty, commit and update if we have a token | |||
- name: Apply any pre-commit fixed files | |||
if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master' && needs.files-changed.outputs.backend == 'true' && always() | |||
if: steps.token.outcome == 'success' && github.ref != 'refs/heads/master' && always() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is always()
in that condition? It seems unnecessary without further investigation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-commit
will fail (exit nonzero) and the intent of this is to run anyways and push the files back to the PR
we could scrap all of this and use https://pre-commit.ci
uses: getsentry/action-github-commit@main | ||
with: | ||
github-token: ${{ steps.token.outputs.token }} | ||
|
||
migration: | ||
if: needs.files-changed.outputs.migration_lockfile == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exported:
sentry/.github/workflows/backend.yml
Lines 10 to 20 in eb1efc4
files-changed: | |
name: detect what files changed | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 3 | |
# Map a step output to a job output | |
outputs: | |
api_docs: ${{ steps.changes.outputs.api_docs }} | |
backend: ${{ steps.changes.outputs.backend }} | |
backend_any_type: ${{ steps.changes.outputs.backend_any_type }} | |
migration_lockfile: ${{ steps.changes.outputs.migration_lockfile }} | |
plugins: ${{ steps.changes.outputs.plugins }} |
.github/file-filters.yml
Outdated
@@ -24,7 +24,7 @@ frontend: &frontend | |||
- 'docs-ui/**' | |||
- 'static/**' | |||
- 'tests/js/**' | |||
- '.github/workflows/frontend.yml' | |||
# - '.github/workflows/frontend.yml' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temp change just for testing
with: | ||
list-files: shell | ||
token: ${{ github.token }} | ||
filters: .github/file-filters.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm removing this since it's not being used. Check that we don't use steps.changes
but we use needs.files-changed
.
This reverts commit 8ec947c.
I will not merge this until Monday morning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.github/workflows/acceptance.yml
Outdated
@@ -112,6 +113,7 @@ jobs: | |||
type: frontend | |||
|
|||
webpack: | |||
if: ${{ needs.files-changed.outputs.acceptance == 'true' }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some of these use if ${{ ... }}
and others just use if: ...
-- the brackets aren't needed I think
steps: | ||
- name: Sentaur attack | ||
run: | | ||
echo "This check pretends to be the Visual Snapshot to satisfy Github required checks" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clever, lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…FE changes This is a fallout from #34004. This got noticed in [this run](https://github.com/getsentry/sentry/runs/6379373504?check_suite_focus=true) were an FE check failed yet the collector job got skipped instead.
…FE changes (#34486) This is a fallout from #34004. This got noticed in [this run](https://github.com/getsentry/sentry/runs/6379373504?check_suite_focus=true) were an FE check failed yet the collector job got skipped instead.
Until now we have used skipping of steps in a job as a way of reducing CI usage when certain jobs should not be triggered depending on the files being touched.
Now that #33455 & #33784 have been merged, we now have collector jobs (backend/frontend jobs) that represent all the other jobs in them.
This change will make a variable number of jobs be skipped depending on the files being touched.