Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
11 changes: 10 additions & 1 deletion .tekton/coreos-assembler-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
pipelineRef:
params:
- name: bundle
value: quay.io/konflux-ci/tekton-catalog/pipeline-docker-build-multi-platform-oci-ta@sha256:39a1abd4657035029db5e1e215333aba0cf094c3984df58e12cb157f4cb62207
value: quay.io/konflux-ci/tekton-catalog/pipeline-docker-build-multi-platform-oci-ta@sha256:3b40c829ea489ac866149094157e3b8532896b9f150a4f15b5aaba9d0e2e6be2
- name: name
value: docker-build-multi-platform-oci-ta
- name: kind
Expand All @@ -60,4 +60,13 @@ spec:
- name: git-auth
secret:
secretName: '{{ git_auth_secret }}'
taskRunSpecs:
- pipelineTaskName: build-images
stepSpecs:
- name: prepare-sboms
computeResources:
requests:
memory: 2Gi
limits:
memory: 2Gi
status: {}
61 changes: 61 additions & 0 deletions tmt/plans/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
adjust+:
- when: arch == x86_64 or arch == aarch64
provision:
hardware:
cpu:
processors: ">= 4"
memory: ">= 8 GB"
disk:
- size: ">= 50 GB"
virtualization:
is-supported: true
# prepare:
# - how: install
# package:
# - libvirt
# - qemu-kvm
# - qemu-img
# - virt-install
# - jq
# - git-core
# - skopeo
# - podman
Comment on lines +12 to +22
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This block of commented-out code should be removed to keep the configuration clean, unless it is intended to be kept for documentation purposes.


prepare:
- how: install
package:
- podman
Comment on lines +24 to +27
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The script tmt/tests/utils.sh uses the uuidgen command (line 21), but it is not included in the prepare step's package list. This will cause run_kola to fail if uuidgen is not pre-installed in the environment.

prepare:
  - how: install
    package:
      - podman
      - util-linux

execute:
how: tmt
exit-first: true

# /kola-qemu:
# summary: run kola qemu tests
# discover+:
# how: fmf
# test:
# - init
# - build-fcos
# - build-qemu
# - test-qemu
#

/kola-self-tests:
summary: run self-tests
discover+:
how: fmf
test:
- init
# - build-fcos
# - build-qemu
- test-kola-self

# /kola-test-upgrade:
# summary: run kola upgrade test
# discover+:
# how: fmf
# test:
# - init
# - build-fcos
# - build-qemu
# - test-kola-upgrade
11 changes: 11 additions & 0 deletions tmt/tests/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -eo pipefail
set -x

source "utils.sh"

if [ "$TEST_CASE" = "build-fcos" ]; then
cosa build
elif [ "$TEST_CASE" = "build-qemu" ]; then
cosa osbuild qemu
fi
19 changes: 19 additions & 0 deletions tmt/tests/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail

export TEST_CASE="$TEST_CASE"
case "$TEST_CASE" in
"init")
./init.sh
;;
"build-fcos"|"build-qemu")
./build.sh
;;
"test-qemu"|"test-kola-upgrade"|"test-kola-self")
./test.sh
;;
*)
echo "Error: Test case '$TEST_CASE' not found!" >&2
exit 1
;;
esac
18 changes: 18 additions & 0 deletions tmt/tests/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -eEuo pipefail
set -x

source "utils.sh"

CONFIG_GIT_URL="https://github.com/coreos/fedora-coreos-config"
CONFIG_GIT_REF="testing-devel"
Comment on lines +7 to +8
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

These configuration values are hardcoded. It would be more flexible to allow them to be overridden via environment variables, which can be set in the tmt plan.

Suggested change
CONFIG_GIT_URL="https://github.com/coreos/fedora-coreos-config"
CONFIG_GIT_REF="testing-devel"
CONFIG_GIT_URL="${CONFIG_GIT_URL:-https://github.com/coreos/fedora-coreos-config}"
CONFIG_GIT_REF="${CONFIG_GIT_REF:-testing-devel}"


echo "cosa container: $COREOS_ASSEMBLER_CONTAINER"
echo "arch: $(arch)"

echo "git version: $(git --version)"
echo "git url: ${CONFIG_GIT_URL}"
echo "git branch: ${CONFIG_GIT_REF}"

mkdir -p "$COSA_DIR"
cosa init --force "${CONFIG_GIT_URL}" --branch "${CONFIG_GIT_REF}"
37 changes: 37 additions & 0 deletions tmt/tests/kola.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
test: ./entrypoint.sh

/init:
duration: 1h
order: 50
environment:
TEST_CASE: init

/build-fcos:
duration: 1h
order: 60
environment:
TEST_CASE: build-fcos

/build-qemu:
duration: 1h
order: 70
environment:
TEST_CASE: build-qemu

/test-qemu:
duration: 2h
order: 80
environment:
TEST_CASE: test-qemu

/test-kola-upgrade:
duration: 1h
order: 90
environment:
TEST_CASE: test-kola-upgrade

/test-kola-self:
duration: 1h
order: 100
environment:
TEST_CASE: test-kola-self
54 changes: 54 additions & 0 deletions tmt/tests/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash
set -eEuo pipefail
set -x

source "utils.sh"
trap collect_kola_artifacts ERR

if [ "$TEST_CASE" = "test-qemu" ]; then
export KOLA_ACTION="run"
export KOLA_ID="kola"
export KOLA_EXTRA_ARGS=(
--rerun
--allow-rerun-success=tags=needs-internet
--on-warn-failure-exit-77
--tag=!reprovision
--parallel=5
)
run_kola
collect_kola_artifacts

# reprovision test
export KOLA_ACTION="run"
export KOLA_ID="kola-reprovision"
export KOLA_EXTRA_ARGS=(
--tag=reprovision
)
run_kola
collect_kola_artifacts

elif [ "$TEST_CASE" = "test-kola-upgrade" ]; then
# upgrade test
export KOLA_ACTION="run-upgrade"
export KOLA_ID="run-upgrade"
export KOLA_EXTRA_ARGS=(
--upgrades
)
run_kola
collect_kola_artifacts

elif [ "$TEST_CASE" = "test-kola-self" ]; then
REPO_ROOT=$(cd ../.. && pwd)
cp -r "${REPO_ROOT}/tests/kola-ci-self" "${COSA_DIR}/kola-ci-self"

cosa kola list -E "${COSA_DIR}/kola-ci-self"
# self test
export KOLA_ACTION="run"
export KOLA_ID="kola-self"
export KOLA_EXTRA_ARGS=(
-E "${COSA_DIR}/kola-ci-self"
'ext.kola-ci-self*'
)
run_kola
collect_kola_artifacts
fi
24 changes: 24 additions & 0 deletions tmt/tests/utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -eEuo pipefail
set -x

export COREOS_ASSEMBLER_CONTAINER="$IMAGE_URL"
export COSA_DIR="$HOME/workspace/build"

cosa ()
{
podman run --rm --security-opt=label=disable --privileged \
-v "${COSA_DIR}:/srv" --device=/dev/kvm \
--device=/dev/fuse --tmpfs=/tmp -v /var/tmp:/var/tmp --name=cosa "${COREOS_ASSEMBLER_CONTAINER}" "$@";
}
collect_kola_artifacts() {
mkdir -p "$TMT_TEST_DATA"
cd "${COSA_DIR}" && tar -C "${OUTPUT_DIR}" -c --xz "${KOLA_ID}" > "${KOLA_ID}-${TOKEN}.tar.xz"
cd "${COSA_DIR}" && mv "${KOLA_ID}-${TOKEN}.tar.xz" "${TMT_TEST_DATA}/${KOLA_ID}-${TOKEN}.tar.xz"
}
Comment on lines +14 to +18
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The collect_kola_artifacts function uses variables OUTPUT_DIR and TOKEN which are only defined inside run_kola. If run_kola fails before these variables are assigned (e.g., at line 20), the trap handler will fail due to set -u (unbound variable). It is safer to initialize these variables at the top of the script or use default values in the function.

run_kola(){
OUTPUT_DIR=$(cd "${COSA_DIR}" && cosa shell -- mktemp -d tmp/kola-XXXX)
TOKEN="$(uuidgen | cut -f1 -d -)"
KOLA_ID="${KOLA_ID:-kola}"
cd "${COSA_DIR}" && cosa kola "${KOLA_ACTION}" --build=latest --arch="$(arch)" --output-dir="${OUTPUT_DIR}/${KOLA_ID}" "${KOLA_EXTRA_ARGS[@]}"
}