Skip to content

fix: /ok-to-test /retest pipelineruns should not be created if last sha successful #2048

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

waveywaves
Copy link
Contributor

@waveywaves waveywaves commented Apr 15, 2025

Changes

when executing /ok-to-test or /retest gitops commands, check whether
the last pipelinerun created for the same SHA was successful. If the
run was successful, skip new pipelinerun creation

fixes #1959

Submitter Checklist

  • 📝 Ensure your commit message is clear and informative. Refer to the How to write a git commit message guide. Include the commit message in the PR body rather than linking to an external site (e.g., Jira ticket).

  • ♽ Run make test lint before submitting a PR to avoid unnecessary CI processing. Consider installing pre-commit and running pre-commit install in the repository root for an efficient workflow.

  • ✨ We use linters to maintain clean and consistent code. Run make lint before submitting a PR. Some linters offer a --fix mode, executable with make fix-linters (ensure markdownlint and golangci-lint are installed).

  • 📖 Document any user-facing features or changes in behavior.

  • 🧪 While 100% coverage isn't required, we encourage unit tests for code changes where possible.

  • 🎁 If feasible, add an end-to-end test. See README for details.

  • 🔎 Address any CI test flakiness before merging, or provide a valid reason to bypass it (e.g., token rate limitations).

  • If adding a provider feature, fill in the following details:

    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

    (update the provider documentation accordingly)

@osp-pac osp-pac added the e2e label Apr 15, 2025
@waveywaves waveywaves force-pushed the execute-non-successful branch 9 times, most recently from fa2a595 to 72e4aca Compare April 16, 2025 14:17
@waveywaves
Copy link
Contributor Author

/cancel

@waveywaves waveywaves force-pushed the execute-non-successful branch 2 times, most recently from 579fd77 to 7508871 Compare April 16, 2025 23:58
@waveywaves waveywaves changed the title fix: filter out already successful pipelineruns fix: /ok-to-test /retest pipelineruns are not created if last sha successful Apr 16, 2025
@waveywaves waveywaves marked this pull request as ready for review April 17, 2025 00:02
@Copilot Copilot AI review requested due to automatic review settings April 17, 2025 00:02
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

pkg/pipelineascode/pipelineascode.go:196

  • [nitpick] Consider renaming the variable 'existingPRs' (later in the block) to 'existingRuns' or similar to more clearly indicate that it represents a collection of PipelineRun objects.
labelSelector := fmt.Sprintf("%s=%s", keys.SHA, formatting.CleanValueKubernetes(p.event.SHA))

@waveywaves waveywaves changed the title fix: /ok-to-test /retest pipelineruns are not created if last sha successful fix: /ok-to-test /retest pipelineruns should not be created if last sha successful Apr 17, 2025
@waveywaves
Copy link
Contributor Author

/retest

@waveywaves waveywaves force-pushed the execute-non-successful branch 5 times, most recently from 8f5c0ab to b44e208 Compare April 18, 2025 11:11
@waveywaves
Copy link
Contributor Author

waveywaves commented Apr 18, 2025

cc @chmouel seems like the provider e2e tests are not running :/ wanted to test them, not sure what's up
(none of the e2e tests are, they are being skipped)

@waveywaves
Copy link
Contributor Author

cc @zakisk

@zakisk zakisk added e2e and removed e2e labels Apr 21, 2025
@zakisk
Copy link
Contributor

zakisk commented Apr 21, 2025

cc @chmouel seems like the provider e2e tests are not running :/ wanted to test them, not sure what's up (none of the e2e tests are, they are being skipped)

it may be happening due to changes @chmouel is making.

_, _, err := g.Provider.Client.Issues.CreateComment(ctx, g.Options.Organization, g.Options.Repo, g.PRNumber,
&ghlib.IssueComment{Body: ghlib.Ptr("/retest")})
// Wait for the first pipeline run to be created
time.Sleep(5 * time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

@zakisk i think you created a utility function for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

not me, but there is func for this UntilPipelineRunCreated

@waveywaves waveywaves force-pushed the execute-non-successful branch 2 times, most recently from c112c4a to 2ff4ccc Compare May 5, 2025 13:12
…ha successful

when executing /ok-to-test or /retest gitops commands, check whether
the last pipelinerun created for the same SHA was successful. If the
run was successful, skip new pipelinerun creation
@waveywaves waveywaves force-pushed the execute-non-successful branch from 2ff4ccc to a3e227e Compare May 5, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

/ok-to-test re-runs all the pipelines
4 participants