-
Notifications
You must be signed in to change notification settings - Fork 125
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
prow, rehearse, plugin: use git commit data for target repository of presubmit when creating rehearsal job #3275
Conversation
When we rehearse a PR for a repo different from project-infra, we need to set correct git commit information inside the `refs:` section of the presubmit data, otherwise the rehearse will fail if the rehearsed job relies on that information. Rehearsal is done basically by creating a new prowjob from the definition, where a pull request is the source of the git data that refers to the changes we are trying to test when creating presubmits. Now, since we want to test whether our changed presubmit works, we have to create an artificial pull request data object that has the data pointing to the target repository that the presubmit is for. The previous solution simplified this by just reusing the pull request data of the project-infra pull request, which obviously points to the wrong repository if the presubmit that is changed is targeting i.e. the kubevirt/kubevirt repository. It solved the missing target repository by simply adding an `extra_ref` pointing at the target repository. However, that didn't work in all cases, i.e. if the target repo uses information from the presubmit, like i.e. environment variables injected from prow. One example is automation/test.sh from kubevirt/kubevirt, which relies on PULL_BASE_SHA. The new solution uses an artificial PR instance per branch, which copies the original data to preserve the pointers to the original PR, while changing the ref data to the target repository. The extra_ref can be removed, since it's no more necessary. Signed-off-by: Daniel Hiller <dhiller@redhat.com>
Signed-off-by: Daniel Hiller <dhiller@redhat.com>
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Converted back to draft since I need more time to fix those integration tests. |
@dhiller: The following tests failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What this PR does / why we need it:
TL;DR: when we rehearse a PR for a repo different from project-infra, we need
to set correct git commit information inside the
refs:
section of thepresubmit data, otherwise the rehearse will fail if the rehearsed job
relies on that information.
Rehearsal is done basically by creating a new prowjob from the
definition, where a pull request is the source of the git data that
refers to the changes we are trying to test when creating presubmits.
Now, since we want to test whether our changed presubmit works, we have
to create an artificial pull request data object that has the data
pointing to the target repository that the presubmit is for.
The previous solution simplified this by just reusing the pull request
data of the project-infra pull request, which obviously points to the
wrong repository if the presubmit that is changed is targeting i.e. the
kubevirt/kubevirt repository.
It solved the missing target repository by simply adding an
extra_ref
pointing at the target repository.However, that didn't work in all cases, i.e. if the target repo uses
information from the presubmit, like i.e. environment variables injected
from prow.
One example is automation/test.sh from kubevirt/kubevirt, which relies on
PULL_BASE_SHA.
https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_project-infra/3273/rehearsal-pull-kubevirt-e2e-k8s-1.29-sig-monitoring/1762070277971251200#1:build-log.txt%3A33
The new solution uses an artificial PR instance per branch, which copies
the original data to preserve the pointers to the original PR, while
changing the ref data to the target repository. The extra_ref can be
removed, since it's no more necessary.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #
Special notes for your reviewer:
/cc @brianmcarey @assafad
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Release note: