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

Fix #9385: Add a workflow to check if artifacts have changed #9553

Merged
merged 10 commits into from
Feb 13, 2024
Merged

Conversation

aranke
Copy link
Member

@aranke aranke commented Feb 12, 2024

resolves #9385

Problem

It isn't always clear when a file in the core/dbt/artifacts directory has been changed.

Solution

This PR adds a CI check that:

  1. Fails if any file in core/dbt/artifacts has been changed
  2. Can be overridden by adding the artifact_minor_upgrade tag to the PR.

This solution currently uses git diff and doesn't rely on any external actions.

Run history:

  1. Example failure: https://github.com/dbt-labs/dbt-core/actions/runs/7866653246/job/21461212098?pr=9553
  2. Example success (with label): https://github.com/dbt-labs/dbt-core/actions/runs/7866663319/job/21461233620?pr=9553
  3. All runs: https://github.com/dbt-labs/dbt-core/actions/workflows/check-artifact-changes.yml

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@cla-bot cla-bot bot added the cla:yes label Feb 12, 2024
Copy link

codecov bot commented Feb 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a1f6451) 87.96% compared to head (c4660f0) 87.98%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9553      +/-   ##
==========================================
+ Coverage   87.96%   87.98%   +0.01%     
==========================================
  Files         167      167              
  Lines       22168    22168              
==========================================
+ Hits        19501    19505       +4     
+ Misses       2667     2663       -4     
Flag Coverage Δ
integration 85.63% <ø> (+<0.01%) ⬆️
unit 61.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@aranke aranke added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Feb 12, 2024
@aranke aranke removed the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Feb 12, 2024
@aranke aranke added the artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking label Feb 12, 2024
@aranke aranke added artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking and removed artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking labels Feb 12, 2024
@aranke aranke marked this pull request as ready for review February 12, 2024 02:41
@aranke aranke requested a review from a team as a code owner February 12, 2024 02:41
if: env.CHANGED == 'true' && !contains(github.event.pull_request.labels.*.name, 'artifact_minor_upgrade')
run: |
echo "CI failure: Artifact changes checked in core/dbt/artifacts directory."
echo "To bypass this check, add the 'artifact_minor_upgrade' label to the PR."
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you update this message to include a link to the breaking changes section of the dbt/artifacts/README.md?

Perhaps something like: "To bypass this check, confirm that the change is not breaking (link) and add the 'artifact_minor_upgrade' label to the PR."

id: check_changes
run: |
# Check for changes in dbt/artifacts
CHANGED_FILES=$(git diff --name-only origin/${GITHUB_BASE_REF} origin/${GITHUB_HEAD_REF} | grep 'core/dbt/artifacts/')
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we exclude matching core/dbt/artifacts/README.md as part of this search?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@MichelleArk MichelleArk left a comment

Choose a reason for hiding this comment

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

couple small comments re: linking to and ignoring changes to core/dbt/artifacts/README.md, but otherwise looks great! thank you!

@aranke aranke merged commit 03a4d11 into main Feb 13, 2024
50 checks passed
@aranke aranke deleted the fix_9385 branch February 13, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifact_minor_upgrade To bypass the CI check by confirming that the change is not breaking cla:yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-3555] Add detect artifact changes workflow
2 participants