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

Use project-relative path when calculating gitlab message fingerprint #11532

Merged

Conversation

furgoose
Copy link
Contributor

Summary

Concurrent GitLab runners clone projects into separate directories, e.g. {builds_dir}/$RUNNER_TOKEN_KEY/$CONCURRENT_ID/$NAMESPACE/$PROJECT_NAME. Since the fingerprint uses the full path to the file, the fingerprints calculated by Ruff are different depending on which concurrent runner it executes on, so often an MR will appear to remove all existing issues and add them with new fingerprints.

I've adjusted the fingerprint function to use the project relative path, which fixes this. Unfortunately this will have a breaking change for any current users of this output - the fingerprints will change and appear in GitLab as all linting messages having been fixed and then created.

Test Plan

cargo nextest run

Running ruff check --output-format gitlab in a git repo, moving the repo and running again, verifying no diffs between the outputs

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

This seems correct to me.

@charliermarsh charliermarsh merged commit 0eef834 into astral-sh:main May 26, 2024
19 checks passed
@charliermarsh charliermarsh added the bug Something isn't working label May 26, 2024
@dhruvmanila
Copy link
Member

I've adjusted the fingerprint function to use the project relative path, which fixes this. Unfortunately this will have a breaking change for any current users of this output - the fingerprints will change and appear in GitLab as all linting messages having been fixed and then created.

Then, we need to make sure to add this to BREAKING_CHANGES.md in the next release similar to https://github.com/astral-sh/ruff/blob/main/BREAKING_CHANGES.md#improved-gitlab-fingerprints-7203

@dhruvmanila dhruvmanila added the breaking Breaking API change label May 27, 2024
@charliermarsh
Copy link
Member

Does that really qualify as a breaking change? I think it’s debatable.

@dhruvmanila
Copy link
Member

I might have jumped the gun but reading through it carefully it does seem like it should be fine (?) although I'm not exactly sure. Regardless, we should highlight this in the changelog.

@furgoose furgoose deleted the gitlab-relative-project-fingerprint branch May 27, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change bug Something isn't working
3 participants