From 85605177a6b809fd1475bba3b455908b4881aeef Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:27:36 +0100 Subject: [PATCH 01/25] wip1 --- .github/workflows/k8s-snap-integration.yaml | 115 ++++++++++++-------- 1 file changed, 69 insertions(+), 46 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index c23b0cbf..96728aeb 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -2,7 +2,8 @@ name: Integration Test K8s-snap on: push: - branches: ["master"] + #todo revert before pr + branches: ["KU-1748/optional-cncf-conformance-tests"] pull_request: permissions: @@ -18,40 +19,40 @@ jobs: runs-on: ubuntu-20.04 steps: - - name: Checking out repo - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Install tox - run: pip install tox - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - name: Download latest k8s-snap - run: | - sudo snap download k8s --channel=latest/edge --basename k8s - - name: Install lxd - run: | - sudo snap refresh lxd --channel 5.21/stable - sudo lxd init --auto - sudo usermod --append --groups lxd $USER - sg lxd -c 'lxc version' - - name: Build k8s-dqlite - run: | - make static - - name: Unpack Snap - run: | - sudo unsquashfs -d snap-unpack-dir k8s.snap - - name: Replace k8s-dqlite binary - run: | - sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite - sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite - - name: Repack Snap - run: | - sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments +# - name: Checking out repo +# uses: actions/checkout@v4 +# - name: Setup Python +# uses: actions/setup-python@v5 +# with: +# python-version: "3.8" +# - name: Install tox +# run: pip install tox +# - name: Install Go +# uses: actions/setup-go@v5 +# with: +# go-version: "1.21" +# - name: Download latest k8s-snap +# run: | +# sudo snap download k8s --channel=latest/edge --basename k8s +# - name: Install lxd +# run: | +# sudo snap refresh lxd --channel 5.21/stable +# sudo lxd init --auto +# sudo usermod --append --groups lxd $USER +# sg lxd -c 'lxc version' +# - name: Build k8s-dqlite +# run: | +# make static +# - name: Unpack Snap +# run: | +# sudo unsquashfs -d snap-unpack-dir k8s.snap +# - name: Replace k8s-dqlite binary +# run: | +# sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite +# sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite +# - name: Repack Snap +# run: | +# sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments - name: Running env: TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap @@ -59,15 +60,37 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - git clone https://github.com/canonical/k8s-snap.git - cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' - - name: Prepare inspection reports - if: failure() + if [[ "${{ github.event.label.name }}" == "dependencies" || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests" ]]; then + export TEST_CNCF_E2E="true" + fi + echo TEST_CNCF_E2E + echo $TEST_CNCF_E2E + - name: postrun + if: ${{ ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} run: | - tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports - - name: Upload inspection report artifact - if: failure() - uses: actions/upload-artifact@v4 - with: - name: inspection-reports - path: ${{ github.workspace }}/inspection-reports.tar.gz + echo test + +# git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests +# # todo revert before merge git clone https://github.com/canonical/k8s-snap.git +# cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' +# - name: Prepare inspection reports +# if: failure() +# run: | +# tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports +# - name: Upload inspection report artifact +# if: failure() +# uses: actions/upload-artifact@v4 +# with: +# name: inspection-reports +# path: ${{ github.workspace }}/inspection-reports.tar.gz +# - name: Extract CNCF conformance report +# if: ${{ failure() && ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} +# working-directory: k8s-snap/tests/integration +# run: | +# tar -xf sonobuoy_e2e.tar.gz --one-top-level +# - name: Upload CNCF conformance report artifact +# uses: actions/upload-artifact@v4 +# if: ${{ failure() && ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} +# with: +# name: report_sonobuoy_e2e +# path: k8s-snap/tests/integration/sonobuoy_e2e \ No newline at end of file From b5483639114a30a01e3414fb5c0cb452833a408e Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:34:34 +0100 Subject: [PATCH 02/25] wip2 --- .github/workflows/k8s-snap-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 96728aeb..a24ef760 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -60,13 +60,13 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ github.event.label.name }}" == "dependencies" || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests" ]]; then + if [[ "${{ github.event.label.name }}" == "dependencies" || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ]]; then export TEST_CNCF_E2E="true" fi echo TEST_CNCF_E2E echo $TEST_CNCF_E2E - name: postrun - if: ${{ ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + if: ${{ ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' ) }} run: | echo test From e6c70003da4fcf33992fa984bf96ac6e1c1e6dce Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:36:34 +0100 Subject: [PATCH 03/25] wip3 --- .github/workflows/k8s-snap-integration.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index a24ef760..425cb78e 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -70,6 +70,7 @@ jobs: run: | echo test + # git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests # # todo revert before merge git clone https://github.com/canonical/k8s-snap.git # cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' From 9f36fcadea5407530d7cad515209a053eab1a7dc Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:43:02 +0100 Subject: [PATCH 04/25] wip4 --- .github/workflows/k8s-snap-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 425cb78e..5d41128e 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -60,13 +60,13 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ github.event.label.name }}" == "dependencies" || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ]]; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }} || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ]]; then export TEST_CNCF_E2E="true" fi echo TEST_CNCF_E2E echo $TEST_CNCF_E2E - name: postrun - if: ${{ ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' ) }} + if: ${{ ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' ) }} run: | echo test From ff898347f69b3b6e89842b04e5090f2d3e44445b Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:45:04 +0100 Subject: [PATCH 05/25] wip5 --- .github/workflows/k8s-snap-integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 5d41128e..e15ae031 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -60,7 +60,7 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }} || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ]]; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }}" || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ]]; then export TEST_CNCF_E2E="true" fi echo TEST_CNCF_E2E From c39e5d9659bd11007a0683a702d12d3025587d8f Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:46:18 +0100 Subject: [PATCH 06/25] wip5 --- .github/workflows/k8s-snap-integration.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index e15ae031..1ca66adb 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -70,7 +70,6 @@ jobs: run: | echo test - # git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests # # todo revert before merge git clone https://github.com/canonical/k8s-snap.git # cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' From 6f01b9832f527941abcfdfd5e925e381c8c684a5 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:49:10 +0100 Subject: [PATCH 07/25] wip6 --- .github/workflows/k8s-snap-integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 1ca66adb..e99a9693 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -60,7 +60,7 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }}" || "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ]]; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }}" || ( "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ) ]]; then export TEST_CNCF_E2E="true" fi echo TEST_CNCF_E2E From 77fea72791e3f40ccf3bc200f74ae03cf8bebdbf Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:52:20 +0100 Subject: [PATCH 08/25] wip7 --- .github/workflows/k8s-snap-integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index e99a9693..eb0c812e 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -60,7 +60,7 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') }}" || ( "${{ github.ref_name }}" == "KU-1748/optional-cncf-conformance-tests1" ) ]]; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' }}" ]] ; then export TEST_CNCF_E2E="true" fi echo TEST_CNCF_E2E From 9aa85caf7d6bf2386fc454bf2b070ab2fbba41ec Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:56:06 +0100 Subject: [PATCH 09/25] wip8 --- .github/workflows/k8s-snap-integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index eb0c812e..d0ec976c 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -60,7 +60,7 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' }}" ]] ; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' }}" == "true" ]] ; then export TEST_CNCF_E2E="true" fi echo TEST_CNCF_E2E From 9d5ae433d391685e6dd41631d15218c390e7c470 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 15:58:44 +0100 Subject: [PATCH 10/25] wip9 --- .github/workflows/k8s-snap-integration.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index d0ec976c..2455f9d0 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -70,6 +70,7 @@ jobs: run: | echo test + # git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests # # todo revert before merge git clone https://github.com/canonical/k8s-snap.git # cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' From d3afd0fbe5e3fd67fef29013428fb9370af70648 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 16:00:28 +0100 Subject: [PATCH 11/25] wip10 --- .github/workflows/k8s-snap-integration.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 2455f9d0..d0ec976c 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -70,7 +70,6 @@ jobs: run: | echo test - # git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests # # todo revert before merge git clone https://github.com/canonical/k8s-snap.git # cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' From 7ac0fbc74d321aa1e1a878bee75da2c232ae7e02 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 16:06:50 +0100 Subject: [PATCH 12/25] wip11 --- .github/workflows/k8s-snap-integration.yaml | 125 ++++++++++---------- 1 file changed, 60 insertions(+), 65 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index d0ec976c..78938155 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -19,40 +19,40 @@ jobs: runs-on: ubuntu-20.04 steps: -# - name: Checking out repo -# uses: actions/checkout@v4 -# - name: Setup Python -# uses: actions/setup-python@v5 -# with: -# python-version: "3.8" -# - name: Install tox -# run: pip install tox -# - name: Install Go -# uses: actions/setup-go@v5 -# with: -# go-version: "1.21" -# - name: Download latest k8s-snap -# run: | -# sudo snap download k8s --channel=latest/edge --basename k8s -# - name: Install lxd -# run: | -# sudo snap refresh lxd --channel 5.21/stable -# sudo lxd init --auto -# sudo usermod --append --groups lxd $USER -# sg lxd -c 'lxc version' -# - name: Build k8s-dqlite -# run: | -# make static -# - name: Unpack Snap -# run: | -# sudo unsquashfs -d snap-unpack-dir k8s.snap -# - name: Replace k8s-dqlite binary -# run: | -# sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite -# sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite -# - name: Repack Snap -# run: | -# sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments + - name: Checking out repo + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install tox + run: pip install tox + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" + - name: Download latest k8s-snap + run: | + sudo snap download k8s --channel=latest/edge --basename k8s + - name: Install lxd + run: | + sudo snap refresh lxd --channel 5.21/stable + sudo lxd init --auto + sudo usermod --append --groups lxd $USER + sg lxd -c 'lxc version' + - name: Build k8s-dqlite + run: | + make static + - name: Unpack Snap + run: | + sudo unsquashfs -d snap-unpack-dir k8s.snap + - name: Replace k8s-dqlite binary + run: | + sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite + sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite + - name: Repack Snap + run: | + sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments - name: Running env: TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap @@ -60,37 +60,32 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' }}" == "true" ]] ; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' }}" == "true" ]] ; then export TEST_CNCF_E2E="true" fi - echo TEST_CNCF_E2E - echo $TEST_CNCF_E2E - - name: postrun - if: ${{ ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests1' ) }} + git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests + # todo revert before merge git clone https://github.com/canonical/k8s-snap.git + cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' + - name: Prepare inspection reports + if: failure() run: | - echo test - -# git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests -# # todo revert before merge git clone https://github.com/canonical/k8s-snap.git -# cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' -# - name: Prepare inspection reports -# if: failure() -# run: | -# tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports -# - name: Upload inspection report artifact -# if: failure() -# uses: actions/upload-artifact@v4 -# with: -# name: inspection-reports -# path: ${{ github.workspace }}/inspection-reports.tar.gz -# - name: Extract CNCF conformance report -# if: ${{ failure() && ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} -# working-directory: k8s-snap/tests/integration -# run: | -# tar -xf sonobuoy_e2e.tar.gz --one-top-level -# - name: Upload CNCF conformance report artifact -# uses: actions/upload-artifact@v4 -# if: ${{ failure() && ( github.event.label.name == 'dependencies'|| github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} -# with: -# name: report_sonobuoy_e2e -# path: k8s-snap/tests/integration/sonobuoy_e2e \ No newline at end of file + tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports + - name: Upload inspection report artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: inspection-reports + path: ${{ github.workspace }}/inspection-reports.tar.gz + - name: Extract CNCF conformance report +# if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + if: ${{ always() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + working-directory: k8s-snap/tests/integration + run: | + tar -xf sonobuoy_e2e.tar.gz --one-top-level + - name: Upload CNCF conformance report artifact + uses: actions/upload-artifact@v4 +# if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + if: ${{ always() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + with: + name: report_sonobuoy_e2e + path: k8s-snap/tests/integration/sonobuoy_e2e \ No newline at end of file From 9a01df28d044022f3934f67d6ba160bdf2466989 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 16:29:40 +0100 Subject: [PATCH 13/25] wip12 --- .github/workflows/k8s-snap-integration.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 78938155..b80d6717 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -88,4 +88,5 @@ jobs: if: ${{ always() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} with: name: report_sonobuoy_e2e - path: k8s-snap/tests/integration/sonobuoy_e2e \ No newline at end of file + path: k8s-snap/tests/integration/sonobuoy_e2e + From 95fb4af050453f57c7eda3aae9efc8ec35a2492b Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 18:11:36 +0100 Subject: [PATCH 14/25] wip14 --- .github/workflows/test.yaml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..56d0de50 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,36 @@ +name: test build + +on: + push: + #todo revert before pr +# branches: ["KU-1748/optional-cncf-conformance-tests"] + pull_request: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + name: K8s-snap Integration Test + runs-on: ubuntu-20.04 + + steps: + - name: Running + env: + TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap + TEST_SUBSTRATE: lxd + TEST_LXD_IMAGE: ubuntu:22.04 + TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports + run: | + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' }}" == "true" ]] ; then + export TEST_CNCF_E2E="true" + fi + echo github.event.pull_request.body + echo "${{ github.event.pull_request.body }}" + echo github.event.pull_request + echo "${{ github.event.pull_request }}" + From 7db8e3ae47869f4fb5b15d23d61c051dc1dbc8e2 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 18:38:17 +0100 Subject: [PATCH 15/25] cleanup --- .github/workflows/k8s-snap-integration.yaml | 15 ++++----- .github/workflows/test.yaml | 36 --------------------- 2 files changed, 6 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index b80d6717..83a9b890 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -2,8 +2,7 @@ name: Integration Test K8s-snap on: push: - #todo revert before pr - branches: ["KU-1748/optional-cncf-conformance-tests"] + branches: ["main"] pull_request: permissions: @@ -60,11 +59,11 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' }}" == "true" ]] ; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'main' }}" == "true" ]] ; then export TEST_CNCF_E2E="true" fi - git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests - # todo revert before merge git clone https://github.com/canonical/k8s-snap.git + git clone https://github.com/canonical/k8s-snap.git -b KU-269/sonobuoy-e2e #revert after merging https://github.com/canonical/k8s-snap/pull/715 + #git clone https://github.com/canonical/k8s-snap.git cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' - name: Prepare inspection reports if: failure() @@ -77,15 +76,13 @@ jobs: name: inspection-reports path: ${{ github.workspace }}/inspection-reports.tar.gz - name: Extract CNCF conformance report -# if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} - if: ${{ always() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'main' ) }} working-directory: k8s-snap/tests/integration run: | tar -xf sonobuoy_e2e.tar.gz --one-top-level - name: Upload CNCF conformance report artifact uses: actions/upload-artifact@v4 -# if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} - if: ${{ always() && ( contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' ) }} + if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'main' ) }} with: name: report_sonobuoy_e2e path: k8s-snap/tests/integration/sonobuoy_e2e diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 56d0de50..00000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: test build - -on: - push: - #todo revert before pr -# branches: ["KU-1748/optional-cncf-conformance-tests"] - pull_request: - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - build: - name: K8s-snap Integration Test - runs-on: ubuntu-20.04 - - steps: - - name: Running - env: - TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap - TEST_SUBSTRATE: lxd - TEST_LXD_IMAGE: ubuntu:22.04 - TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports - run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependencies') || github.ref_name == 'KU-1748/optional-cncf-conformance-tests' }}" == "true" ]] ; then - export TEST_CNCF_E2E="true" - fi - echo github.event.pull_request.body - echo "${{ github.event.pull_request.body }}" - echo github.event.pull_request - echo "${{ github.event.pull_request }}" - From 799f83e65d60270145bf89be200cb49491d61bfd Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Wed, 6 Nov 2024 18:42:34 +0100 Subject: [PATCH 16/25] fix main->master --- .github/workflows/k8s-snap-integration.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 83a9b890..7aee7768 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -2,7 +2,7 @@ name: Integration Test K8s-snap on: push: - branches: ["main"] + branches: ["master"] pull_request: permissions: @@ -59,7 +59,7 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'main' }}" == "true" ]] ; then + if [[ "${{ contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' }}" == "true" ]] ; then export TEST_CNCF_E2E="true" fi git clone https://github.com/canonical/k8s-snap.git -b KU-269/sonobuoy-e2e #revert after merging https://github.com/canonical/k8s-snap/pull/715 @@ -76,13 +76,13 @@ jobs: name: inspection-reports path: ${{ github.workspace }}/inspection-reports.tar.gz - name: Extract CNCF conformance report - if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'main' ) }} + if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' ) }} working-directory: k8s-snap/tests/integration run: | tar -xf sonobuoy_e2e.tar.gz --one-top-level - name: Upload CNCF conformance report artifact uses: actions/upload-artifact@v4 - if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'main' ) }} + if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' ) }} with: name: report_sonobuoy_e2e path: k8s-snap/tests/integration/sonobuoy_e2e From 27a9e65fe62afd1d1ea5e89b4562654ea7a01926 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Thu, 7 Nov 2024 09:04:25 +0100 Subject: [PATCH 17/25] wip15 --- .github/workflows/k8s-snap-integration.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 7aee7768..e8e49967 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -62,7 +62,9 @@ jobs: if [[ "${{ contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' }}" == "true" ]] ; then export TEST_CNCF_E2E="true" fi - git clone https://github.com/canonical/k8s-snap.git -b KU-269/sonobuoy-e2e #revert after merging https://github.com/canonical/k8s-snap/pull/715 + export TEST_CNCF_E2E="true" #todo remove after having label + + git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests #revert after merging https://github.com/canonical/k8s-snap/pull/715 #git clone https://github.com/canonical/k8s-snap.git cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' - name: Prepare inspection reports From 60ccb1a67a948b8645f128cc2c11b433b7d591e9 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:28:49 +0100 Subject: [PATCH 18/25] wip16 --- .github/workflows/k8s-snap-integration.yaml | 126 +++++++++++--------- 1 file changed, 67 insertions(+), 59 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index e8e49967..247a34e2 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -14,44 +14,47 @@ concurrency: jobs: build: + env: +# TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'cncf-conformance') || github.ref_name == 'master' }} + TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') || github.ref_name == 'master' }} name: K8s-snap Integration Test runs-on: ubuntu-20.04 steps: - - name: Checking out repo - uses: actions/checkout@v4 - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - name: Install tox - run: pip install tox - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version: "1.21" - - name: Download latest k8s-snap - run: | - sudo snap download k8s --channel=latest/edge --basename k8s - - name: Install lxd - run: | - sudo snap refresh lxd --channel 5.21/stable - sudo lxd init --auto - sudo usermod --append --groups lxd $USER - sg lxd -c 'lxc version' - - name: Build k8s-dqlite - run: | - make static - - name: Unpack Snap - run: | - sudo unsquashfs -d snap-unpack-dir k8s.snap - - name: Replace k8s-dqlite binary - run: | - sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite - sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite - - name: Repack Snap - run: | - sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments +# - name: Checking out repo +# uses: actions/checkout@v4 +# - name: Setup Python +# uses: actions/setup-python@v5 +# with: +# python-version: "3.8" +# - name: Install tox +# run: pip install tox +# - name: Install Go +# uses: actions/setup-go@v5 +# with: +# go-version: "1.21" +# - name: Download latest k8s-snap +# run: | +# sudo snap download k8s --channel=latest/edge --basename k8s +# - name: Install lxd +# run: | +# sudo snap refresh lxd --channel 5.21/stable +# sudo lxd init --auto +# sudo usermod --append --groups lxd $USER +# sg lxd -c 'lxc version' +# - name: Build k8s-dqlite +# run: | +# make static +# - name: Unpack Snap +# run: | +# sudo unsquashfs -d snap-unpack-dir k8s.snap +# - name: Replace k8s-dqlite binary +# run: | +# sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite +# sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite +# - name: Repack Snap +# run: | +# sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments - name: Running env: TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap @@ -59,33 +62,38 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - if [[ "${{ contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' }}" == "true" ]] ; then - export TEST_CNCF_E2E="true" - fi - export TEST_CNCF_E2E="true" #todo remove after having label + echo TEST_CNCF_E2E - git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests #revert after merging https://github.com/canonical/k8s-snap/pull/715 - #git clone https://github.com/canonical/k8s-snap.git - cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' - - name: Prepare inspection reports - if: failure() - run: | - tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports - - name: Upload inspection report artifact - if: failure() - uses: actions/upload-artifact@v4 - with: - name: inspection-reports - path: ${{ github.workspace }}/inspection-reports.tar.gz - name: Extract CNCF conformance report - if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' ) }} + if: ${{ env.TEST_CNCF_E2E }} working-directory: k8s-snap/tests/integration run: | - tar -xf sonobuoy_e2e.tar.gz --one-top-level - - name: Upload CNCF conformance report artifact - uses: actions/upload-artifact@v4 - if: ${{ failure() && ( contains(github.event.pull_request.labels.*.name, 'tag-that-Louise-choose') || github.ref_name == 'master' ) }} - with: - name: report_sonobuoy_e2e - path: k8s-snap/tests/integration/sonobuoy_e2e + echo "yest=${TEST_CNCF_E2E}" + + +# git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests #revert after merging https://github.com/canonical/k8s-snap/pull/715 +# #git clone https://github.com/canonical/k8s-snap.git +# cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' +# - name: Prepare inspection reports +# if: failure() +# run: | +# tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports +# - name: Upload inspection report artifact +# if: failure() +# uses: actions/upload-artifact@v4 +# with: +# name: inspection-reports +# path: ${{ github.workspace }}/inspection-reports.tar.gz +# - name: Extract CNCF conformance report +# if: ${{ failure() && env.TEST_CNCF_E2E }} +# working-directory: k8s-snap/tests/integration +# run: | +# tar -xf sonobuoy_e2e.tar.gz --one-top-level +# - name: Upload CNCF conformance report artifact +# uses: actions/upload-artifact@v4 +# if: ${{ failure() && env.TEST_CNCF_E2E }} +# with: +# name: report_sonobuoy_e2e +# path: k8s-snap/tests/integration/sonobuoy_e2e +# From 2ddd024b2913e2986258b17054b2cfe94563e3ca Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:30:57 +0100 Subject: [PATCH 19/25] wip17 --- .github/workflows/k8s-snap-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 247a34e2..f93a387b 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -62,13 +62,13 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - echo TEST_CNCF_E2E + echo $TEST_CNCF_E2E - name: Extract CNCF conformance report if: ${{ env.TEST_CNCF_E2E }} working-directory: k8s-snap/tests/integration run: | - echo "yest=${TEST_CNCF_E2E}" + echo "yest=$TEST_CNCF_E2E" From f431d799643a9384ff0d626895448906206a2f9d Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:33:05 +0100 Subject: [PATCH 20/25] wip18 --- .github/workflows/k8s-snap-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index f93a387b..f810d170 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -66,9 +66,9 @@ jobs: - name: Extract CNCF conformance report if: ${{ env.TEST_CNCF_E2E }} - working-directory: k8s-snap/tests/integration +# working-directory: k8s-snap/tests/integration run: | - echo "yest=$TEST_CNCF_E2E" + echo "yest=${TEST_CNCF_E2E}" From 6703e2553e41c5b9c20244ca6498f3a26bc86d77 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:37:02 +0100 Subject: [PATCH 21/25] wip19 --- .github/workflows/k8s-snap-integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index f810d170..d5ac200c 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -65,7 +65,7 @@ jobs: echo $TEST_CNCF_E2E - name: Extract CNCF conformance report - if: ${{ env.TEST_CNCF_E2E }} + if: ${{ env.TEST_CNCF_E2E == 'true'}} # working-directory: k8s-snap/tests/integration run: | echo "yest=${TEST_CNCF_E2E}" From 36f025bca8d241cd4ea66d448e93e9116f9ff6ff Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:39:01 +0100 Subject: [PATCH 22/25] wip20 --- .github/workflows/k8s-snap-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index d5ac200c..e28c20d0 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -16,7 +16,7 @@ jobs: build: env: # TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'cncf-conformance') || github.ref_name == 'master' }} - TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') || github.ref_name == 'master' }} + TEST_CNCF_E2E: contains(github.event.pull_request.labels.*.name, 'documentation') || github.ref_name == 'master' name: K8s-snap Integration Test runs-on: ubuntu-20.04 @@ -65,7 +65,7 @@ jobs: echo $TEST_CNCF_E2E - name: Extract CNCF conformance report - if: ${{ env.TEST_CNCF_E2E == 'true'}} + if: ${{ env.TEST_CNCF_E2E }} # working-directory: k8s-snap/tests/integration run: | echo "yest=${TEST_CNCF_E2E}" From 105f5e1701ad3b3367aba22714678c5445553e29 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:41:16 +0100 Subject: [PATCH 23/25] wip21 --- .github/workflows/k8s-snap-integration.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index e28c20d0..d5ac200c 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -16,7 +16,7 @@ jobs: build: env: # TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'cncf-conformance') || github.ref_name == 'master' }} - TEST_CNCF_E2E: contains(github.event.pull_request.labels.*.name, 'documentation') || github.ref_name == 'master' + TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') || github.ref_name == 'master' }} name: K8s-snap Integration Test runs-on: ubuntu-20.04 @@ -65,7 +65,7 @@ jobs: echo $TEST_CNCF_E2E - name: Extract CNCF conformance report - if: ${{ env.TEST_CNCF_E2E }} + if: ${{ env.TEST_CNCF_E2E == 'true'}} # working-directory: k8s-snap/tests/integration run: | echo "yest=${TEST_CNCF_E2E}" From ec6abdd1d7f53c5e181bb2189a432444e446cb02 Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:43:49 +0100 Subject: [PATCH 24/25] wip22 --- .github/workflows/k8s-snap-integration.yaml | 122 +++++++++----------- 1 file changed, 56 insertions(+), 66 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index d5ac200c..222096fe 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -21,40 +21,40 @@ jobs: runs-on: ubuntu-20.04 steps: -# - name: Checking out repo -# uses: actions/checkout@v4 -# - name: Setup Python -# uses: actions/setup-python@v5 -# with: -# python-version: "3.8" -# - name: Install tox -# run: pip install tox -# - name: Install Go -# uses: actions/setup-go@v5 -# with: -# go-version: "1.21" -# - name: Download latest k8s-snap -# run: | -# sudo snap download k8s --channel=latest/edge --basename k8s -# - name: Install lxd -# run: | -# sudo snap refresh lxd --channel 5.21/stable -# sudo lxd init --auto -# sudo usermod --append --groups lxd $USER -# sg lxd -c 'lxc version' -# - name: Build k8s-dqlite -# run: | -# make static -# - name: Unpack Snap -# run: | -# sudo unsquashfs -d snap-unpack-dir k8s.snap -# - name: Replace k8s-dqlite binary -# run: | -# sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite -# sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite -# - name: Repack Snap -# run: | -# sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments + - name: Checking out repo + uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install tox + run: pip install tox + - name: Install Go + uses: actions/setup-go@v5 + with: + go-version: "1.21" + - name: Download latest k8s-snap + run: | + sudo snap download k8s --channel=latest/edge --basename k8s + - name: Install lxd + run: | + sudo snap refresh lxd --channel 5.21/stable + sudo lxd init --auto + sudo usermod --append --groups lxd $USER + sg lxd -c 'lxc version' + - name: Build k8s-dqlite + run: | + make static + - name: Unpack Snap + run: | + sudo unsquashfs -d snap-unpack-dir k8s.snap + - name: Replace k8s-dqlite binary + run: | + sudo cp ./bin/static/k8s-dqlite snap-unpack-dir/bin/k8s-dqlite + sudo chmod o+r snap-unpack-dir/bin/k8s-dqlite + - name: Repack Snap + run: | + sudo mksquashfs snap-unpack-dir k8s-updated.snap -noappend -comp lzo -no-fragments - name: Running env: TEST_SNAP: ${{ github.workspace }}/k8s-updated.snap @@ -62,38 +62,28 @@ jobs: TEST_LXD_IMAGE: ubuntu:22.04 TEST_INSPECTION_REPORTS_DIR: ${{ github.workspace }}/inspection-reports run: | - echo $TEST_CNCF_E2E - + git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests #revert after merging https://github.com/canonical/k8s-snap/pull/715 + #git clone https://github.com/canonical/k8s-snap.git + cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' + - name: Prepare inspection reports + if: failure() + run: | + tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports + - name: Upload inspection report artifact + if: failure() + uses: actions/upload-artifact@v4 + with: + name: inspection-reports + path: ${{ github.workspace }}/inspection-reports.tar.gz - name: Extract CNCF conformance report - if: ${{ env.TEST_CNCF_E2E == 'true'}} -# working-directory: k8s-snap/tests/integration + if: ${{ failure() && (env.TEST_CNCF_E2E == 'true') }} + working-directory: k8s-snap/tests/integration run: | - echo "yest=${TEST_CNCF_E2E}" - - + tar -xf sonobuoy_e2e.tar.gz --one-top-level + - name: Upload CNCF conformance report artifact + uses: actions/upload-artifact@v4 + if: ${{ failure() && (env.TEST_CNCF_E2E == 'true') }} + with: + name: report_sonobuoy_e2e + path: k8s-snap/tests/integration/sonobuoy_e2e -# git clone https://github.com/canonical/k8s-snap.git -b KU-1748/optional-cncf-conformance-tests #revert after merging https://github.com/canonical/k8s-snap/pull/715 -# #git clone https://github.com/canonical/k8s-snap.git -# cd k8s-snap/tests/integration && sg lxd -c 'tox -e integration' -# - name: Prepare inspection reports -# if: failure() -# run: | -# tar -czvf inspection-reports.tar.gz -C ${{ github.workspace }} inspection-reports -# - name: Upload inspection report artifact -# if: failure() -# uses: actions/upload-artifact@v4 -# with: -# name: inspection-reports -# path: ${{ github.workspace }}/inspection-reports.tar.gz -# - name: Extract CNCF conformance report -# if: ${{ failure() && env.TEST_CNCF_E2E }} -# working-directory: k8s-snap/tests/integration -# run: | -# tar -xf sonobuoy_e2e.tar.gz --one-top-level -# - name: Upload CNCF conformance report artifact -# uses: actions/upload-artifact@v4 -# if: ${{ failure() && env.TEST_CNCF_E2E }} -# with: -# name: report_sonobuoy_e2e -# path: k8s-snap/tests/integration/sonobuoy_e2e -# From 0e69f351f53132d03266db2074ddd4c09d0c2e1e Mon Sep 17 00:00:00 2001 From: Maciej Golaszewski Date: Fri, 8 Nov 2024 14:53:23 +0100 Subject: [PATCH 25/25] review fixes --- .github/workflows/k8s-snap-integration.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/k8s-snap-integration.yaml b/.github/workflows/k8s-snap-integration.yaml index 222096fe..da7318c0 100644 --- a/.github/workflows/k8s-snap-integration.yaml +++ b/.github/workflows/k8s-snap-integration.yaml @@ -15,8 +15,7 @@ concurrency: jobs: build: env: -# TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'cncf-conformance') || github.ref_name == 'master' }} - TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') || github.ref_name == 'master' }} + TEST_CNCF_E2E: ${{ contains(github.event.pull_request.labels.*.name, 'cncf-conformance') || github.ref_name == 'master' }} name: K8s-snap Integration Test runs-on: ubuntu-20.04 @@ -76,13 +75,13 @@ jobs: name: inspection-reports path: ${{ github.workspace }}/inspection-reports.tar.gz - name: Extract CNCF conformance report - if: ${{ failure() && (env.TEST_CNCF_E2E == 'true') }} + if: ${{ failure() && ( env.TEST_CNCF_E2E == 'true' ) }} working-directory: k8s-snap/tests/integration run: | tar -xf sonobuoy_e2e.tar.gz --one-top-level - name: Upload CNCF conformance report artifact uses: actions/upload-artifact@v4 - if: ${{ failure() && (env.TEST_CNCF_E2E == 'true') }} + if: ${{ failure() && ( env.TEST_CNCF_E2E == 'true' ) }} with: name: report_sonobuoy_e2e path: k8s-snap/tests/integration/sonobuoy_e2e