diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.github/workflows/testing-farm.yml b/.github/workflows/testing-farm.yml new file mode 100644 index 0000000000..aa22f095e0 --- /dev/null +++ b/.github/workflows/testing-farm.yml @@ -0,0 +1,41 @@ +name: Testing Farm test +on: + push: + branches: + - main + pull_request: {} + +# The concurrency key is used to prevent multiple workflows from running at the same time +#concurrency: +# group: my-concurrency-group +# cancel-in-progress: true + +permissions: + contents: read + # This is required for the ability to create Issue comment + pull-requests: write + # This is required for the ability to create/update the Pull request status + statuses: write + +jobs: + tests: + runs-on: ubuntu-latest + # Let's schedule tests only on user request. NOT automatically. + # Only repository owner or member can schedule tests + #if: | + # github.event.issue.pull_request + # && contains(github.event.comment.body, '[test]') + # && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) + steps: + - name: Schedule test on Testing Farm + uses: sclorg/testing-farm-as-github-action@v2 + with: + api_key: ${{ secrets.TF_API_KEY }} + compose: fedora40 + arch: x86_64 + git_ref: ${{ github.ref_name }} + secrets: "PULL_SECRET=${{ secrets.PULL_SECRET }}" + tmt_plan_regex: smoke_plan + #variables: "SOME_DUMMY_VARIABLE =FOO_BAR_VARIABLE;OS_VARIABLE=DUMMY_OS" + #tmt_plan_regex: "tf-test" + #tmt_path: "test" diff --git a/testing-farm/install.fmf b/testing-farm/install.fmf new file mode 100644 index 0000000000..be085c1ab9 --- /dev/null +++ b/testing-farm/install.fmf @@ -0,0 +1,22 @@ +--- +summary: Install CRC + +description: | + Install CRC + +discover: + how: fmf + test: + - /testing-farm/script + +provision: + hardware: + virtualization: + is-virtualized: false + is-supported: true + compatible: + distro: fedora40 + +execute: + how: tmt + diff --git a/testing-farm/script/build.sh b/testing-farm/script/build.sh new file mode 100755 index 0000000000..a5df49cbb0 --- /dev/null +++ b/testing-farm/script/build.sh @@ -0,0 +1,42 @@ +#source prepare.sh +set -x +set -e +CRC_SCM="https://github.com/code-ready/crc.git" +LIBVIRT_DRIVER_SCM="https://github.com/code-ready/machine-driver-libvirt.git" +ADMINHELPER_SCM="https://github.com/code-ready/admin-helper.git" +git clone $CRC_SCM + +git clone $LIBVIRT_DRIVER_SCM +pushd machine-driver-libvirt +mdl_version_line=$(cat pkg/libvirt/constants.go | grep DriverVersion) +mdl_version=${mdl_version_line##*=} +mdl_version=$(echo $mdl_version | xargs) +go build -v -o crc-driver-libvirt-local ./cmd/machine-driver-libvirt +popd + +git clone $ADMINHELPER_SCM +admin_version_line=$(cat admin-helper/crc-admin-helper.spec.in | grep Version:) +admin_version=${admin_version_line##*:} +admin_version=$(echo $admin_version | xargs) +make -C admin-helper out/linux-amd64/crc-admin-helper VERSION=$admin_version + +pushd crc +mkdir -p custom_embedded +cp ./../machine-driver-libvirt/crc-driver-libvirt-local custom_embedded/crc-driver-libvirt-amd64 +cp ./../admin-helper/out/linux-amd64/crc-admin-helper custom_embedded/crc-admin-helper-linux-amd64 +# Match admin-helper version with latest from master head +sed -i "s/crcAdminHelperVersion.*=.*/crcAdminHelperVersion = \"${admin_version}\"\n/g" pkg/crc/version/version.go +# Match machine-driver-libvirt version with latest from master head +sed -i "s/MachineDriverVersion =.*/MachineDriverVersion = \"${mdl_version}\"/g" pkg/crc/machine/libvirt/constants.go +make linux-release CUSTOM_EMBED=true EMBED_DOWNLOAD_DIR=custom_embedded +popd + +# Download crc installer, first parmater is the install url +#curl --insecure -LO -C - ${1} +#sudo tar xvf crc-linux-amd64.tar.xz --strip-components 1 -C /usr/local/bin/ +#crc version +#rm crc-linux-amd64.tar.xz +ls crc/release + +tar xvf crc/release/crc-linux-amd64.tar.xz --strip-components 1 -C /usr/local/bin/ +crc version \ No newline at end of file diff --git a/testing-farm/script/main.fmf b/testing-farm/script/main.fmf new file mode 100644 index 0000000000..2201a71a22 --- /dev/null +++ b/testing-farm/script/main.fmf @@ -0,0 +1,15 @@ +--- +summary: Run an arbitrary script + +description: | + Runs an arbitrary script specified by the SCRIPT environment variable. + + If not script given, `cat /etc/os-release` is used. + +test: | + source prepare.sh + ./build.sh + ./test.sh + +# set the duration to 1h in case of more demanding commands +duration: 60m diff --git a/testing-farm/script/prepare.sh b/testing-farm/script/prepare.sh new file mode 100644 index 0000000000..17dd9057fe --- /dev/null +++ b/testing-farm/script/prepare.sh @@ -0,0 +1,13 @@ +#!bin/bash +set -x +cat /etc/fedora-release +dnf install -y git libvirt libvirt-libs libvirt-devel gcc make +#libvirt-glib pkg-config +rpm -qa "*libvirt*" +curl --insecure -LO -C - https://go.dev/dl/go1.22.5.linux-amd64.tar.gz +tar -C /usr/local -xzf go1.22.5.linux-amd64.tar.gz +export PATH=$PATH:/usr/local/go/bin +export CGO_ENABLED="1" +echo "${PULL_SECRET}" > ~/crc-pull-secret +cat ~/crc-pull-secret + diff --git a/testing-farm/script/test.sh b/testing-farm/script/test.sh new file mode 100755 index 0000000000..ff82ca253c --- /dev/null +++ b/testing-farm/script/test.sh @@ -0,0 +1,5 @@ +set -x +set -e +pushd crc +make e2e PULL_SECRET_FILE=--pull-secret-file=~/crc-pull-secret +make integration \ No newline at end of file diff --git a/testing-farm/smoke_plan.fmf b/testing-farm/smoke_plan.fmf new file mode 100644 index 0000000000..1b81456035 --- /dev/null +++ b/testing-farm/smoke_plan.fmf @@ -0,0 +1,7 @@ +summary: Basic smoke test +execute: + how: tmt + script: | + set +x + echo "${PULL_SECRET}" > ~/crc-pull-secret + cat ~/crc-pull-secret