diff --git a/.github/workflows/comment-ci.yaml b/.github/workflows/comment-ci.yaml index e55d498..b1c15c3 100644 --- a/.github/workflows/comment-ci.yaml +++ b/.github/workflows/comment-ci.yaml @@ -52,6 +52,7 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: ref: ${{ needs.check-pull-request.outputs.sha }} + allow-unsafe-pr-checkout: true - name: Build RPMs run: | @@ -121,7 +122,7 @@ jobs: - name: Run the tests uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4.3.1 with: - compose: Fedora-Rawhide + compose: Fedora-44 api_key: ${{ secrets.TF_API_PUB_KEY }} git_url: ${{ needs.check-pull-request.outputs.repo_url }} git_ref: ${{ needs.check-pull-request.outputs.ref }} @@ -129,10 +130,58 @@ jobs: pull_request_status_name: fedora-45-bootc tmt_context: "arch=x86_64;distro=fedora-45" tmt_plan_regex: bootc + variables: "ARCH=x86_64;TARGET_DISTRO=fedora-45;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" + timeout: 90 + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" + + fedora-44-ostree: + needs: check-pull-request + if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} + continue-on-error: true + runs-on: ubuntu-latest + permissions: + statuses: write + + steps: + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4.3.1 + with: + compose: Fedora-44 + api_key: ${{ secrets.TF_API_PUB_KEY }} + git_url: ${{ needs.check-pull-request.outputs.repo_url }} + git_ref: ${{ needs.check-pull-request.outputs.ref }} + update_pull_request_status: true + pull_request_status_name: fedora-44-ostree + tmt_context: "arch=x86_64;distro=fedora-44" + tmt_plan_regex: fedora-iot-raw variables: "ARCH=x86_64;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" timeout: 90 secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" + fedora-45-ostree: + needs: check-pull-request + if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} + continue-on-error: true + runs-on: ubuntu-latest + permissions: + statuses: write + + steps: + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4.3.1 + with: + compose: Fedora-44 + api_key: ${{ secrets.TF_API_PUB_KEY }} + git_url: ${{ needs.check-pull-request.outputs.repo_url }} + git_ref: ${{ needs.check-pull-request.outputs.ref }} + update_pull_request_status: true + pull_request_status_name: fedora-45-ostree + tmt_context: "arch=x86_64;distro=fedora-45" + tmt_plan_regex: fedora-iot-raw + variables: "ARCH=x86_64;TARGET_DISTRO=fedora-45;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" + timeout: 90 + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" + centos-9-ostree: needs: check-pull-request if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} diff --git a/.github/workflows/greenboot-ci.yaml b/.github/workflows/greenboot-ci.yaml index bfd2a4b..5d86c56 100644 --- a/.github/workflows/greenboot-ci.yaml +++ b/.github/workflows/greenboot-ci.yaml @@ -52,6 +52,7 @@ jobs: uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 with: ref: ${{ needs.check-pull-request.outputs.sha }} + allow-unsafe-pr-checkout: true - name: Build RPMs run: | @@ -121,7 +122,7 @@ jobs: - name: Run the tests uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4.3.1 with: - compose: Fedora-Rawhide + compose: Fedora-44 api_key: ${{ secrets.TF_API_PUB_KEY }} git_url: ${{ needs.check-pull-request.outputs.repo_url }} git_ref: ${{ needs.check-pull-request.outputs.ref }} @@ -129,10 +130,58 @@ jobs: pull_request_status_name: fedora-45-bootc tmt_context: "arch=x86_64;distro=fedora-45" tmt_plan_regex: bootc + variables: "ARCH=x86_64;TARGET_DISTRO=fedora-45;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" + timeout: 90 + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" + + fedora-44-ostree: + needs: check-pull-request + if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} + continue-on-error: true + runs-on: ubuntu-latest + permissions: + statuses: write + + steps: + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4.3.1 + with: + compose: Fedora-44 + api_key: ${{ secrets.TF_API_PUB_KEY }} + git_url: ${{ needs.check-pull-request.outputs.repo_url }} + git_ref: ${{ needs.check-pull-request.outputs.ref }} + update_pull_request_status: true + pull_request_status_name: fedora-44-ostree + tmt_context: "arch=x86_64;distro=fedora-44" + tmt_plan_regex: fedora-iot-raw variables: "ARCH=x86_64;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" timeout: 90 secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" + fedora-45-ostree: + needs: check-pull-request + if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} + continue-on-error: true + runs-on: ubuntu-latest + permissions: + statuses: write + + steps: + - name: Run the tests + uses: sclorg/testing-farm-as-github-action@230555baceb860aa468d216f1822974836b965d1 # v4.3.1 + with: + compose: Fedora-44 + api_key: ${{ secrets.TF_API_PUB_KEY }} + git_url: ${{ needs.check-pull-request.outputs.repo_url }} + git_ref: ${{ needs.check-pull-request.outputs.ref }} + update_pull_request_status: true + pull_request_status_name: fedora-45-ostree + tmt_context: "arch=x86_64;distro=fedora-45" + tmt_plan_regex: fedora-iot-raw + variables: "ARCH=x86_64;TARGET_DISTRO=fedora-45;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" + timeout: 90 + secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" + centos-9-ostree: needs: check-pull-request if: ${{ needs.check-pull-request.outputs.allowed_user == 'true' }} @@ -154,7 +203,7 @@ jobs: tmt_context: "arch=x86_64;distro=cs-9" tmt_plan_regex: ostree variables: "ARCH=x86_64;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" - timeout: 90 + timeout: 120 secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" rhel-9-8-ostree: @@ -178,7 +227,7 @@ jobs: tmt_context: "arch=x86_64;distro=rhel-9-8" tmt_plan_regex: ostree variables: "ARCH=x86_64;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" - timeout: 90 + timeout: 120 secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" rhel-10-2-bootc: @@ -202,5 +251,5 @@ jobs: tmt_context: "arch=x86_64;distro=rhel-10-2" tmt_plan_regex: bootc variables: "ARCH=x86_64;PR_NUMBER=${{ needs.check-pull-request.outputs.pr_number }}" - timeout: 90 + timeout: 120 secrets: "QUAY_USERNAME=${{ secrets.QUAY_USERNAME }};QUAY_PASSWORD=${{ secrets.QUAY_PASSWORD }};STAGE_REDHAT_IO_USERNAME=${{ secrets.STAGE_REDHAT_IO_USERNAME }};STAGE_REDHAT_IO_TOKEN=${{ secrets.STAGE_REDHAT_IO_TOKEN }};DOWNLOAD_NODE=${{ secrets.DOWNLOAD_NODE }}" diff --git a/testing_assets/failing_binary.aarch64 b/testing_assets/failing_binary.aarch64 new file mode 100755 index 0000000..0aaac43 Binary files /dev/null and b/testing_assets/failing_binary.aarch64 differ diff --git a/testing_assets/failing_binary.x86_64 b/testing_assets/failing_binary.x86_64 new file mode 100755 index 0000000..637d1ee Binary files /dev/null and b/testing_assets/failing_binary.x86_64 differ diff --git a/testing_assets/passing_binary.aarch64 b/testing_assets/passing_binary.aarch64 new file mode 100755 index 0000000..494aa6c Binary files /dev/null and b/testing_assets/passing_binary.aarch64 differ diff --git a/testing_assets/passing_binary.x86_64 b/testing_assets/passing_binary.x86_64 new file mode 100755 index 0000000..ebe5e9e Binary files /dev/null and b/testing_assets/passing_binary.x86_64 differ diff --git a/tests/files/centos-stream-9.json b/tests/files/centos-stream-9.json index 9800f32..9b0d9d2 100644 --- a/tests/files/centos-stream-9.json +++ b/tests/files/centos-stream-9.json @@ -31,10 +31,6 @@ "baseurl": "https://composes.stream.centos.org/production/latest-CentOS-Stream/compose/RT/x86_64/os/", "gpgkey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v2.0.22 (GNU/Linux)\n\nmQINBFzMWxkBEADHrskpBgN9OphmhRkc7P/YrsAGSvvl7kfu+e9KAaU6f5MeAVyn\nrIoM43syyGkgFyWgjZM8/rur7EMPY2yt+2q/1ZfLVCRn9856JqTIq0XRpDUe4nKQ\n8BlA7wDVZoSDxUZkSuTIyExbDf0cpw89Tcf62Mxmi8jh74vRlPy1PgjWL5494b3X\n5fxDidH4bqPZyxTBqPrUFuo+EfUVEqiGF94Ppq6ZUvrBGOVo1V1+Ifm9CGEK597c\naevcGc1RFlgxIgN84UpuDjPR9/zSndwJ7XsXYvZ6HXcKGagRKsfYDWGPkA5cOL/e\nf+yObOnC43yPUvpggQ4KaNJ6+SMTZOKikM8yciyBwLqwrjo8FlJgkv8Vfag/2UR7\nJINbyqHHoLUhQ2m6HXSwK4YjtwidF9EUkaBZWrrskYR3IRZLXlWqeOi/+ezYOW0m\nvufrkcvsh+TKlVVnuwmEPjJ8mwUSpsLdfPJo1DHsd8FS03SCKPaXFdD7ePfEjiYk\nnHpQaKE01aWVSLUiygn7F7rYemGqV9Vt7tBw5pz0vqSC72a5E3zFzIIuHx6aANry\nGat3aqU3qtBXOrA/dPkX9cWE+UR5wo/A2UdKJZLlGhM2WRJ3ltmGT48V9CeS6N9Y\nm4CKdzvg7EWjlTlFrd/8WJ2KoqOE9leDPeXRPncubJfJ6LLIHyG09h9kKQARAQAB\ntDpDZW50T1MgKENlbnRPUyBPZmZpY2lhbCBTaWduaW5nIEtleSkgPHNlY3VyaXR5\nQGNlbnRvcy5vcmc+iQI3BBMBAgAhBQJczFsZAhsDBgsJCAcDAgYVCAIJCgsDFgIB\nAh4BAheAAAoJEAW1VbOEg8ZdjOsP/2ygSxH9jqffOU9SKyJDlraL2gIutqZ3B8pl\nGy/Qnb9QD1EJVb4ZxOEhcY2W9VJfIpnf3yBuAto7zvKe/G1nxH4Bt6WTJQCkUjcs\nN3qPWsx1VslsAEz7bXGiHym6Ay4xF28bQ9XYIokIQXd0T2rD3/lNGxNtORZ2bKjD\nvOzYzvh2idUIY1DgGWJ11gtHFIA9CvHcW+SMPEhkcKZJAO51ayFBqTSSpiorVwTq\na0cB+cgmCQOI4/MY+kIvzoexfG7xhkUqe0wxmph9RQQxlTbNQDCdaxSgwbF2T+gw\nbyaDvkS4xtR6Soj7BKjKAmcnf5fn4C5Or0KLUqMzBtDMbfQQihn62iZJN6ZZ/4dg\nq4HTqyVpyuzMXsFpJ9L/FqH2DJ4exGGpBv00ba/Zauy7GsqOc5PnNBsYaHCply0X\n407DRx51t9YwYI/ttValuehq9+gRJpOTTKp6AjZn/a5Yt3h6jDgpNfM/EyLFIY9z\nV6CXqQQ/8JRvaik/JsGCf+eeLZOw4koIjZGEAg04iuyNTjhx0e/QHEVcYAqNLhXG\nrCTTbCn3NSUO9qxEXC+K/1m1kaXoCGA0UWlVGZ1JSifbbMx0yxq/brpEZPUYm+32\no8XfbocBWljFUJ+6aljTvZ3LQLKTSPW7TFO+GXycAOmCGhlXh2tlc6iTc41PACqy\nyy+mHmSv\n=kkH7\n-----END PGP PUBLIC KEY BLOCK-----\n", "check_gpg": true - }, - { - "name": "packages", - "baseurl": "http://192.168.100.1/packages/" } ] -} \ No newline at end of file +} diff --git a/tests/files/rhel-9-8-0.json b/tests/files/rhel-9-8-0.json index 7acb0f5..f5072e7 100644 --- a/tests/files/rhel-9-8-0.json +++ b/tests/files/rhel-9-8-0.json @@ -26,10 +26,6 @@ "name": "rt", "baseurl": "http://REPLACE_ME_HERE/rhel-9/nightly/RHEL-9/latest-RHEL-9.8.0/compose/RT/x86_64/os/", "gpgkey": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBErgSTsBEACh2A4b0O9t+vzC9VrVtL1AKvUWi9OPCjkvR7Xd8DtJxeeMZ5eF\n0HtzIG58qDRybwUe89FZprB1ffuUKzdE+HcL3FbNWSSOXVjZIersdXyH3NvnLLLF\n0DNRB2ix3bXG9Rh/RXpFsNxDp2CEMdUvbYCzE79K1EnUTVh1L0Of023FtPSZXX0c\nu7Pb5DI5lX5YeoXO6RoodrIGYJsVBQWnrWw4xNTconUfNPk0EGZtEnzvH2zyPoJh\nXGF+Ncu9XwbalnYde10OCvSWAZ5zTCpoLMTvQjWpbCdWXJzCm6G+/hx9upke546H\n5IjtYm4dTIVTnc3wvDiODgBKRzOl9rEOCIgOuGtDxRxcQkjrC+xvg5Vkqn7vBUyW\n9pHedOU+PoF3DGOM+dqv+eNKBvh9YF9ugFAQBkcG7viZgvGEMGGUpzNgN7XnS1gj\n/DPo9mZESOYnKceve2tIC87p2hqjrxOHuI7fkZYeNIcAoa83rBltFXaBDYhWAKS1\nPcXS1/7JzP0ky7d0L6Xbu/If5kqWQpKwUInXtySRkuraVfuK3Bpa+X1XecWi24JY\nHVtlNX025xx1ewVzGNCTlWn1skQN2OOoQTV4C8/qFpTW6DTWYurd4+fE0OJFJZQF\nbuhfXYwmRlVOgN5i77NTIJZJQfYFj38c/Iv5vZBPokO6mffrOTv3MHWVgQARAQAB\ntDNSZWQgSGF0LCBJbmMuIChyZWxlYXNlIGtleSAyKSA8c2VjdXJpdHlAcmVkaGF0\nLmNvbT6JAjYEEwECACAFAkrgSTsCGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAK\nCRAZni+R/UMdUWzpD/9s5SFR/ZF3yjY5VLUFLMXIKUztNN3oc45fyLdTI3+UClKC\n2tEruzYjqNHhqAEXa2sN1fMrsuKec61Ll2NfvJjkLKDvgVIh7kM7aslNYVOP6BTf\nC/JJ7/ufz3UZmyViH/WDl+AYdgk3JqCIO5w5ryrC9IyBzYv2m0HqYbWfphY3uHw5\nun3ndLJcu8+BGP5F+ONQEGl+DRH58Il9Jp3HwbRa7dvkPgEhfFR+1hI+Btta2C7E\n0/2NKzCxZw7Lx3PBRcU92YKyaEihfy/aQKZCAuyfKiMvsmzs+4poIX7I9NQCJpyE\nIGfINoZ7VxqHwRn/d5mw2MZTJjbzSf+Um9YJyA0iEEyD6qjriWQRbuxpQXmlAJbh\n8okZ4gbVFv1F8MzK+4R8VvWJ0XxgtikSo72fHjwha7MAjqFnOq6eo6fEC/75g3NL\nGht5VdpGuHk0vbdENHMC8wS99e5qXGNDued3hlTavDMlEAHl34q2H9nakTGRF5Ki\nJUfNh3DVRGhg8cMIti21njiRh7gyFI2OccATY7bBSr79JhuNwelHuxLrCFpY7V25\nOFktl15jZJaMxuQBqYdBgSay2G0U6D1+7VsWufpzd/Abx1/c3oi9ZaJvW22kAggq\ndzdA27UUYjWvx42w9menJwh/0jeQcTecIUd0d0rFcw/c1pvgMMl/Q73yzKgKYw==\n=zbHE\n-----END PGP PUBLIC KEY BLOCK-----\n-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBFsy23UBEACUKSphFEIEvNpy68VeW4Dt6qv+mU6am9a2AAl10JANLj1oqWX+\noYk3en1S6cVe2qehSL5DGVa3HMUZkP3dtbD4SgzXzxPodebPcr4+0QNWigkUisri\nXGL5SCEcOP30zDhZvg+4mpO2jMi7Kc1DLPzBBkgppcX91wa0L1pQzBcvYMPyV/Dh\nKbQHR75WdkP6OA2JXdfC94nxYq+2e0iPqC1hCP3Elh+YnSkOkrawDPmoB1g4+ft/\nxsiVGVy/W0ekXmgvYEHt6si6Y8NwXgnTMqxeSXQ9YUgVIbTpsxHQKGy76T5lMlWX\n4LCOmEVomBJg1SqF6yi9Vu8TeNThaDqT4/DddYInd0OO69s0kGIXalVgGYiW2HOD\nx2q5R1VGCoJxXomz+EbOXY+HpKPOHAjU0DB9MxbU3S248LQ69nIB5uxysy0PSco1\nsdZ8sxRNQ9Dw6on0Nowx5m6Thefzs5iK3dnPGBqHTT43DHbnWc2scjQFG+eZhe98\nEll/kb6vpBoY4bG9/wCG9qu7jj9Z+BceCNKeHllbezVLCU/Hswivr7h2dnaEFvPD\nO4GqiWiwOF06XaBMVgxA8p2HRw0KtXqOpZk+o+sUvdPjsBw42BB96A1yFX4jgFNA\nPyZYnEUdP6OOv9HSjnl7k/iEkvHq/jGYMMojixlvXpGXhnt5jNyc4GSUJQARAQAB\ntDNSZWQgSGF0LCBJbmMuIChhdXhpbGlhcnkga2V5KSA8c2VjdXJpdHlAcmVkaGF0\nLmNvbT6JAjkEEwECACMFAlsy23UCGwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIX\ngAAKCRD3b2bD1AgnknqOD/9fB2ASuG2aJIiap4kK58R+RmOVM4qgclAnaG57+vjI\nnKvyfV3NH/keplGNRxwqHekfPCqvkpABwhdGEXIE8ILqnPewIMr6PZNZWNJynZ9i\neSMzVuCG7jDoGyQ5/6B0f6xeBtTeBDiRl7+Alehet1twuGL1BJUYG0QuLgcEzkaE\n/gkuumeVcazLzz7L12D22nMk66GxmgXfqS5zcbqOAuZwaA6VgSEgFdV2X2JU79zS\nBQJXv7NKc+nDXFG7M7EHjY3Rma3HXkDbkT8bzh9tJV7Z7TlpT829pStWQyoxKCVq\nsEX8WsSapTKA3P9YkYCwLShgZu4HKRFvHMaIasSIZWzLu+RZH/4yyHOhj0QB7XMY\neHQ6fGSbtJ+K6SrpHOOsKQNAJ0hVbSrnA1cr5+2SDfel1RfYt0W9FA6DoH/S5gAR\ndzT1u44QVwwp3U+eFpHphFy//uzxNMtCjjdkpzhYYhOCLNkDrlRPb+bcoL/6ePSr\n016PA7eEnuC305YU1Ml2WcCn7wQV8x90o33klJmEkWtXh3X39vYtI4nCPIvZn1eP\nVy+F+wWt4vN2b8oOdlzc2paOembbCo2B+Wapv5Y9peBvlbsDSgqtJABfK8KQq/jK\nYl3h5elIa1I3uNfczeHOnf1enLOUOlq630yeM/yHizz99G1g+z/guMh5+x/OHraW\niA==\n=+Gxh\n-----END PGP PUBLIC KEY BLOCK-----" - }, - { - "name": "packages", - "baseurl": "http://192.168.100.1/packages/" } ] } diff --git a/tests/greenboot-bootc-anaconda-iso.sh b/tests/greenboot-bootc-anaconda-iso.sh index 6d80d63..deefe9f 100755 --- a/tests/greenboot-bootc-anaconda-iso.sh +++ b/tests/greenboot-bootc-anaconda-iso.sh @@ -22,6 +22,9 @@ echo -e "\033[0m" # Get OS info source /etc/os-release +if [[ -n "${TARGET_DISTRO:-}" ]]; then + IFS='-' read -r ID VERSION_ID <<< "${TARGET_DISTRO}" +fi # Setup variables TEST_UUID=anaconda-$((1 + RANDOM % 1000000)) @@ -34,22 +37,17 @@ EDGE_USER=core EDGE_USER_PASSWORD=foobar CONSOLE_LOG=/tmp/vm-console.log +COPR_CHROOT="" case "${ID}-${VERSION_ID}" in - "fedora-43") - OS_VARIANT="fedora-unknown" - BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:43" - BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" - BOOT_ARGS="uefi" - ;; "fedora-44") OS_VARIANT="fedora-unknown" - BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:44" + BASE_IMAGE_URL="quay.io/fedora/fedora-iot:44" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" BOOT_ARGS="uefi" ;; "fedora-45") OS_VARIANT="fedora-rawhide" - BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:rawhide" + BASE_IMAGE_URL="quay.io/fedora/fedora-iot:rawhide" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" BOOT_ARGS="uefi" ;; @@ -58,12 +56,14 @@ case "${ID}-${VERSION_ID}" in BASE_IMAGE_URL="quay.io/centos-bootc/centos-bootc:stream10" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no" + COPR_CHROOT="centos-stream-10-${ARCH}" ;; "rhel-9.8") OS_VARIANT="rhel9-unknown" BASE_IMAGE_URL="registry.stage.redhat.io/rhel9/rhel-bootc:9.8" BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.8" BOOT_ARGS="uefi" + COPR_CHROOT="centos-stream-9-${ARCH}" sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo ;; "rhel-10.2") @@ -71,6 +71,7 @@ case "${ID}-${VERSION_ID}" in BASE_IMAGE_URL="registry.stage.redhat.io/rhel10/rhel-bootc:10.2" BIB_URL="registry.stage.redhat.io/rhel10/bootc-image-builder:10.2" BOOT_ARGS="uefi" + COPR_CHROOT="centos-stream-10-${ARCH}" sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo ;; *) @@ -116,6 +117,23 @@ ansible-galaxy collection install community.general greenprint "Start firewalld" sudo systemctl enable --now firewalld +greenprint "Waiting for firewalld D-Bus interface to be ready" +fw_timeout=30 +fw_elapsed=0 +until sudo firewall-cmd --state >/dev/null 2>&1; do + sleep 1 + fw_elapsed=$((fw_elapsed + 1)) + if ! systemctl is-active --quiet firewalld; then + echo "firewalld systemd unit is not active" >&2 + sudo systemctl status firewalld --no-pager >&2 || true + exit 1 + fi + if [[ ${fw_elapsed} -ge ${fw_timeout} ]]; then + echo "firewalld did not become ready after ${fw_timeout} seconds" >&2 + exit 1 + fi +done + # Check ostree_key permissions KEY_PERMISSION_PRE=$(stat -L -c "%a %G %U" key/ostree_key | grep -oP '\d+' | head -n 1) echo -e "${KEY_PERMISSION_PRE}" @@ -193,8 +211,23 @@ podman login quay.io -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} podman login registry.stage.redhat.io -u ${STAGE_REDHAT_IO_USERNAME} -p ${STAGE_REDHAT_IO_TOKEN} tee Containerfile > /dev/null << EOF FROM ${BASE_IMAGE_URL} -RUN dnf install -y 'dnf-command(copr)' && \ - dnf copr enable -y packit/fedora-iot-greenboot-rs-${PR_NUMBER} && \ +EOF + +if [[ "${ID}-${VERSION_ID}" == "rhel-9.8" ]]; then + tee -a Containerfile >> /dev/null << EOF +COPY files/rhel-9-8.repo /etc/yum.repos.d/rhel-9-8.repo +EOF +fi + +if [[ "${ID}-${VERSION_ID}" == "rhel-10.2" ]]; then + tee -a Containerfile >> /dev/null << EOF +COPY files/rhel-10-2.repo /etc/yum.repos.d/rhel-10-2.repo +EOF +fi + +tee -a Containerfile >> /dev/null << EOF +RUN (dnf install -y 'dnf5-command(copr)' || dnf install -y 'dnf-command(copr)') && \ + dnf copr enable -y packit/fedora-iot-greenboot-rs-${PR_NUMBER} ${COPR_CHROOT} && \ dnf install -y greenboot greenboot-default-health-checks && \ systemctl enable greenboot-healthcheck.service RUN sed -i "s/GREENBOOT_MAX_BOOT_ATTEMPTS=3/GREENBOOT_MAX_BOOT_ATTEMPTS=5/g" /etc/greenboot/greenboot.conf @@ -212,19 +245,14 @@ COPY failing_script.sh /etc/greenboot/red.d COPY passing_binary /etc/greenboot/check/required.d/ COPY failing_binary /etc/greenboot/check/wanted.d/ -EOF - -if [[ "${ID}-${VERSION_ID}" == "rhel-9.8" ]]; then - tee -a Containerfile >> /dev/null << EOF -COPY files/rhel-9-8.repo /etc/yum.repos.d/rhel-9-8.repo -EOF -fi -if [[ "${ID}-${VERSION_ID}" == "rhel-10.2" ]]; then - tee -a Containerfile >> /dev/null << EOF -COPY files/rhel-10-2.repo /etc/yum.repos.d/rhel-10-2.repo +RUN useradd -m -G wheel ${EDGE_USER} && echo '${EDGE_USER}:${EDGE_USER_PASSWORD}' | chpasswd +RUN mkdir -p /home/${EDGE_USER}/.ssh && \ + echo '${SSH_KEY_PUB}' > /home/${EDGE_USER}/.ssh/authorized_keys && \ + chmod 700 /home/${EDGE_USER}/.ssh && \ + chmod 600 /home/${EDGE_USER}/.ssh/authorized_keys && \ + chown -R ${EDGE_USER}:${EDGE_USER} /home/${EDGE_USER}/.ssh EOF -fi greenprint "Building container (retrying until Copr build is available)" build_success=false @@ -253,18 +281,16 @@ podman push quay.io/${QUAY_USERNAME}/greenboot-bootc:${TEST_UUID} greenprint "Using BIB to convert container to anaconda iso" tee config.json > /dev/null << EOF { - "blueprint": { - "customizations": { - "user": [ - { - "name": "${EDGE_USER}", - "password": "${EDGE_USER_PASSWORD}", - "key": "${SSH_KEY_PUB}", - "groups": [ - "wheel" - ] - } - ] + "customizations": { + "installer": { + "kickstart": { + "contents": "text --non-interactive\nzerombr\nclearpart --all --initlabel --disklabel=gpt\nautopart --nohome --type=plain --fstype=xfs\nnetwork --bootproto=dhcp --device=link --activate --onboot=on\nbootloader --append=\"console=ttyS0,115200\"\npoweroff\n" + }, + "modules": { + "disable": [ + "org.fedoraproject.Anaconda.Modules.Users" + ] + } } } } @@ -286,38 +312,8 @@ podman run \ --use-librepo=true \ quay.io/${QUAY_USERNAME}/greenboot-bootc:${TEST_UUID} -########################################################### -## -## Generate kickstart file and mkksiso -## -########################################################### -ISOMOUNT=$(mktemp -d) -greenprint "Mounting install.iso -> $ISOMOUNT" -sudo mount -v -o ro "output/bootiso/install.iso" "$ISOMOUNT" -NEW_KS_FILE="${TEMPDIR}/bib.ks" -greenprint "Default osbuild-base.ks" -cat "${ISOMOUNT}/osbuild-base.ks" -greenprint "Default osbuild.ks" -cat "${ISOMOUNT}/osbuild.ks" - -greenprint "Preparing modified kickstart file" -cat > "$NEW_KS_FILE" << EOFKS -text -$(cat "${ISOMOUNT}/osbuild-base.ks") -$(cat "${ISOMOUNT}/osbuild.ks") -EOFKS -sed -i '/%include/d' "$NEW_KS_FILE" - -greenprint "Writing new ISO" -sudo mkksiso -c "console=ttyS0,115200" --ks "$NEW_KS_FILE" "output/bootiso/install.iso" "/var/lib/libvirt/images/install.iso" - -greenprint "==== NEW KICKSTART FILE ====" -cat "$NEW_KS_FILE" -greenprint "============================" - -greenprint "Clean up ISO building environment" -sudo umount -v "$ISOMOUNT" -rm -rf "$ISOMOUNT" +greenprint "Copying BIB ISO to libvirt images" +sudo cp output/bootiso/install.iso /var/lib/libvirt/images/install.iso ########################################################### ## @@ -329,6 +325,9 @@ greenprint "๐Ÿ’พ Create vm qcow2 files for ISO installation" LIBVIRT_IMAGE_PATH_UEFI=/var/lib/libvirt/images/${TEST_UUID}-disk.qcow2 sudo qemu-img create -f qcow2 "/var/lib/libvirt/images/${TEST_UUID}-disk.qcow2" 10G sudo restorecon -Rv /var/lib/libvirt/images/ +ISO_LABEL=$(blkid -o value -s LABEL /var/lib/libvirt/images/install.iso) +[[ -n "$ISO_LABEL" ]] || { greenprint "โŒ ISO label is empty"; exit 1; } +greenprint "ISO label: ${ISO_LABEL}" sudo virt-install --name="${TEST_UUID}-uefi"\ --disk path="${LIBVIRT_IMAGE_PATH_UEFI}",format=qcow2 \ --ram 3072 \ @@ -336,7 +335,8 @@ sudo virt-install --name="${TEST_UUID}-uefi"\ --network network=integration,mac=34:49:22:B0:83:30 \ --os-type linux \ --os-variant ${OS_VARIANT} \ - --cdrom "/var/lib/libvirt/images/install.iso" \ + --location "/var/lib/libvirt/images/install.iso",kernel=images/pxeboot/vmlinuz,initrd=images/pxeboot/initrd.img \ + --extra-args "console=ttyS0,115200 inst.stage2=hd:LABEL=${ISO_LABEL} inst.ks=hd:LABEL=${ISO_LABEL}:/osbuild.ks" \ --boot ${BOOT_ARGS} \ --graphics none \ --serial file,path=${CONSOLE_LOG} \ @@ -360,7 +360,13 @@ done if [[ $RESULTS != 1 ]]; then greenprint "SSH failed on initial boot โ€” collecting VM diagnostics" sudo virsh domstate "${TEST_UUID}-uefi" || true + sudo virsh domiflist "${TEST_UUID}-uefi" || true sudo virsh net-dhcp-leases integration || true + sudo ip addr show integration || true + greenprint "Firewall zone for integration bridge:" + sudo firewall-cmd --get-zone-of-interface=integration || true + greenprint "Connectivity test:" + ping -c 2 -W 2 192.168.100.50 || true greenprint "VM console output (last 100 lines):" sudo tail -100 ${CONSOLE_LOG} 2>/dev/null || true fi diff --git a/tests/greenboot-bootc-qcow2.sh b/tests/greenboot-bootc-qcow2.sh index 23130d8..0171ea6 100755 --- a/tests/greenboot-bootc-qcow2.sh +++ b/tests/greenboot-bootc-qcow2.sh @@ -22,6 +22,9 @@ echo -e "\033[0m" # Get OS info source /etc/os-release +if [[ -n "${TARGET_DISTRO:-}" ]]; then + IFS='-' read -r ID VERSION_ID <<< "${TARGET_DISTRO}" +fi # Setup variables TEST_UUID=qcow2-$((1 + RANDOM % 1000000)) @@ -34,22 +37,17 @@ EDGE_USER=core EDGE_USER_PASSWORD=foobar CONSOLE_LOG=/tmp/vm-console.log +COPR_CHROOT="" case "${ID}-${VERSION_ID}" in - "fedora-43") - OS_VARIANT="fedora-unknown" - BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:43" - BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" - BOOT_ARGS="uefi" - ;; "fedora-44") OS_VARIANT="fedora-unknown" - BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:44" + BASE_IMAGE_URL="quay.io/fedora/fedora-iot:44" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" BOOT_ARGS="uefi" ;; "fedora-45") OS_VARIANT="fedora-rawhide" - BASE_IMAGE_URL="quay.io/fedora/fedora-bootc:rawhide" + BASE_IMAGE_URL="quay.io/fedora/fedora-iot:rawhide" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" BOOT_ARGS="uefi" ;; @@ -58,12 +56,14 @@ case "${ID}-${VERSION_ID}" in BASE_IMAGE_URL="quay.io/centos-bootc/centos-bootc:stream10" BIB_URL="quay.io/centos-bootc/bootc-image-builder:latest" BOOT_ARGS="uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no" + COPR_CHROOT="centos-stream-10-${ARCH}" ;; "rhel-9.8") OS_VARIANT="rhel9-unknown" BASE_IMAGE_URL="registry.stage.redhat.io/rhel9/rhel-bootc:9.8" BIB_URL="registry.stage.redhat.io/rhel9/bootc-image-builder:9.8" BOOT_ARGS="uefi" + COPR_CHROOT="centos-stream-9-${ARCH}" sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-9-8.repo ;; "rhel-10.2") @@ -71,6 +71,7 @@ case "${ID}-${VERSION_ID}" in BASE_IMAGE_URL="registry.stage.redhat.io/rhel10/rhel-bootc:10.2" BIB_URL="registry.stage.redhat.io/rhel10/bootc-image-builder:10.2" BOOT_ARGS="uefi" + COPR_CHROOT="centos-stream-10-${ARCH}" sed -i "s/REPLACE_ME_HERE/${DOWNLOAD_NODE}/g" files/rhel-10-2.repo ;; *) @@ -116,6 +117,23 @@ ansible-galaxy collection install community.general greenprint "Start firewalld" sudo systemctl enable --now firewalld +greenprint "Waiting for firewalld D-Bus interface to be ready" +fw_timeout=30 +fw_elapsed=0 +until sudo firewall-cmd --state >/dev/null 2>&1; do + sleep 1 + fw_elapsed=$((fw_elapsed + 1)) + if ! systemctl is-active --quiet firewalld; then + echo "firewalld systemd unit is not active" >&2 + sudo systemctl status firewalld --no-pager >&2 || true + exit 1 + fi + if [[ ${fw_elapsed} -ge ${fw_timeout} ]]; then + echo "firewalld did not become ready after ${fw_timeout} seconds" >&2 + exit 1 + fi +done + # Check ostree_key permissions KEY_PERMISSION_PRE=$(stat -L -c "%a %G %U" key/ostree_key | grep -oP '\d+' | head -n 1) echo -e "${KEY_PERMISSION_PRE}" @@ -193,8 +211,23 @@ podman login quay.io -u ${QUAY_USERNAME} -p ${QUAY_PASSWORD} podman login registry.stage.redhat.io -u ${STAGE_REDHAT_IO_USERNAME} -p ${STAGE_REDHAT_IO_TOKEN} tee Containerfile > /dev/null << EOF FROM ${BASE_IMAGE_URL} -RUN dnf install -y 'dnf-command(copr)' && \ - dnf copr enable -y packit/fedora-iot-greenboot-rs-${PR_NUMBER} && \ +EOF + +if [[ "${ID}-${VERSION_ID}" == "rhel-9.8" ]]; then + tee -a Containerfile >> /dev/null << EOF +COPY files/rhel-9-8.repo /etc/yum.repos.d/rhel-9-8.repo +EOF +fi + +if [[ "${ID}-${VERSION_ID}" == "rhel-10.2" ]]; then + tee -a Containerfile >> /dev/null << EOF +COPY files/rhel-10-2.repo /etc/yum.repos.d/rhel-10-2.repo +EOF +fi + +tee -a Containerfile >> /dev/null << EOF +RUN (dnf install -y 'dnf5-command(copr)' || dnf install -y 'dnf-command(copr)') && \ + dnf copr enable -y packit/fedora-iot-greenboot-rs-${PR_NUMBER} ${COPR_CHROOT} && \ dnf install -y greenboot greenboot-default-health-checks && \ systemctl enable greenboot-healthcheck.service RUN sed -i "s/GREENBOOT_MAX_BOOT_ATTEMPTS=3/GREENBOOT_MAX_BOOT_ATTEMPTS=5/g" /etc/greenboot/greenboot.conf @@ -214,18 +247,6 @@ COPY passing_binary /etc/greenboot/check/required.d/ COPY failing_binary /etc/greenboot/check/wanted.d/ EOF -if [[ "${ID}-${VERSION_ID}" == "rhel-9.8" ]]; then - tee -a Containerfile >> /dev/null << EOF -COPY files/rhel-9-8.repo /etc/yum.repos.d/rhel-9-8.repo -EOF -fi - -if [[ "${ID}-${VERSION_ID}" == "rhel-10.2" ]]; then - tee -a Containerfile >> /dev/null << EOF -COPY files/rhel-10-2.repo /etc/yum.repos.d/rhel-10-2.repo -EOF -fi - greenprint "Building container (retrying until Copr build is available)" build_success=false for attempt in $(seq 1 10); do @@ -328,7 +349,15 @@ done if [[ $RESULTS != 1 ]]; then greenprint "SSH failed on initial boot โ€” collecting VM diagnostics" sudo virsh domstate "${TEST_UUID}-uefi" || true + sudo virsh domiflist "${TEST_UUID}-uefi" || true sudo virsh net-dhcp-leases integration || true + sudo ip addr show integration || true + greenprint "Firewall zone for integration bridge:" + sudo firewall-cmd --get-zone-of-interface=integration || true + greenprint "Connectivity test:" + ping -c 2 -W 2 192.168.100.50 || true + greenprint "Disk image info:" + qemu-img info "${LIBVIRT_IMAGE_PATH_UEFI}" || true greenprint "VM console output (last 100 lines):" sudo tail -100 ${CONSOLE_LOG} 2>/dev/null || true fi diff --git a/tests/greenboot-fedora-iot-raw.sh b/tests/greenboot-fedora-iot-raw.sh new file mode 100755 index 0000000..0d0a670 --- /dev/null +++ b/tests/greenboot-fedora-iot-raw.sh @@ -0,0 +1,409 @@ +#!/bin/bash +set -exuo pipefail + +# Get OS data. +source /etc/os-release +if [[ -n "${TARGET_DISTRO:-}" ]]; then + IFS='-' read -r ID VERSION_ID <<< "${TARGET_DISTRO}" +fi + +# Dump details about the instance running the CI job. +CPUS=$(nproc) +MEM=$(free -m | grep -oP '\d+' | head -n 1) +DISK=$(df --output=size -h / | sed '1d;s/[^0-9]//g') +HOSTNAME=$(uname -n) +USER=$(whoami) +ARCH=$(uname -m) +KERNEL=$(uname -r) + +echo -e "\033[0;36m" +cat << EOF +------------------------------------------------------------------------------ +CI MACHINE SPECS +------------------------------------------------------------------------------ + Hostname: ${HOSTNAME} + User: ${USER} + CPUs: ${CPUS} + RAM: ${MEM} MB + DISK: ${DISK} GB + ARCH: ${ARCH} + KERNEL: ${KERNEL} +------------------------------------------------------------------------------ +EOF +echo "CPU info" +lscpu +echo -e "\033[0m" + +# Colorful output. +function greenprint { + echo -e "\033[1;32m${1}\033[0m" +} + +# Set up variables. +TEST_UUID=$(uuidgen) +IMAGE_KEY="fedora-iot-raw-${TEST_UUID}" +GUEST_ADDRESS=192.168.100.50 +SSH_USER="root" +CONSOLE_LOG=/tmp/vm-console.log + +# Set up temporary files. +TEMPDIR=$(mktemp -d) +BOOT_ARGS="uefi" + +# SSH setup. +SSH_OPTIONS=(-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectTimeout=5) +SSH_KEY=key/ostree_key +SSH_KEY_PUB=$(cat "${SSH_KEY}".pub) + +case "${ID}-${VERSION_ID}" in + "fedora-44") + FEDORA_VERSION="44" + OS_VARIANT="fedora-unknown" + ;; + "fedora-45") + FEDORA_VERSION="45" + OS_VARIANT="fedora-rawhide" + ;; + *) + echo "unsupported distro: ${ID}-${VERSION_ID}" + exit 1;; +esac + +# Install required packages +greenprint "Install required packages" +sudo dnf install -y --nogpgcheck ansible-core qemu-img firewalld qemu-kvm \ + libvirt-client libvirt-daemon-kvm libvirt-daemon virt-install \ + kpartx e2fsprogs xz + +# Avoid collection installation failure +for _ in $(seq 0 30); do + ansible-galaxy collection install community.general community.libvirt + install_result=$? + if [[ $install_result == 0 ]]; then + break + fi + sleep 10 +done + +# Check ostree_key permissions +KEY_PERMISSION_PRE=$(stat -L -c "%a %G %U" key/ostree_key | grep -oP '\d+' | head -n 1) +echo -e "${KEY_PERMISSION_PRE}" +if [[ "${KEY_PERMISSION_PRE}" != "600" ]]; then + greenprint "๐Ÿ’ก File permissions too open...Changing to 600" + chmod 600 ./key/ostree_key +fi + +# Start firewalld +greenprint "Start firewalld" +sudo systemctl enable --now firewalld + +greenprint "Waiting for firewalld D-Bus interface to be ready" +fw_timeout=30 +fw_elapsed=0 +until sudo firewall-cmd --state >/dev/null 2>&1; do + sleep 1 + fw_elapsed=$((fw_elapsed + 1)) + if ! systemctl is-active --quiet firewalld; then + echo "firewalld systemd unit is not active" >&2 + sudo systemctl status firewalld --no-pager >&2 || true + exit 1 + fi + if [[ ${fw_elapsed} -ge ${fw_timeout} ]]; then + echo "firewalld did not become ready after ${fw_timeout} seconds" >&2 + exit 1 + fi +done + +# Start libvirtd and test it. +greenprint "๐Ÿš€ Starting libvirt daemon" +sudo systemctl start libvirtd +sudo virsh list --all > /dev/null + +# Set a customized dnsmasq configuration for libvirt so we always get the +# same address on boot up. +greenprint "๐Ÿ’ก Setup libvirt network" +sudo tee /tmp/integration.xml > /dev/null << EOF + + integration + 1c8fe98c-b53a-4ca4-bbdb-deb0f26b3579 + + + + + + + + + + + + + + +EOF +if ! sudo virsh net-info integration > /dev/null 2>&1; then + sudo virsh net-define /tmp/integration.xml +fi +if [[ $(sudo virsh net-info integration | grep 'Active' | awk '{print $2}') == 'no' ]]; then + sudo virsh net-start integration +fi + +# Allow anyone in the wheel group to talk to libvirt. +greenprint "๐Ÿšช Allowing users in wheel group to talk to libvirt" +sudo tee /etc/polkit-1/rules.d/50-libvirt.rules > /dev/null << EOF +polkit.addRule(function(action, subject) { + if (action.id == "org.libvirt.unix.manage" && + subject.isInGroup("adm")) { + return polkit.Result.YES; + } +}); +EOF + +# Wait for the ssh server up to be. +wait_for_ssh_up () { + SSH_STATUS=$(sudo ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${1}" '/bin/bash -c "echo -n READY"') + if [[ $SSH_STATUS == READY ]]; then + echo 1 + else + echo 0 + fi +} + +# Clean up our mess. +clean_up () { + greenprint "๐Ÿงผ Cleaning up" + sudo virsh destroy "${IMAGE_KEY}" + sudo virsh undefine "${IMAGE_KEY}" --nvram + sudo rm -f "/var/lib/libvirt/images/${IMAGE_KEY}.raw" + # Remove tmp dir. + sudo rm -rf "$TEMPDIR" +} + +# Test result checking +check_result () { + greenprint "Checking for test result" + if [[ $RESULTS == 1 ]]; then + greenprint "๐Ÿ’š Success" + else + greenprint "โŒ Failed" + clean_up + exit 1 + fi +} + +################################################## +## +## Download and prepare Fedora IoT raw image +## +################################################## + +greenprint "๐Ÿ“ฅ Downloading Fedora IoT ${FEDORA_VERSION} raw image" +COMPOSE_URL="https://kojipkgs.fedoraproject.org/compose/iot/latest-Fedora-IoT-${FEDORA_VERSION}/compose/IoT/${ARCH}/images/" +RAW_IMAGE_FILENAME=$(curl -sSf "${COMPOSE_URL}" | grep -oP "Fedora-IoT-raw-${FEDORA_VERSION}-[^\"]+\.${ARCH}\.raw\.xz" | head -1) + +if [[ -z "${RAW_IMAGE_FILENAME}" ]]; then + echo "Failed to find raw image at ${COMPOSE_URL}" + exit 1 +fi + +curl -L -o "${TEMPDIR}/${RAW_IMAGE_FILENAME}" "${COMPOSE_URL}${RAW_IMAGE_FILENAME}" + +greenprint "๐Ÿ“ฆ Decompressing raw image" +xz -d "${TEMPDIR}/${RAW_IMAGE_FILENAME}" +RAW_IMAGE="${TEMPDIR}/${RAW_IMAGE_FILENAME%.xz}" + +greenprint "๐Ÿ“ฆ Preparing raw image" +LIBVIRT_IMAGE_PATH=/var/lib/libvirt/images/${IMAGE_KEY}.raw +sudo cp "${RAW_IMAGE}" "${LIBVIRT_IMAGE_PATH}" +rm -f "${RAW_IMAGE}" +sudo qemu-img resize "${LIBVIRT_IMAGE_PATH}" +10G + +greenprint "๐Ÿ”ง Resizing root partition" +echo ", +" | sudo sfdisk -N 3 "${LIBVIRT_IMAGE_PATH}" + +greenprint "๐Ÿ”‘ Injecting SSH key via kpartx" +sudo kpartx -av "${LIBVIRT_IMAGE_PATH}" +LOOP_DEV=$(sudo kpartx -l "${LIBVIRT_IMAGE_PATH}" | head -1 | awk '{print $1}' | sed 's/p[0-9]*$//') +ROOT_PART="/dev/mapper/${LOOP_DEV}p3" + +sudo e2fsck -f "${ROOT_PART}" -y +sudo resize2fs "${ROOT_PART}" + +MOUNT_DIR="${TEMPDIR}/root" +mkdir -p "${MOUNT_DIR}" +sudo mount "${ROOT_PART}" "${MOUNT_DIR}" + +sudo mkdir -p "${MOUNT_DIR}/ostree/deploy/fedora-iot/var/roothome/.ssh" +cat "${SSH_KEY}.pub" | sudo tee -a "${MOUNT_DIR}/ostree/deploy/fedora-iot/var/roothome/.ssh/authorized_keys" +sudo chmod -R u=rwX,o=,g= "${MOUNT_DIR}/ostree/deploy/fedora-iot/var/roothome/.ssh/" + +sudo umount "${MOUNT_DIR}" +sudo kpartx -dv "${LIBVIRT_IMAGE_PATH}" + +################################################## +## +## Boot VM from raw image +## +################################################## + +greenprint "๐Ÿš€ Installing VM from raw image" +sudo virt-install --name="${IMAGE_KEY}"\ + --disk path="${LIBVIRT_IMAGE_PATH}",format=raw \ + --ram 4096 \ + --vcpus 2 \ + --network network=integration,mac=34:49:22:B0:83:30 \ + --os-variant ${OS_VARIANT} \ + --boot ${BOOT_ARGS} \ + --graphics none \ + --serial file,path=${CONSOLE_LOG} \ + --noautoconsole \ + --wait=-1 \ + --import \ + --noreboot + +greenprint "Start VM" +sudo virsh start "${IMAGE_KEY}" + +# Check for ssh ready to go. +greenprint "๐Ÿ›ƒ Checking for SSH is ready to go" +for _ in $(seq 0 30); do + RESULTS="$(wait_for_ssh_up $GUEST_ADDRESS)" + if [[ $RESULTS == 1 ]]; then + echo "SSH is ready now! ๐Ÿฅณ" + break + fi + sleep 10 +done + +if [[ $RESULTS != 1 ]]; then + greenprint "SSH failed โ€” collecting VM diagnostics" + sudo virsh domstate "${IMAGE_KEY}" || true + sudo virsh net-dhcp-leases integration || true + greenprint "VM console output (last 100 lines):" + sudo tail -100 ${CONSOLE_LOG} 2>/dev/null || true +fi +check_result + +################################################## +## +## Install greenboot from Copr PR build +## +################################################## + +greenprint "๐Ÿ“ฆ Enabling Packit Copr repo for PR #${PR_NUMBER}" +for _ in $(seq 0 30); do + ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" \ + "sudo dnf copr enable -y packit/fedora-iot-greenboot-rs-${PR_NUMBER}" + copr_result=$? + if [[ $copr_result == 0 ]]; then + break + fi + greenprint "Copr repo not ready yet, retrying in 30 seconds..." + sleep 30 +done + +if [[ $copr_result != 0 ]]; then + greenprint "โŒ Failed to enable Copr repo after retries" + clean_up + exit 1 +fi + +greenprint "๐Ÿ“ฆ Downloading greenboot RPMs from Copr" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" \ + "dnf download --destdir /tmp/greenboot-rpms greenboot greenboot-default-health-checks" + +greenprint "๐Ÿ“ฆ Replacing greenboot packages with PR build" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" \ + "sudo rpm-ostree override replace /tmp/greenboot-rpms/*.rpm" + +greenprint "๐Ÿ”„ Rebooting to activate new deployment" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" \ + "nohup sudo systemctl reboot &>/dev/null & exit" + +sleep 30 + +# Check for ssh ready to go after reboot. +greenprint "๐Ÿ›ƒ Checking for SSH after greenboot upgrade reboot" +for _ in $(seq 0 30); do + RESULTS="$(wait_for_ssh_up $GUEST_ADDRESS)" + if [[ $RESULTS == 1 ]]; then + echo "SSH is ready now! ๐Ÿฅณ" + break + fi + sleep 10 +done + +if [[ $RESULTS != 1 ]]; then + greenprint "SSH failed after greenboot upgrade โ€” collecting VM diagnostics" + sudo virsh domstate "${IMAGE_KEY}" || true + sudo virsh net-dhcp-leases integration || true + greenprint "VM console output (last 100 lines):" + sudo tail -100 ${CONSOLE_LOG} 2>/dev/null || true +fi +check_result + +################################################## +## +## Configure greenboot and deploy test assets +## +################################################## + +greenprint "๐Ÿ”ง Configuring greenboot on VM" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" \ + "sudo sed -i 's/GREENBOOT_MAX_BOOT_ATTEMPTS=3/GREENBOOT_MAX_BOOT_ATTEMPTS=5/g' /etc/greenboot/greenboot.conf" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" \ + "sudo sed -i 's#DISABLED_HEALTHCHECKS=()#DISABLED_HEALTHCHECKS=(\"01_repository_dns_check.sh\" \"not_exit.sh\")#g' /etc/greenboot/greenboot.conf" + +greenprint "๐Ÿ›ƒ Copying binary and script files to VM" + +# Create red.d and green.d directories if they don't exist +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo mkdir -p /etc/greenboot/red.d /etc/greenboot/green.d" + +# Copy all files to temp directory first +scp "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" ../testing_assets/failing_binary."${ARCH}" "${SSH_USER}@${GUEST_ADDRESS}":/tmp/failing_binary +scp "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" ../testing_assets/passing_binary."${ARCH}" "${SSH_USER}@${GUEST_ADDRESS}":/tmp/passing_binary +scp "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" ../testing_assets/failing_script.sh "${SSH_USER}@${GUEST_ADDRESS}":/tmp/ +scp "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" ../testing_assets/passing_script.sh "${SSH_USER}@${GUEST_ADDRESS}":/tmp/ + +# Setup all directories +greenprint "๐Ÿ›ƒ Setting up red.d directory files" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/failing_binary /etc/greenboot/red.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/passing_binary /etc/greenboot/red.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/failing_script.sh /etc/greenboot/red.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/passing_script.sh /etc/greenboot/red.d/" + +greenprint "๐Ÿ›ƒ Setting up green.d directory files" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/failing_binary /etc/greenboot/green.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/passing_binary /etc/greenboot/green.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/failing_script.sh /etc/greenboot/green.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo cp /tmp/passing_script.sh /etc/greenboot/green.d/" + +# Setup check directories +greenprint "๐Ÿ›ƒ Copying binary check files to VM" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo mv /tmp/failing_binary /etc/greenboot/check/wanted.d/" +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo mv /tmp/passing_binary /etc/greenboot/check/required.d/" + +# Clean up remaining temp files +ssh "${SSH_OPTIONS[@]}" -i "${SSH_KEY}" "${SSH_USER}@${GUEST_ADDRESS}" "sudo rm -f /tmp/failing_script.sh /tmp/passing_script.sh" + +# Add instance IP address into /etc/ansible/hosts +tee "${TEMPDIR}"/inventory > /dev/null << EOF +[ostree_guest] +${GUEST_ADDRESS} +[ostree_guest:vars] +ansible_python_interpreter=/usr/bin/python3 +ansible_user=${SSH_USER} +ansible_private_key_file=${SSH_KEY} +ansible_ssh_common_args="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" +EOF + +# Test IoT/Edge OS +ansible-playbook -v -i "${TEMPDIR}/inventory" greenboot-ostree.yaml || RESULTS=0 + +# Check test result +check_result + +# Final success clean up +clean_up + +exit 0 diff --git a/tests/greenboot-ostree.sh b/tests/greenboot-ostree.sh index 537a78e..7d0e3e5 100755 --- a/tests/greenboot-ostree.sh +++ b/tests/greenboot-ostree.sh @@ -109,6 +109,22 @@ case "${ID}-${VERSION_ID}" in exit 1;; esac +# Check ostree_key permissions +KEY_PERMISSION_PRE=$(stat -L -c "%a %G %U" key/ostree_key | grep -oP '\d+' | head -n 1) +echo -e "${KEY_PERMISSION_PRE}" +if [[ "${KEY_PERMISSION_PRE}" != "600" ]]; then + greenprint "๐Ÿ’ก File permissions too open...Changing to 600" + chmod 600 ./key/ostree_key +fi + +# Start httpd server as prod ostree repo +greenprint "Start httpd service" +sudo systemctl enable --now httpd.service + +# Start osbuild-composer.socket +greenprint "Start osbuild-composer.socket" +sudo systemctl enable --now osbuild-composer.socket + # Add Copr repo as osbuild-composer source for greenboot PR builds greenprint "Adding Copr source for greenboot PR #${PR_NUMBER}" sudo tee /tmp/greenboot-copr.toml > /dev/null << EOF @@ -134,26 +150,27 @@ if [ "$copr_added" = false ]; then exit 1 fi -# Check ostree_key permissions -KEY_PERMISSION_PRE=$(stat -L -c "%a %G %U" key/ostree_key | grep -oP '\d+' | head -n 1) -echo -e "${KEY_PERMISSION_PRE}" -if [[ "${KEY_PERMISSION_PRE}" != "600" ]]; then - greenprint "๐Ÿ’ก File permissions too open...Changing to 600" - chmod 600 ./key/ostree_key -fi - -# Start httpd server as prod ostree repo -greenprint "Start httpd service" -sudo systemctl enable --now httpd.service - -# Start osbuild-composer.socket -greenprint "Start osbuild-composer.socket" -sudo systemctl enable --now osbuild-composer.socket - # Start firewalld greenprint "Start firewalld" sudo systemctl enable --now firewalld +greenprint "Waiting for firewalld D-Bus interface to be ready" +fw_timeout=30 +fw_elapsed=0 +until sudo firewall-cmd --state >/dev/null 2>&1; do + sleep 1 + fw_elapsed=$((fw_elapsed + 1)) + if ! systemctl is-active --quiet firewalld; then + echo "firewalld systemd unit is not active" >&2 + sudo systemctl status firewalld --no-pager >&2 || true + exit 1 + fi + if [[ ${fw_elapsed} -ge ${fw_timeout} ]]; then + echo "firewalld did not become ready after ${fw_timeout} seconds" >&2 + exit 1 + fi +done + # Start libvirtd and test it. greenprint "๐Ÿš€ Starting libvirt daemon" sudo systemctl start libvirtd diff --git a/tmt/plans/greenboot-test.fmf b/tmt/plans/greenboot-test.fmf index 2669f33..562979d 100644 --- a/tmt/plans/greenboot-test.fmf +++ b/tmt/plans/greenboot-test.fmf @@ -27,3 +27,8 @@ provision: environment+: TEST_CASE: ostree-commit +/fedora-iot-raw: + summary: Test greenboot with pre-built Fedora IoT raw image + environment+: + TEST_CASE: fedora-iot-raw + diff --git a/tmt/tests/test.sh b/tmt/tests/test.sh index 2137c62..c8a410e 100755 --- a/tmt/tests/test.sh +++ b/tmt/tests/test.sh @@ -10,6 +10,8 @@ function run_tests() { ./greenboot-bootc-anaconda-iso.sh elif [ "$TEST_CASE" = "ostree-commit" ]; then ./greenboot-ostree.sh + elif [ "$TEST_CASE" = "fedora-iot-raw" ]; then + ./greenboot-fedora-iot-raw.sh else echo "Error: Test case $TEST_CASE not found!" exit 1