Skip to content

Skipt test suite for doc-only changes#980

Merged
pedro-psb merged 1 commit intopulp:mainfrom
pedro-psb:feat/add-ci-skip-for-doc-only
Sep 9, 2025
Merged

Skipt test suite for doc-only changes#980
pedro-psb merged 1 commit intopulp:mainfrom
pedro-psb:feat/add-ci-skip-for-doc-only

Conversation

@pedro-psb
Copy link
Copy Markdown
Member

@pedro-psb pedro-psb commented Sep 1, 2025

Skip tests when there are no code changes.

Test PRs:


Important

This requires plugins to disable "required checks" (on the github repository settings) on anything but the ready-to-ship job. Otherwise, the checks will forever wait those required checks (which are checked in ready-to-ship).
Example (Settings > Branches > Branch Protection Rules):

image

@pedro-psb
Copy link
Copy Markdown
Member Author

Results:

With Code Changes

The CI doesn't skip tests, as expected.

Doesnt skip tests

image

No Code Changes

The CI skips the test, but github is waiting for the skipped ones.
Probably its required to actually read the "ready-to-ship"

Skip tests

image

But waiting pending

image

@pedro-psb
Copy link
Copy Markdown
Member Author

Conclusion: that the validation logic should be handled in "ready-to-ship", not in another check

@pedro-psb
Copy link
Copy Markdown
Member Author

pedro-psb commented Sep 4, 2025

Moving the logic to ready-to-ship did not resolve the no-code changes situation.
Maybe we can run the test jobs but bypass the script run?

PR looks like waiting checks, even if its effectively done

image

@pedro-psb
Copy link
Copy Markdown
Member Author

pedro-psb commented Sep 5, 2025

New conclusion

The check hangs when skipped because they are "required checks" by branch protection rules. This rule applies to main and all release branches. There are ways of bypassing this, but if we can bypass them, why have them in the first place? We could use only the "ready-to-ship" check and put the required logic there.

Proposal

As this is an admin per-repository setting, I'm proposing of making this skip-doc-only-changes feature opt-in.
If a repository wants to use it, it should disable protection for those checks [0], toggle the skip_tests_on_doc_only_changes flag in template_config.yml and apply plugin-template again.

[0] Protection rules are located in: {repo} > Settings > Branches > Branch protection rules

Examples ways of bypassing but which are very messy

  • creating a twin ci.yml, one with ignore-path: docs and the other with the opposite. One of them can use the job names required by the checks but do nothing.
  • using conditionals, because skipping is usually considered success for those required checks, but they must be skipped very explicitly (e.g, if test doesnt run because lint didnt run, it'll hang. Also that's tricky with test.yml matrix, because skipping the whole test job is not enough, and github doesn't allow skipping individual matrix runs (which is what would work in this case).

About the test PRs

On the pulp/pulp_rpm#4113 (doc only changes) test PR, I've created a branch that doesn't have those checks to assert that it will correctly skip and not hang waiting for checks.

On the pulp/pulp_rpm#4112 (has code changes) test PR, the tests run as expected.

On the default case where skip_tests_on_doc_only_changes is left as false, the skip is trivially ignored.

@pedro-psb pedro-psb force-pushed the feat/add-ci-skip-for-doc-only branch from 57530ab to 1f4af93 Compare September 5, 2025 19:53
@pedro-psb pedro-psb marked this pull request as ready for review September 5, 2025 19:56
@pedro-psb pedro-psb force-pushed the feat/add-ci-skip-for-doc-only branch from 1f4af93 to 4e74142 Compare September 5, 2025 20:02
@pedro-psb pedro-psb marked this pull request as draft September 8, 2025 13:50
@pedro-psb pedro-psb force-pushed the feat/add-ci-skip-for-doc-only branch from 181a3c3 to 8bd3317 Compare September 8, 2025 17:16
@pedro-psb pedro-psb marked this pull request as ready for review September 8, 2025 17:16
Comment on lines +76 to +79
needs: check-changes
if: needs.check-changes.outputs.run_tests == '1'
{%- if pre_job_template %}
needs: {{ pre_job_template.name }}
needs: [check-changes, {{ pre_job_template.name }}]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
needs: check-changes
if: needs.check-changes.outputs.run_tests == '1'
{%- if pre_job_template %}
needs: {{ pre_job_template.name }}
needs: [check-changes, {{ pre_job_template.name }}]
needs:
- "check-changes"
{%- if pre_job_template %}
- "{{ pre_job_template.name }}"
{%- endif %}
if: needs.check-changes.outputs.run_tests == '1'

The endif below needs to be removed...

This requires plugins to use only the 'ready-to-ship' job as a
required check in their github repository settings. If there are
other checks such as 'test / test (pulp)' the CI will report there
are pending checks and will never be green.
@pedro-psb pedro-psb force-pushed the feat/add-ci-skip-for-doc-only branch from 8bd3317 to a7c8230 Compare September 9, 2025 12:16
@pedro-psb pedro-psb merged commit a41a41c into pulp:main Sep 9, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants