-
Notifications
You must be signed in to change notification settings - Fork 165
Implement the bootc provision plugin
#3161
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f217e9a
plugins: Add bootc provision plugin
ckyrouac 6115966
bootc: Add schema for bootc plugin
ckyrouac bbcd264
bootc: Automatically start podman-machine
ckyrouac 9384d13
bootc: Make temp directory in test setup
ckyrouac 4fe280c
bootc: Start libvirtd during prepare step of tests
ckyrouac a4c331c
bootc: Rename variables to use - as separator
ckyrouac 40c2974
Add a short release note, mark avc failure as expected
psss e830fb1
Run the bootc plan under the `provision` packit job
psss 2963385
Simplify and fix tests, several minor adjustments
psss 51ad275
Disable `avc` check, extend the `duration` a bit
psss e111bab
Fix the `avc` check `xfail` to actually work
psss 21ae57d
Add the `--no-add-tmt-dependencies` option as well
psss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| summary: Bootc virtual machine via testcloud | ||
|
|
||
| description: | | ||
| Verify functionality of the bootc provision plugin. | ||
|
|
||
| discover: | ||
| how: fmf | ||
| filter: 'tag:provision-bootc' | ||
|
|
||
| prepare+: | ||
| - name: start-libvirtd | ||
| script: | | ||
| systemctl start libvirtd | ||
| systemctl status libvirtd | ||
|
|
||
| adjust+: | ||
| - enabled: true | ||
| when: how == provision | ||
|
|
||
| - provision: | ||
| hardware: | ||
| virtualization: | ||
| is-supported: true | ||
| memory: ">= 4 GB" | ||
| when: trigger == commit | ||
|
|
||
| - prepare+: | ||
| - name: Disable IPv6 | ||
| how: shell | ||
| script: | ||
| - sysctl -w net.ipv6.conf.all.disable_ipv6=1 | ||
| - sysctl -w net.ipv6.conf.default.disable_ipv6=1 | ||
| because: Disable IPv6 in CI to avoid IPv6 connections that are disabled in CI | ||
| when: trigger == commit | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| FROM quay.io/centos-bootc/centos-bootc:stream9 | ||
|
|
||
| RUN dnf -y install cloud-init rsync && \ | ||
| ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants && \ | ||
| rm /usr/local -rf && ln -sr /var/usrlocal /usr/local && mkdir -p /var/usrlocal/bin && \ | ||
| dnf clean all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| FROM quay.io/centos-bootc/centos-bootc:stream9 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| discover: | ||
| how: fmf | ||
| provision: | ||
| how: bootc | ||
| disk: 20 | ||
| execute: | ||
| how: tmt | ||
|
|
||
|
|
||
| /image: | ||
|
|
||
| /needs-deps: | ||
| summary: "Image that needs dependencies" | ||
| provision+: | ||
| add-tmt-dependencies: true | ||
| container-image: localhost/tmt-bootc-needs-deps | ||
| environment: | ||
| PATTERN: localhost/tmtmodified | ||
|
|
||
| /includes-deps: | ||
| summary: "Image that already includes dependencies" | ||
| provision+: | ||
| add-tmt-dependencies: false | ||
| container-image: localhost/tmt-bootc-includes-deps | ||
| environment: | ||
| PATTERN: localhost/tmt-bootc-includes-deps | ||
|
|
||
| /containerfile: | ||
|
|
||
| /needs-deps: | ||
| summary: "Containerfile that needs dependencies" | ||
| provision+: | ||
| add-tmt-dependencies: true | ||
| container-file: needs-deps.containerfile | ||
| environment: | ||
| PATTERN: localhost/tmtmodified | ||
|
|
||
| /includes-deps: | ||
| summary: "Containerfile that already includes dependencies" | ||
| provision: | ||
| how: bootc | ||
| add-tmt-dependencies: false | ||
| container-file: includes-deps.containerfile | ||
| environment: | ||
| PATTERN: localhost/tmtbase |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| summary: Check that booted image matches expected pattern | ||
| test: "bootc status && bootc status | grep $PATTERN" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| summary: Make sure that bootc provision method works | ||
| tag+: | ||
| - provision-only | ||
| - provision-bootc | ||
| require: | ||
| - tmt+provision-virtual | ||
| duration: 40m | ||
|
|
||
| # As for now there is an expected AVC failure: | ||
| # https://github.com/osbuild/bootc-image-builder/issues/645 | ||
| check: | ||
| - how: avc | ||
| result: xfail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| #!/bin/bash | ||
| . /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
|
||
| IMAGE_NEEDS_DEPS="localhost/tmt-bootc-needs-deps" | ||
| IMAGE_INCLUDES_DEPS="localhost/tmt-bootc-includes-deps" | ||
|
|
||
| TESTCLOUD_IMAGE="/var/tmp/tmt/testcloud/images/disk.qcow2" | ||
|
|
||
|
|
||
| rlJournalStart | ||
| rlPhaseStartSetup | ||
| # Use /var/tmp/tmt so the temp directories are accessible | ||
| # in the podman machine mount | ||
| rlRun "mkdir -p /var/tmp/tmt" | ||
| rlRun "run=\$(mktemp -d --tmpdir=/var/tmp/tmt)" 0 "Create run directory" | ||
| rlRun "pushd data" | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartTest "Image that needs dependencies" | ||
| rlRun "podman build . -f needs-deps.containerfile -t $IMAGE_NEEDS_DEPS" | ||
| rlRun "tmt -vvv run --scratch -i $run plan --name /plans/image/needs-deps" | ||
| rlRun "rm -rf $TESTCLOUD_IMAGE" | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartTest "Image that already includes dependencies" | ||
| rlRun "podman build . -f includes-deps.containerfile -t $IMAGE_INCLUDES_DEPS" | ||
| rlRun "tmt -vvv run --scratch -i $run plan --name /plans/image/includes-deps" | ||
| rlRun "rm -rf $TESTCLOUD_IMAGE" | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartTest "Containerfile that needs dependencies" | ||
| rlRun "tmt -vvv run --scratch -i $run plan --name /plans/containerfile/needs-deps" | ||
| rlRun "rm -rf $TESTCLOUD_IMAGE" | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartTest "Containerfile that already includes dependencies" | ||
| rlRun "tmt -vvv run --scratch -i $run plan --name /plans/containerfile/includes-deps" | ||
| rlRun "rm -rf $TESTCLOUD_IMAGE" | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartCleanup | ||
| rlRun "popd" | ||
| rlRun "rm -r $run" 0 "Remove run directory" | ||
| rlRun "podman rmi $IMAGE_INCLUDES_DEPS" 0,1 | ||
| rlRun "podman rmi $IMAGE_NEEDS_DEPS" 0,1 | ||
| rlPhaseEnd | ||
| rlJournalEnd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
|
|
||
| # | ||
| # JSON Schema definition for `bootc` provision plugin | ||
| # | ||
| # https://tmt.readthedocs.io/en/stable/spec/plans.html#bootc | ||
| # | ||
|
|
||
| $id: /schemas/provision/bootc | ||
| $schema: https://json-schema.org/draft-07/schema | ||
|
|
||
| type: object | ||
| additionalProperties: false | ||
|
|
||
| properties: | ||
|
|
||
| how: | ||
| type: string | ||
| enum: | ||
| - bootc | ||
|
|
||
| name: | ||
| type: string | ||
|
|
||
| image: | ||
| type: string | ||
|
|
||
| user: | ||
| type: string | ||
|
|
||
| become: | ||
| type: boolean | ||
|
|
||
| key: | ||
| $ref: "/schemas/common#/definitions/one_or_more_strings" | ||
|
|
||
| memory: | ||
| type: integer | ||
|
|
||
| disk: | ||
| type: integer | ||
|
|
||
| connection: | ||
| type: string | ||
| enum: | ||
| - session | ||
| - system | ||
|
|
||
| arch: | ||
| $ref: "/schemas/common#/definitions/arch" | ||
|
|
||
| role: | ||
| $ref: "/schemas/common#/definitions/role" | ||
|
|
||
| container-file: | ||
| type: string | ||
|
|
||
| container-file-workdir: | ||
| type: string | ||
|
|
||
| container-image: | ||
| type: string | ||
|
|
||
| add-tmt-dependencies: | ||
| type: boolean | ||
|
|
||
| image-builder: | ||
| type: string | ||
|
|
||
| required: | ||
| - how |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.