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

CI: Add testing based on Centos containers (COMPOSER-2125) #1585

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

Conversation

elkoniu
Copy link
Contributor

@elkoniu elkoniu commented Feb 12, 2024

In the release loop upstream changes are merged to Centos every two weeks. This creates a delay in error detection when new tests being added upstream.

Running tests in Centos based containers for every pull request should solve the issue.

https://issues.redhat.com/browse/COMPOSER-2125

@achilleas-k
Copy link
Member

achilleas-k commented Feb 12, 2024

In the gitlab CI, we build CS9 manifests (on CS9 in AWS) already. https://gitlab.com/redhat/services/products/image-builder/ci/osbuild/-/jobs/6155161065
They might not be as comprehensive as the unit tests (we might not be covering all supported stages in those manifests), but the stage unit tests are all actually Fedora manifests. Which is also fine, we're testing if osbuild runs properly on CS9 I suppose, but I think the existing tests are both more realistic (building CS9 on CS9) and less likely to break due to unsupported features (trying to build a Fedora manifest with a btrfs disk on CS9).

I think we would be better served by having a job that updates the content in the manifests more frequently than running the Fedora-based unit tests.

@elkoniu
Copy link
Contributor Author

elkoniu commented Feb 12, 2024

What I am doing here precisely is:

  1. Spawn c8s and c9s centos images prepared by @thozza here:Add osbuild-ci images based on c8s and c9s (COMPOSER-2125) containers#63
  2. In the action I am reusing testing scripts directly from the centos repo: https://gitlab.com/redhat/centos-stream/rpms/osbuild/-/tree/c9s/tests/unit-tests?ref_type=heads
  3. Normally those scripts are used by ZuluCI when upstream release is pushed to centos repo by centos-bot every 2 weeks.
  4. Result is donsteam-like testing of every upstream PR to check if it will not break the centos stream (and rhel stream as result)

From time to time we have a situation when centos testing fails due to upstream changes and we detect this with the 2 weeks delay. I know it will delay PR review as running centos tests takes more than 2h. I think we should mark this as optional from the review point of view or run nightly. Still, we would be able detect "potential" centos / rhel issue way faster than in 2 weeks from PR being merged.

@achilleas-k
Copy link
Member

I know it will delay PR review as running centos tests takes more than 2h. I think we should mark this as optional from the review point of view or run nightly.

Right, that makes sense. Thanks for the explanation!

achilleas-k
achilleas-k previously approved these changes Feb 12, 2024
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

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

I'm fine to merge now but maybe we can think about doing these nightly.

@elkoniu
Copy link
Contributor Author

elkoniu commented Feb 12, 2024

Lets get an opionion from @thozza and @ochosi \o/

ochosi
ochosi previously requested changes Feb 12, 2024
Copy link
Contributor

@ochosi ochosi left a comment

Choose a reason for hiding this comment

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

The code and approach are both fine - thanks @elkoniu for figuring this out! ❤️

At the same time, >2h sounds like a hefty price to pay on every PR.
Plus, I'm not a strong believer in non-blocking CI, although sometimes it makes sense and maybe this is one of those times.

Combining the two points above I wonder if a nightly test wouldn't be a good compromise. We would still get the benefit of early notifications when something sneaks into main that breaks downstream, but it wouldn't slow down development too much.

All it would take is changing the on: condition to a cron schedule and upon failure we can notify ourselves via the #osbuild-release Slack channel.
WDYT?

Happy to wait for @thozza to be back to get to the final decision.

.github/workflows/test-on-centos.yml Outdated Show resolved Hide resolved
.github/workflows/test-on-centos.yml Outdated Show resolved Hide resolved
@elkoniu
Copy link
Contributor Author

elkoniu commented Feb 13, 2024

@achilleas-k and @ochosi - thank you both for the review. I will update the code tomorrow with:

  • running nightly
  • removing duplicated jobs by change to matrix strategy

I think we should wait for @thozza final verdict as I am using some centos downstream scripts bit "nasty" way instead of copying them to repo (as usually our upstream feeds downstream, not the other way around:) )

thozza
thozza previously requested changes Feb 19, 2024
Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this Pawel, much appreciated.

Unfortunately, I do not think that this approach is correct and it would IMO create problems in the future. I added a longer comment inline, but in short, the test should not depend on any downstream code from CentOS Stream. The whole idea is to run the unit tests in a pre-built CS containers (in addition to the Fedora container that is used now).

.github/workflows/test-on-centos.yml Outdated Show resolved Hide resolved
@elkoniu
Copy link
Contributor Author

elkoniu commented Mar 5, 2024

Centos based tests unwraps to different pytest settings.
Centos8 settings:

sudo python3 -m pytest
--rootdir /osb/workdir/osbuild/osbuild-111
--ignore /osb/workdir/osbuild/osbuild-111/test/src
--unsupported-fs btrfs
-k 'not (TestBoot and boot) and not (test_qemu[ext4-vdi] or test_qemu[xfs-vdi]) and not (TestStages and test_qemu)'
-v /osb/workdir/osbuild/osbuild-111/test/

Centos9 settings:

sudo python3 -m pytest
--rootdir /osb/workdir/osbuild/osbuild-111
--ignore /osb/workdir/osbuild/osbuild-111/test/src
--unsupported-fs btrfs
-k 'not (TestBoot and boot)'
-v /osb/workdir/osbuild/osbuild-111/test/

I have encapsulated this final pytest parameters into the new CI jobs and removed dependency from downstream code.

@elkoniu elkoniu changed the title CI: Add testing based on Centos containers [Draft] CI: Add testing based on Centos containers Mar 5, 2024
@elkoniu elkoniu force-pushed the add-centos-to-ci branch 4 times, most recently from bc30e3a to 03ac198 Compare March 5, 2024 13:16
@elkoniu elkoniu changed the title [Draft] CI: Add testing based on Centos containers CI: Add testing based on Centos containers Mar 5, 2024
@elkoniu
Copy link
Contributor Author

elkoniu commented Mar 5, 2024

@thozza @ochosi I think this one is ready to go.

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. I like this version!

I've added a few comments in-line.

Could you please try testing the action as a PR in your own repo against main? Because from what I can tell, the action was not executed as part of this PR, so I can't tell if it works.

.github/workflows/test-on-centos.yml Outdated Show resolved Hide resolved
.github/workflows/test-on-centos.yml Outdated Show resolved Hide resolved
.github/workflows/test-on-centos.yml Show resolved Hide resolved
.github/workflows/test-on-centos.yml Outdated Show resolved Hide resolved
@elkoniu
Copy link
Contributor Author

elkoniu commented Apr 3, 2024

@thozza thanks for the review \o/

Could you please try testing the action as a PR in your own repo against main? Because from what I can tell, the action was not executed as part of this PR, so I can't tell if it works.

As @ochosi suggested I switched from calling this action on every PR to a nightly schema. I will add run result from my fork in comment.

Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the changes. I like how it all turned out and how simple is the action. 🥳

Happy to approve once we resolve the remaining discussions and after you can provide an example run of the action.

@ochosi ochosi changed the title CI: Add testing based on Centos containers CI: Add testing based on Centos containers (COMPOSER-2125) Apr 8, 2024
Copy link
Contributor

@ochosi ochosi left a comment

Choose a reason for hiding this comment

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

This is fine by me!

Not sure about osbuild testing... We touched upon this part of the CI a bit in the osbuild CI hackathon, but I'm not sure if this would be helpful here, too.

@achilleas-k
Copy link
Member

Clicked the rebase button.

@thozza
Copy link
Member

thozza commented Apr 22, 2024

FTR, this PR is good to go from my PoV, I'm waiting only on a proof of a successful run of the pipeline (on a fork).

@thozza thozza dismissed stale reviews from ochosi and themself April 22, 2024 15:31

not relevant any more

Copy link

This PR is stale because it has been open 30 days with no activity. Remove "Stale" label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale label May 23, 2024
@thozza
Copy link
Member

thozza commented May 23, 2024

@elkoniu what is the status of this PR?

In the release loop upstream changes are merged to Centos every two
weeks. This creates a delay in error detection when new tests
being added upstream.

Running tests in Centos based containers on top of the upstream code
more frequently should speed up error detection.
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.

None yet

5 participants