test/data/stages: Document the changes to the tests
This commit is contained in:
parent
fbe6e3ed97
commit
09fa9e9def
1 changed files with 72 additions and 76 deletions
|
|
@ -10,20 +10,20 @@ new test-bed for your new stage do the following:
|
||||||
|
|
||||||
2. Populate the test folder.
|
2. Populate the test folder.
|
||||||
|
|
||||||
The test folder is expected to have a `a.mpp.json`, `b.mpp.json`, `a.json`,
|
The test folder is expected to have a `a.mpp.yaml`, `b.mpp.yaml`, `a.json`,
|
||||||
`b.json` and `diff.json`.
|
`b.json` and `diff.json`.
|
||||||
|
|
||||||
`(a|b).mpp.json` and `dif.json`files are the ones that you will need to
|
`(a|b).mpp.yaml` and `dif.json`files are the ones that you will need to
|
||||||
provide, `(a|b).json` will be generated based on the their
|
provide, `(a|b).json` will be generated based on the their
|
||||||
ManifestPreProcessor json file counterpart (`.mpp.json`).
|
ManifestPreProcessor json file counterpart (`.mpp.yaml`).
|
||||||
|
|
||||||
The `a.mpp.json` file must provide the instructions for a minimal artifact
|
The `a.mpp.yaml` file must provide the instructions for a minimal artifact
|
||||||
build using the minimum amount of pipelines and stages; you must not add
|
build using the minimum amount of pipelines and stages; you must not add
|
||||||
your new stage to this build. The artifact described in `b.mpp.json` will
|
your new stage to this build. The artifact described in `b.mpp.yaml` will
|
||||||
have the same build as the one described in `a.mpp.json` but you must add
|
have the same build as the one described in `a.mpp.yaml` but you must add
|
||||||
your new stage to the build.
|
your new stage to the build.
|
||||||
|
|
||||||
Once `(a|b).mpp.json` are made, run:
|
Once `(a|b).mpp.yaml` are made, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make test/data/stages/my-new-stage/a.json
|
make test/data/stages/my-new-stage/a.json
|
||||||
|
|
@ -37,87 +37,74 @@ new test-bed for your new stage do the following:
|
||||||
test to pass, every change in artifact b's state must have been accounted
|
test to pass, every change in artifact b's state must have been accounted
|
||||||
for in the `diff.json` file.
|
for in the `diff.json` file.
|
||||||
|
|
||||||
3. Add the five required test files to your commit (`a.mmp.json`, `b.mpp.json`,
|
3. Add the five required test files to your commit (`a.mmp.yaml`, `b.mpp.yaml`,
|
||||||
`a.json`, `b.json` and `diff.json`) and the GitHub CI will do the rest.
|
`a.json`, `b.json` and `diff.json`) and the GitHub CI will do the rest.
|
||||||
|
|
||||||
## Crafting `(a|b).mpp.json` test files
|
## Crafting `(a|b).mpp.yaml` test files
|
||||||
|
|
||||||
`(a|b).mpp.json` files can be based on OSBuild manifest v1 and v2. v2 is
|
`(a|b).mpp.yaml` files can be based on OSBuild manifest v1 and v2. v2 is
|
||||||
preferred and is the version used in this guide. You can read about [Manifest
|
preferred and is the version used in this guide. You can read about [Manifest
|
||||||
Version
|
Version
|
||||||
2](https://www.osbuild.org/guides/developer-guide/osbuild.html?highlight=manifest#version-2)
|
2](https://www.osbuild.org/guides/developer-guide/osbuild.html?highlight=manifest#version-2)
|
||||||
in the OSBuild Guide.
|
in the OSBuild Guide.
|
||||||
|
|
||||||
|
|
||||||
Example of minimal `a.mpp.json`:
|
Example of minimal `a.mpp.yaml`:
|
||||||
```
|
```yaml
|
||||||
{
|
version: '2'
|
||||||
"version": "2",
|
pipelines:
|
||||||
# Specify the pipelines needed by your artifact, at a minimum it should
|
- mpp-import-pipelines:
|
||||||
# specify a base image. Other pipelines should install any needed
|
path: ../manifests/fedora-vars.ipp.yaml
|
||||||
# dependencies, create files, change permissions etc.
|
|
||||||
"pipelines": [
|
# If the build pipeline doesn't specify all packages needed for your
|
||||||
{
|
# test, feel free to add them. The goal is to have one build pipeline
|
||||||
"mpp-import-pipeline": {
|
# for everything to utilize caching as much as possible.
|
||||||
# check the ../manifests folder for more options
|
- mpp-import-pipeline:
|
||||||
"path": "../manifests/f34-build-v2.json",
|
path: ../manifests/fedora-build-v2.ipp.yaml
|
||||||
"id": "build"
|
id: build
|
||||||
},
|
runner:
|
||||||
# check osbuild/runners for more options
|
mpp-format-string: org.osbuild.fedora{release}
|
||||||
"runner": "org.osbuild.fedora34"
|
- name: tree
|
||||||
},
|
build: name:build
|
||||||
{
|
stages:
|
||||||
"name": "tree",
|
- type: org.osbuild.rpm
|
||||||
"build": "name:build",
|
inputs:
|
||||||
"stages": [
|
packages:
|
||||||
{
|
type: org.osbuild.files
|
||||||
# on manifest v1 this field was known as "name", watch out
|
origin: org.osbuild.source
|
||||||
"type": "org.osbuild.rpm",
|
mpp-depsolve:
|
||||||
"inputs": {
|
architecture: $arch
|
||||||
"packages": {
|
module-platform-id: $module_platform_id
|
||||||
"type": "org.osbuild.files",
|
repos:
|
||||||
"origin": "org.osbuild.source",
|
mpp-eval: repos
|
||||||
# Modify these according to your needs
|
packages:
|
||||||
"mpp-depsolve": {
|
# Specify the packages needed by your new stage
|
||||||
"architecture": "x86_64",
|
- some-package
|
||||||
"module-platform-id": "f34",
|
- another-package
|
||||||
"baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f34/f34-x86_64-fedora-20210512/",
|
options:
|
||||||
"repos": [
|
gpgkeys:
|
||||||
{
|
mpp-eval: gpgkeys
|
||||||
"id": "default",
|
exclude:
|
||||||
"baseurl": "https://rpmrepo.osbuild.org/v2/mirror/public/f34/f34-x86_64-fedora-20210512/"
|
docs: true
|
||||||
}
|
|
||||||
],
|
|
||||||
"packages": [
|
|
||||||
# Specify the packages needed by your new stage
|
|
||||||
"some-package",
|
|
||||||
"another-package"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
A `b.mpp.json` should have the same manifest as `a.mpp.json` but you should
|
A `b.mpp.yaml` should have the same manifest as `a.mpp.yaml` but you should
|
||||||
also add your new stage:
|
also add your new stage:
|
||||||
```json
|
```yaml
|
||||||
...[omitted]...
|
|
||||||
{
|
version: '2'
|
||||||
"type": "org.osbuild.your-new-stage",
|
pipelines:
|
||||||
# the following is stage-specific:
|
# [pipeline imports omitted]
|
||||||
"options": {
|
- name: tree
|
||||||
# add the required options for your stage
|
build: name:build
|
||||||
}
|
stages:
|
||||||
},
|
- type: org.osbuild.rpm
|
||||||
"inputs": {
|
# [options of the rpm stage omitted]
|
||||||
# add the required inputs for your stage
|
- type: org.osbuild.your-new-stage
|
||||||
}
|
options:
|
||||||
}
|
# add the required options for your stage
|
||||||
|
inputs:
|
||||||
|
# add the required inputs for your stage
|
||||||
```
|
```
|
||||||
|
|
||||||
## Crafting `diff.json` files
|
## Crafting `diff.json` files
|
||||||
|
|
@ -126,6 +113,15 @@ The `diff.json` file specifies the changes that are expected to be seen in the
|
||||||
new artifact once the results of artifact `b` are compared against the
|
new artifact once the results of artifact `b` are compared against the
|
||||||
baseline, artifact `a`.
|
baseline, artifact `a`.
|
||||||
|
|
||||||
|
You can easily generate them using the `tools/gen-stage-test-diff` tool:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo tools/gen-stage-test-diff \
|
||||||
|
--store ~/osbuild-store \
|
||||||
|
--libdir . \
|
||||||
|
test/data/stages/your-new-stage >test/data/stages/your-new-stage/diff.json
|
||||||
|
```
|
||||||
|
|
||||||
Sample `diff.json` file:
|
Sample `diff.json` file:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue