This reduces the amount of resolving and error checking we have to do.
This exposed a bug in weldr's ComposeEntry type, which will be fixed in
a follow-up commit.
Signed-off-by: Tom Gundersen <teg@jklm.no>
The types exposed by the compose package are only used in the store API,
so move them there where they belong.
Making the ownership of the types clear, rather than having them live in
a package for themselves, will make it clearer how the types can be
modified in follow-up commits.
Also remove the JSON annotations, as these types are no longer used for
serialization.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Distinguish between the types used at runtimes and the types used for
(un)marshaling. Also make the types private to the store package.
This should allow us to reduce the interdependencies between the
packages and more easily change things without accidentally breaking
backwards compatibility.
Signed-off-by: Tom Gundersen <teg@jklm.no>
This way we can make more of the store fields and types private in
follow up commits.
This is not a functional change.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Two image types compare equal if they are named the same, and so are
their respective architectures and distros.
Signed-off-by: Tom Gundersen <teg@jklm.no>
d49f0fef4 added a 5% threshold to codecov.yml, so that small fixes don't
turn the CI red.
However, it contained a typo and put the setting in the wrong place in
the file. codecov.io ignores unknown keys instead of throwing an error.
Fix this and validate with:
cat codecov.yml | curl --data-binary @- https://codecov.io/validate
Travis kills the build if the command doesn't produce any output for
10 minutes. The previous commit dropped most of the test cases and left only
those with potentially long delays. This could make more build fail.
This commit introduces the travis_wait command so Travis waits for 30 minutes
without any output before it kills our job.
ami and vhd tests support uploading to the cloud. However, this not yet
implemented by Schutzbot. This commit drops all the tests from Travis
except for these two.
This results in better output. Output before this swap can be
seen at https://github.com/osbuild/osbuild-composer/issues/611.
It looks like we wanted a compose to FAIL and it FINISHED instead
which is making the error log confusing.
RHEL 8 doesn't have qemu-system-x86_64 in PATH. Instead, it is in
/usr/libexec/qemu-kvm. This commit fixes that by detecting the host
distro and choosing the right binary.
We use 8ch indents right now, which causes everything to be interpreted
as `<pre>` (or whatever your favourite equivalent is). Lets use proper
markdown.
While at it, this fixes a set of minor issues:
* Surround markdown syntax with `` to suppress interpretation (like in
the regexp, etc).
* Replace hyphens before dates with proper em-dash.
* Fix indentation in some news-entries, which did not align correctly.
This will also synchronize the file with osbuild/NEWS.md, which soothes
my heart.
Ensure that logs are artifacted after a test run. Also, ensure that
these logs are in unique directories so that they are not overwritten by
Jenkins as it builds the final artifact archive.
For example, if two jobs have a `test.log`, Jenkis will only keep one of
those logs. Each log must be named differently or placed in a unique
directory.
Signed-off-by: Major Hayden <major@redhat.com>
When Jenkins clones a repository for testing, it does the base clone
first and then merges the code from the PR afterwards. This ensures that
the code merges properly and is tested properly, but it also makes a SHA
that only exists inside Jenkins. 😢
Tell ansible-osbuild to use the repository that Jenkins made so that the
SHA is valid.
Signed-off-by: Major Hayden <major@redhat.com>
t.Parallel() makes defer weird. This commit moves the temporary dir setup
and teardown to the parallel subtest, so the teardown gets called after
the tests are finished.
More detailed explanation:
Consider this code:
```go
t.Run("group", func(t *testing.T) {
setUp()
t.Run("parallel test1", parallelTest1)
t.Run("parallel test2", parallelTest1)
t.Run("sequential test", sequentialTest)
cleanUp()
})
```
When the group subtest is started, firstly parallelTest1 is run. When
t.Parallel() in the parallelTest1 is hit, its execution is suspended and
parallelTest2 is started. Once again, t.Parallel() is hit and the
parallelTest2 is suspended. Now, sequentialTest is started. It doesn't
contain t.Parallel() so it's run without any interruptions. The group subtest
continues its execution and calls the cleanUp method. After the cleanup is
done, the group subtest returns and it's time for the important part:
The parallelTest1 and 2 are resumed and run in parallel. In other words,
the code after t.Parallel is run when the PARENT subtest returns.
The important (and weird) part is that the parent subtest of the parallel
subtests returns before its parallel children finish. However, just the inner
anonymous function returns. The containing t.Run("group", func(){...})
function does not return until all the parallel subtests are finished.
How to solve this? One solution is to move the cleanup out of the group
subtest:
```go
t.Run("group", func(t *testing.T) {
setUp()
t.Run("parallel test1", parallelTest1)
t.Run("parallel test2", parallelTest1)
t.Run("sequential test", sequentialTest)
})
cleanUp()
```
How does this work? The group subtest is not marked as parallel, so it just
runs from its beginning to its end (including the parallel subtests). After
it finishes, then the cleanUp is called.
In this commit I chose a different method: I just moved the clean up into each
parallel subtest. I think this is clearer than all that parallel magic I
tried explaining in previous paragraphs.
See the section "Run a group of tests in parallel":
https://blog.golang.org/subtests
and this paragraph:
https://golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks
Make it easier to see progress in Jenkins for image tests and keep their
logs separated for easier diagnosis of problems.
Signed-off-by: Major Hayden <major@redhat.com>
Empty names are not allowed, and blueprint names should only contain
characters matching: ^[a-zA-Z0-9._-]+$
This also adds tests for the various places where the blueprint name
could potentially be wrong.
This makes the queue more type safe and allows to get rid of the
`pendingChannel` and `pendingChannels` helpers, which only existed to
create not-yet-existing pending channels.
The enum is redundant information that can be deduced from the job's
times: queuedAt, startedAt, and finishedAt. Not having it reduces the
potential for inconsistent state.
After the queue rework, TestCompose() was the only user of
UpdateImageBuildInCompose() and Compose.UpdateState(). Set all required
fields in TestCompose() directly instead of going through those.
Since 2 releases `osbuild` accepts an `--output-directory=DIR` argument
which lets us decide where to place generated artifacts. Switch over to
it, rather than digging into the store, to make sure we will not access
the osbuild store when parallel cleanups are ongoing (which are not yet
a thing, though).