Commit graph

138 commits

Author SHA1 Message Date
Paweł Poławski
92e5e43794 CI: Add testing based on Centos containers
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.
2024-06-24 20:25:04 +02:00
Michael Vogt
ed0239c808 workflow: bump osbiuld-ci container to include podman, et al.
This will include the latest osbuild-ci container changes from
https://github.com/osbuild/containers/pull/73

This includes a bunch of binaries that were missing and lead
to skpped tests.
2024-05-02 12:09:44 +02:00
Michael Vogt
15e969c4c6 workflow: show summary why tests are skipped
In PR#1752 Florian noticed that `make_containers` is buggy [0] in
one specific testcase. However the GH actions did not trigger and
uppon inspection the test is skipped:
```
stages/test/test_container_deploy.py::test_container_deploy_integration SKIPPED [  7%]
```
This commit adds `-rs` to get a summary why the tests are skipped.

This is useful in general, I suspect the test container might miss
podman but this commit will bring clarity.

[0] https://github.com/osbuild/osbuild/pull/1752#discussion_r1578294358
2024-04-25 20:44:32 +02:00
Brian C. Lane
970b9409b7 workflow: Use new container ghcr.io/osbuild/osbuild-ci:latest-202404161303 2024-04-23 07:42:09 +02:00
Michael Vogt
d9a228d3e8 workflow: simplify unit test running in the GH workflow
Run only two jobs in the GH runner for the unittest. The `test_stage.py`
because it takes a very long time and needs to run in parallel and
all the other tests.

This split avoid that we forget to add new unittests to the matrix
as we did before (see e.g. https://github.com/osbuild/osbuild/pull/1731)
and it will also enable the tests in:
- sources/test
- inputs/tests
- mounts/test

to run.

This will reduce the "granularity" of the test output a bit, in the
GH runner we only see two unit test matrix jobs now. However that
should not be too bad because the non-stage tests are really quick
to run.
2024-04-16 15:16:49 +02:00
Michael Vogt
5d3dac9fb9 tox,workflow: pass tests to run via tox {posargs} instead of env
Using an environ for passing the tests is a bit of a headache when
it comes to quoting which is important when trying to write something
like: `-k "not test_stages.py"`.

I (personally) also find it slightly nicer/more intuitive to be able to do:
```
$ tox -e py36 -- ./test/mod
```
compared to
```
$ TEST_CATEGORY="./test/mod" tox -e py36
```
2024-04-16 15:16:49 +02:00
Achilleas Koutsou
b432f43022 github: add tools/test to unit test matrix
Run the depsolver tests.
2024-04-16 07:38:18 +02:00
Brian C. Lane
6549bf1992 trigger-gitlab.yml: Bump actions/checkout to v4 2024-04-10 01:32:51 +02:00
Brian C. Lane
ecb91ecb1e test.yml: Bump actions/checkout to v4 2024-04-10 01:32:51 +02:00
Brian C. Lane
21c1573ae8 generate.yml: Bump actions/checkout to v4 2024-04-10 01:32:51 +02:00
Brian C. Lane
3666aa510a coverity.yml: Bump actions/checkout to v4 2024-04-10 01:32:51 +02:00
Brian C. Lane
922e22758d check.yml: Bump actions/checkout to v4 2024-04-10 01:32:51 +02:00
Achilleas Koutsou
7f6dea860a github: add new workflow for checking json files
Reformat all json files in the repository and check that they're
formatted properly.
2024-03-26 01:20:37 +01:00
Michael Vogt
4f8ff6bc99 workflows: improve speed of test_stages and test_assemblers
The other tests have concurrency issues at the moment.

It seems in https://github.com/osbuild/osbuild/pull/1655 we lost
parallel running. The issue seems to be that `env` does not
actually define a shell environment but only a github environment.

This sets commit sets the shell env explicitly to unbreak us
again.
2024-03-23 15:38:34 +01:00
Michael Vogt
ba08a524a4 github: add cache key to generate.yml flow
There are recent GH failures because the github cache action
complains:
```
Input required and not supplied: key
```
This is slightly odd as we did not provide a cache key before and
it was fine but *shrug*. We also don't really need a cache key,
we always get the same cache, osbuild is smart enough to figure
it out.
2024-03-20 14:20:43 +01:00
Michael Vogt
2efe2de09c workflow: run all unit tests in parallel
There were special cases in the workflow for only running specific
tests in parallel. However how that the test_assemblers parallel
runs are fixed [0] there is really no need for special cases anymore
and we can just run them all in parallel.

[0] https://github.com/osbuild/osbuild/pull/1641
2024-03-11 13:48:47 +01:00
Michael Vogt
1278e5d217 test: fix test_assembler to support parallel runs and run in parallel
The `test_assembler.py` hardcods some filesystem and partition
UUIDs. This leads to hard to diagnose test failures when the
test is run in parallel. The btrfs and xfs filesystem drivers
will see the same uuid for multi created images and error sometimes with
someting like:
```
Mar 06 10:22:54 top kernel: BTRFS error: device /dev/loop104 belongs to fsid aff010e9-df95-4f81-be6b-e22317251033, and the fs is already mounted, scanned by mount (123856)
```
Its a race that only happens when two images are checked at the
same time.

This commit fixes the issue by just using a randomized UUID in
the test_assemblers.py. It also re-enables running the test in
parallel (which make it run a lot faster, from 34min to 14min).
2024-03-06 12:28:10 +01:00
Michael Vogt
87636878da Revert "workflow: run assembler tests in parallel"
This reverts commit ea36e25b09.
2024-03-06 10:43:21 +01:00
Simon Steinbeiss
37d5a23a64 tests: Cancel in-progress tests on PR updates
Before this commit GitHub Action runs that were triggered by a PR were
not canceled when updates were made to the same PR. This lead to even
more clogging of our pipelines and not enough runners being available.

This changes the behavior in a way that whenever a PR gets updated all
still-in-progress runs get canceled and new runs get spawned.
2024-03-05 16:40:34 +01:00
Simon Steinbeiss
b8e0253493 actions: Add a PR best practices check
This pipeline tests:
1. If the PR description is not empty (blocking)
2. If the PR title follows our format (non-blocking)
   `component: This is the change (JIRA-001)`
3. If 1. and 2. are True, it adds a 'best practice' label to the PR
2024-03-05 12:01:10 +02:00
Michael Vogt
ea36e25b09 workflow: run assembler tests in parallel
The assembler tests currently run around 45min, try to run in
parallel to see how much we can win from that.
2024-03-05 07:44:26 +01:00
Michael Vogt
4d2476a26d test: use OSBUILD_TEST_STORE in test_assemblers.py too
Use the OSBUILD_TEST_STORE in the test_assemblers.py file too
and re-use already downloaded sources.
2024-03-05 07:44:26 +01:00
Simon Steinbeiss
75bb706cb0 actions/test: Only test assemblers on Python3.6
Assemblers are only part of v1 manifests, so the only Python version we
need to test is 3.6 (RHEL8).
2024-03-04 14:39:50 +01:00
Michael Vogt
ba732b8532 workflow, osbuild-mpp: run with cache and use GH cache
Share cache between runs and also put into GH cache accross runs.
2024-03-04 14:06:33 +01:00
Michael Vogt
1ea7b4943c workflow: drop python3.11 from matrix (HMS-3697)
With fedora moving to python3.12 we can stop testing on py311.

As a drive-by this commit also documents why we need to test on
py36 and py39.
2024-03-04 13:51:41 +01:00
Achilleas Koutsou
b42e1afddc github: change container storage driver inside test container
The default overlayfs doesn't work inside the container runner which
causes the test to fail with
  Invalid destination name
  containers-storage:localhost/osbuild-skopeo-test-...:
  'overlay' is not supported over overlayfs, a mount_program is
  required: backing file system is unsupported for this graph driver

Changing the driver to vfs solves the issue.
2024-02-21 17:55:37 +01:00
Michael Vogt
3ec0925bff test: drop -k from -k stages/test test matrix
With pytest 8.0.0 the `-k` option seem to have changed it's
behavior. Drop `-k` therefore.

Tests started to fail recently and it looks like this is because
pytest 8.0.0 changes the semantic of the `-k` option. We used
to pass `-k stages/test` but that seems to no longer work. So
pin pytest to the last good version until this is better
understood.
2024-01-31 09:24:59 +01:00
Achilleas Koutsou
54dfe70b41 github: run tests on push again
We've temporarily disabled the merge queue because our tests often
require retries to go all-green and this isn't possible to do on the
queue, meaning that it's close to impossible to get a PR merged.
Run tests on push so that they run in main when a PR is merged.

This reverts commit 63feab7d86.
2023-12-22 19:28:12 +01:00
Achilleas Koutsou
63feab7d86 github: run tests on merge queue
Don't run checks on push to main since the tip of the merge queue is the
same.
2023-12-21 18:47:23 +01:00
Michael Vogt
0edbe0cf96 tests: run the test_stages category in parallel
Run the `test_stages` test in parallel in the github runner. This
test currently takes about 1:30h to 2:30h and running it in parallel
will give us big wins in terms of test time. The time is observed
to go down to 0:30h to 1h.

Note that the other tests are not run in parallel. The reason is
that they fail randomly, it looks like insufficient isolation
between them. Some are easy to fix, e.g.:
721521220b
but it's probably not worth it as the other tests run a lot faster.
2023-11-08 08:10:34 +01:00
Michael Vogt
78238ba0a6 github(workflows): add stages/test to the CI run too
Include the new `stages/test` test category to the CI runs as well.

Note that because `stages/__init__.py` and `stages/test/__init__.py`
are missing it is not possible to use the existing style of just
doing `stages.test`. Adding `stages/__init__.py` feels wrong and
the desire is to have the stages tests close to the stages so this
seems the least invasive way.
2023-11-07 15:12:08 +01:00
Tomáš Hozza
4b44fedbb9 Check: lint Packit configuration as part of CI
This will ensure that our Packit config stays valid.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-10-31 09:21:02 +01:00
Tomáš Hozza
66b1da022a Actions: add workflow for marking and closing stale issues and PRs
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-09-06 17:49:43 +02:00
Ondřej Budai
546c8267d1 test/run/stage: cover the btrfs stages
A simple test to make sure that our btrfs stages work.
Updating the testing container is needed, because the old version
didn't have btrfs-progs in it.
2023-08-25 12:35:56 +02:00
Brian C. Lane
68f4c5bd5f tests: Add a check for valid snapshot urls
This pulls the list of snapshots from the rpmrepo API, greps the
codebase for all uses of rpmrepo.osbuild.org that look like a snapshot
name, and then checks to make sure they are still valid.

This is the same script as osbuild-composer, except that it also skips
checking ./test/data/stages/ which has rpm urls that look like snapshot
urls.
2023-08-16 10:40:05 +02:00
Ondřej Budai
330d9d8188 ci: simplify the Python linters
We now have a Makefile target for linting, let's use it in the CI.

Running the linters is pretty fast, so we can just do it in one container.
2023-08-15 03:11:40 +02:00
Simon de Vlieger
10e7046301 ci: drop some Python versions
This limits the list to the Python versions found in current Fedoras,
RHELs, and CentOS Streams.
2023-08-01 15:01:13 +02:00
Simon de Vlieger
d60690ce46 tox: add tox
`tox` is a standard testing tool for Python projects, this allows you to
test locally with all your installed Python version with the following
command:

`tox -m test -p all`

To run the tests in parallel for all supported Python versions.

To run linters or type analysis:

```
tox -m lint -p all
tox -m type -p all
```

This commit *also* disables the `import-error` warning from `pylint`,
not all Python versions have the system-installed Python libraries
available and they can't be fetched from PyPI.

Some linters have been added and the general order linters run in has
been changed. This allows for quicker test failure when running
`tox -m lint`. As a consequence the `test_pylint` test has been removed
as it's role can now be fulfilled by `tox`.

Other assorted linter fixes due to newer versions:
- use a str.join method (`consider-using-join`)
- fix various (newer) mypy and pylint issues
- comments starting with `#` and no space due to `autopep8`

This also changes our CI to use the new `tox` setup and on top of that
pins the versions of linters used. This might move into separate
requirements.txt files later on to allow for easier updating of those
dependencies.
2023-08-01 15:01:13 +02:00
Tomáš Hozza
7cd36f9797 CI: delete duplicate source code check from GitHub action
The test case was testing a subset of the functionality, which is
already tested by test case in `tests.yml`. Delete it, since it does not
add any value.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-04-12 11:57:18 +02:00
Tomáš Hozza
bbdb4fbc32 CI: use latest osbuild-ci container when regenerating test data
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-04-12 11:57:18 +02:00
Tomáš Hozza
c59c5c31de Test: use osbuild-ci container with dosfstools
The `test_mount` test case requires dosfstools to create a FAT
filesystem in a testing image.

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-04-12 11:57:18 +02:00
Tomáš Hozza
1a2776bf1b Test: run all tests from test/run in CI
In CI, we list specific tests from `test/run` to run them in parallel.
This is different than what we do with tests in `test/mod` and
`test/src`.

It seems that as a result, we did not run tests from the following
files in CI:
 - `test_devices.py`
 - `test_mount.py`

Signed-off-by: Tomáš Hozza <thozza@redhat.com>
2023-04-12 11:57:18 +02:00
Simon de Vlieger
76a80bd8c5 ci: remove codecov
`codecov` often reports weird diffs and we rarely take action on a
codecov failure in CI.

This closes #1263.
2023-04-01 15:12:58 +02:00
Christian Kellner
51b973f54d ci: update to containers/privdocker@552e30c
The privdocker action got update to node 16, since node 12 is
deprecated and support for it will be remove by summer 2023[1].

[1] https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
2022-11-03 12:59:52 +01:00
Christian Kellner
58bafaad98 ci: upgrade to actions/checkout@v3
This uses the new node 16 version (see [1]), which is the future proof
version, since node 12 will be deprecated by summer 2023 (see [2]).

[1] upstream commits:
8f9e05e482
a12a3943b4

[2] https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
2022-11-02 00:14:57 +01:00
Jan Macku
5a904f4c39 ci(lint): add shell linter - Differential ShellCheck
It performs differential ShellCheck scans and report results directly in pull request.

documentation: https://github.com/redhat-plumbers-in-action/differential-shellcheck

Co-authored-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-10-26 16:45:09 +02:00
Thomas Lavocat
bc06a037ee manifest-db: propage the osbuild SHA on manifest-db
Add a bot to update the SHA dependency to OSBuild on manifest-db
automatically.

The OSBuild SHA will be changed only if the manifest-db SHA was updated
on the last commit landed on main. This way this ensure that CI ran
successfully for this exact version of OSBuild against manifest-db's
actual state. Therefore it is safe to assume that we can upgrade the
manifest dependency without running the whole CI again.
2022-09-23 14:18:38 +02:00
David Rheinsberg
1bdf038d36 ci: update container and actions
Update the osbuild-ci container and privdocker action to the most recent
builds.

This changes the ostree-image-tests since the Fedora update pulled in
util-linux/fdisk changes that align partition sizes. Hence, the ostree
tests need to be changed to have aligned partition sizes as well. For
more information, see:

    commit 921c7da55ec78350e4067b3fd6b7de6f299106ee
    Author: Karel Zak <kzak@redhat.com>
    Date:   Thu Jan 27 10:50:45 2022 +0100

        libfdisk: (gpt) align size of partition by default

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-09-23 12:08:10 +02:00
Simon de Vlieger
5cb2da55f1 test: run mypy in test-src not in GH actions 2022-09-09 18:51:57 +02:00
Christian Kellner
561122dd30 ci: add autopep8 check to checks.yml
Add to new autopep8 check to the checks suit. Ideally we would
move the `test.src` test over from tests.yml, but running that
in an updated container leads to a whole lot of new warnings,
most of them related to "unspecified encoding" in `open` calls.
2022-08-05 09:41:05 +02:00