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

prow, rehearse, plugin: use git commit data for target repository of presubmit when creating rehearsal job #3275

Closed
wants to merge 2 commits into from

Conversation

dhiller
Copy link
Contributor

@dhiller dhiller commented Feb 27, 2024

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 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.

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:


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>
@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Feb 27, 2024
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from dhiller. For more information see the Kubernetes Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dhiller dhiller changed the title Fix rehearse use artificial pr prow, rehearse, plugin: use git commit data for target repository of presubmit when creating rehearal job Feb 27, 2024
@dhiller dhiller changed the title prow, rehearse, plugin: use git commit data for target repository of presubmit when creating rehearal job prow, rehearse, plugin: use git commit data for target repository of presubmit when creating rehearsal job Feb 27, 2024
@dhiller dhiller marked this pull request as draft February 27, 2024 16:53
@kubevirt-bot kubevirt-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 27, 2024
@dhiller
Copy link
Contributor Author

dhiller commented Feb 27, 2024

Converted back to draft since I need more time to fix those integration tests.

@kubevirt-bot
Copy link
Contributor

@dhiller: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-project-infra-test-external-plugins 71a320b link true /test pull-project-infra-test-external-plugins
pull-prow-nmstate-labels-update-precheck 71a320b link true /test pull-prow-nmstate-labels-update-precheck
pull-prow-kubevirt-labels-update-precheck 71a320b link true /test pull-prow-kubevirt-labels-update-precheck

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.

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 23, 2024
@kubevirt-bot
Copy link
Contributor

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.

@dhiller dhiller closed this May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants