-
Notifications
You must be signed in to change notification settings - Fork 47
[BUG] role check_changelog_fragment does not work as expected #804
Comments
help_needed @pabelanger , could you confirm that at this step the PR branch is already merged into the default branch, so looking for *git diff default-branch` output doesn't make sense here ? |
I am unsure why you are looking for the default branch, the check should be done again the current branch the PR is against. In this case, it is {{ zuul.branch }}. As I said in my original comment (https://github.com/ansible/project-config/pull/772/files/e1ec70a364aca273c088e8d1bb389d43b6a95099#r614268838), I feel this check is overly complicated and grow beyond the original reported issue. I believe the following actually addresses the issue of multiple commits:
Can you please confirm, if so I propose we revert and do this for now. Then, we can work on addressing the other issue you raised about new modules. |
I think all is doable at once, but if you prefer to split it and fix the "look in the whole PR" and the "no fragment for new plugin" step by step, why not. I can't confirm the new git command you propose could solve the first issue. After a merge of PR-BRANCH into main, git show HEAD...origin/PR-BRANCH is logically empty, no ? |
I don't think
and
The command outputs above are before merging new_module/filesize into main. After the merge of new_module/filesize into main, the two branches have the same content (that is the goal of the merge, isn't it ?), so I can't figure a way to get the content of the PR once its branch has been merged.
and:
nothing + nothing What we need is the diff between 2 references that are not the same in terms of content (if I create a new branch from main, I commit something and then revert the commit, What we need is 2 references. Before the merge, they are easy to identify and use. After the merge, we have one: HEAD. Where is the other ? How to retrieve it to produce the name-status's digest we need ? (Is it possible to run this check before zuul mergers ?) |
@pabelanger I got it !
How to test it ? (not the git command, the check within its context) |
I'm not sure to understand. |
Both are basically the same command:
At this point, either is fine. And we can revert a bunch of the code for checking specifically for plugins. As for default branch, we don't want this as PRs can be raised against non default branches. {{ zuul.branch }} is a variable the jobs have access to, that will have the branch the PR is opened against. https://zuul-ci.org/docs/zuul/reference/jobs.html#var-zuul.branch |
no, as shown right above.
already done here: https://github.com/ansible/project-config/blob/7ce1629e73bc511fba45dfb2843ef7d5752c5d91/playbooks/ansible-changelog-fragment/run.yaml |
SUMMARY
The new changelog-fragment check, which is implemented here does not work as expected: it never fails.
This report follows up #771 , #772 and #800 to #803.
See also the bypassed check for this PR.
BEFORE
The previous check was something like
It had an issue (#771) regarding the depth of the search (last commit), resulting in a additional workload for contributors and for the CI platform. For contributors, because once a changelog fragment has been added to a PR, any further change in this PR needs to be interactively rebased to squash last commits and the add of the changelog fragment altogether. For the CI platform, because tests are launched when a contributor applies a reviewer suggestion, and they fail consistently because applying the suggestion creates a new commit that obviouly does not contain the add of the changelog fragment, leading contributor to squash commits again and force-push to pass the tests.
NOW
In the new implementation, the
git show
command has been replaced bygit diff {{ default_branch }}
to search the add of the changelog fragment in the PR, i.e. in the difference between the default branch and the PR branch. If the diff is empty, the check is bypassed, allowing scheduled jobs to play this role without error.Additionally, the check has been refactored to follow documentation and not fail for the add of a new plugin without a new changelog fragment (as long as other files have not been modified/deleted/renamed in the PR).
Unfortunately, this is based on the assumption that the git working tree is currently (checked out) on the PR branch, that is not the case at all ! It seems that when the role is played, the PR branch has already been merged into the default branch (within the testbed), resulting in an empty
git diff
output, and as such bypassing the check.PLAN
git diff also works between commits. How to identify, retrieve and use the related commit to get the expected diff between this commit and HEAD ?
Another suggestion ?
The text was updated successfully, but these errors were encountered: