From e5546fca94fa258890b945d30716abdbb19a058d Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Mon, 15 Jul 2024 08:02:29 +0000 Subject: [PATCH 01/10] fix broken int tests --- .github/workflows/integration.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 100b9ab..5514382 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -18,7 +18,7 @@ jobs: needs: build strategy: matrix: - env: [] + env: [integration] fail-fast: false steps: - name: Checkout repository From 332cae6cc2d1ca2e67807de85808abeac4cd9cc3 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Mon, 15 Jul 2024 08:11:50 +0000 Subject: [PATCH 02/10] use newest rockcraft to build rock --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b31ae13..ecbc348 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,6 +2,7 @@ name: Build rock on: workflow_call: + pull_request: jobs: build: @@ -15,8 +16,7 @@ jobs: - name: Install dependencies run: | sudo snap install yq - sudo snap install rockcraft --classic --channel=latest/stable --revision 1206 - sudo snap install charmcraft --classic --revision 1349 + sudo snap install rockcraft --classic --edge - name: Build rock run: | rockcraft pack From 4e62e491ef65a5970501198f021224e5c3fe4305 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Mon, 15 Jul 2024 08:31:06 +0000 Subject: [PATCH 03/10] use data platfrom workflow for build --- .github/workflows/build.yaml | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ecbc348..60c1364 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,4 +1,4 @@ -name: Build rock +name: Build Charmed MongoDB rock on: workflow_call: @@ -6,22 +6,5 @@ on: jobs: build: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Setup LXD - uses: canonical/setup-lxd@main - - name: Install dependencies - run: | - sudo snap install yq - sudo snap install rockcraft --classic --edge - - name: Build rock - run: | - rockcraft pack - - name: Upload locally built rock artifact - uses: actions/upload-artifact@v3 - with: - name: mongodb-rock - path: charmed-mongodb_*_amd64.rock + name: Build rock + uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v16 From cb9e8013bd74394a5266e09686e1ae17a42538bb Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Mon, 15 Jul 2024 08:50:05 +0000 Subject: [PATCH 04/10] fix mongno-snap part --- rockcraft.yaml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/rockcraft.yaml b/rockcraft.yaml index e281880..5b6cec8 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -10,7 +10,6 @@ description: | as a NoSQL database program, MongoDB uses JSON -like documents with optional schemas. license: Apache-2.0 # your application's SPDX license - services: mongod: summary: Start Mongod @@ -18,7 +17,6 @@ services: startup: enabled command: "/bin/bash /bin/start.sh" - platforms: # The platforms this rock should be built on and run on amd64: @@ -28,12 +26,9 @@ parts: stage-snaps: - charmed-mongodb/6/edge overlay-packages: - - ca-certificates - dep-debs: - plugin: nil - stage-packages: - libssh-4 - libbrotli1 + - ca-certificates non-root-user: plugin: nil after: [mongo-snap] @@ -62,7 +57,7 @@ parts: arr+=('${Source:Version}\n') dpkg-query -W -f "${arr[*]}" > ${rocks}/dpkg.query - ## for snap packages + # for snap packages cp snap.charmed-mongodb/manifest.yaml ${rocks} cp snap.charmed-mongodb/snapcraft.yaml ${rocks} From 3526fdc944efd14fb62c88e2e93fa47a72a371e7 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Mon, 15 Jul 2024 11:30:22 +0000 Subject: [PATCH 05/10] fix int tests --- .github/workflows/build.yaml | 1 - .github/workflows/integration.yaml | 35 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 60c1364..3e032e7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,7 +2,6 @@ name: Build Charmed MongoDB rock on: workflow_call: - pull_request: jobs: build: diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 5514382..b1d7f6b 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -11,7 +11,9 @@ on: jobs: build: - uses: ./.github/workflows/build.yaml + name: Build rock + uses: canonical/data-platform-workflows/.github/workflows/build_rock.yaml@v16 + integration: runs-on: ubuntu-latest timeout-minutes: 120 @@ -27,29 +29,31 @@ jobs: uses: charmed-kubernetes/actions-operator@main with: provider: microk8s - channel: "1.27-strict/stable" + channel: "1.29-strict/stable" bootstrap-constraints: "cores=2 mem=2G" juju-channel: 3.1/stable # This is needed until # https://bugs.launchpad.net/juju/+bug/1977582 is fixed - bootstrap-options: "--agent-version 3.1.6" - - name: Pin charmcraft version - run: | - sudo snap refresh charmcraft --classic --revision 1349 - sudo snap refresh charmcraft --hold=forever + bootstrap-options: "--agent-version 3.1.7" - name: Install rockcraft run: | sudo snap install rockcraft --classic --revision 1206 sudo snap refresh rockcraft --hold=forever - - uses: actions/download-artifact@v3 + - name: Download rock package(s) + uses: actions/download-artifact@v4 with: - name: mongodb-rock - - name: Install tox - run: python3 -m pip install tox - + pattern: ${{ needs.build.outputs.artifact-prefix }}-* + merge-multiple: true + - name: Install tox & poetry + run: | + pipx install tox + pipx install poetry + - name: Integration Tests + run: | + sg snap_microk8s -c "tox -e ${{ matrix.env }}" - name: Free disk space run: | - echo "Free disk space before cleanup" + echo "Free disk space after int tests" df -T # free space in the runner rockcraft clean @@ -57,8 +61,5 @@ jobs: sudo rm -rf /opt/ghc sudo rm -rf /usr/local/share/boost sudo rm -rf "$AGENT_TOOLSDIRECTORY" - echo "Free disk space after cleanup" + echo "Free disk after int tests" df -T - - - name: Integration Tests - run: sg snap_microk8s -c "tox -e ${{ matrix.env }}" From 868e2b577be9810052e19a84acfc2dff8fe6817d Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Thu, 18 Jul 2024 07:22:56 +0000 Subject: [PATCH 06/10] run tests as separate jobs --- .github/workflows/integration.yaml | 2 +- tox.ini | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index b1d7f6b..194ac2a 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -20,7 +20,7 @@ jobs: needs: build strategy: matrix: - env: [integration] + env: [integration, ha-integration, tls-integration] fail-fast: false steps: - name: Checkout repository diff --git a/tox.ini b/tox.ini index 1ed7ea3..a532055 100644 --- a/tox.ini +++ b/tox.ini @@ -30,7 +30,7 @@ commands = bash -ec 'microk8s ctr image import {env:name}_*-$(yq .base rockcraft.yaml | \ cut -c 8-)_edge_amd64.rock --base-name {env:registry_namespace}/{env:name}' bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs} - tox --workdir operator -c operator -e integration -- --keep-models + tox --workdir operator -c operator -e integration -- tests/integration/test_charm.py [testenv:ha-integration] @@ -45,7 +45,7 @@ commands = bash -ec 'microk8s ctr image import {env:name}_*-$(yq .base rockcraft.yaml | \ cut -c 8-)_edge_amd64.rock --base-name {env:registry_namespace}/{env:name}' bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs} - tox --workdir operator -c operator -e ha-integration -- --keep-models + tox --workdir operator -c operator -e integration -- tests/integration/ha_tests/test_ha.py [testenv:tls-integration] @@ -60,4 +60,4 @@ commands = bash -ec 'microk8s ctr image import {env:name}_*-$(yq .base rockcraft.yaml | \ cut -c 8-)_edge_amd64.rock --base-name {env:registry_namespace}/{env:name}' bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs} - tox --workdir operator -c operator -e tls-integration + tox --workdir operator -c operator -e integration -- tests/integration/tls_tests/test_tls.py From 43aa7cde53be7a8508abe3a03bbeaa1013eaccd2 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Fri, 19 Jul 2024 08:34:07 +0000 Subject: [PATCH 07/10] add log rotate to rock --- rockcraft.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rockcraft.yaml b/rockcraft.yaml index 5b6cec8..5bcbc66 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -26,9 +26,10 @@ parts: stage-snaps: - charmed-mongodb/6/edge overlay-packages: + - ca-certificates - libssh-4 - libbrotli1 - - ca-certificates + - logrotate non-root-user: plugin: nil after: [mongo-snap] @@ -66,6 +67,7 @@ parts: source: licenses organize: LICENSE-rock: licenses/LICENSE-rock + usr/share/doc/logrotate/copyright: licenses/COPYRIGHT-logrotate entry: plugin: dump From 5071494cc2f004949251c04696841299ca301865 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Fri, 19 Jul 2024 08:46:49 +0000 Subject: [PATCH 08/10] fix issues in HA test set up --- .github/workflows/integration.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 194ac2a..acf4df7 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -28,13 +28,9 @@ jobs: - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: - provider: microk8s - channel: "1.29-strict/stable" - bootstrap-constraints: "cores=2 mem=2G" - juju-channel: 3.1/stable - # This is needed until - # https://bugs.launchpad.net/juju/+bug/1977582 is fixed - bootstrap-options: "--agent-version 3.1.7" + cloud: microk8s + microk8s-snap-channel: 1.29-strict/stable + juju-agent-version: 3.1.7 - name: Install rockcraft run: | sudo snap install rockcraft --classic --revision 1206 From 4ac98641ae93091e4b6e957b5b344f80e9c678d1 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Fri, 19 Jul 2024 09:16:17 +0000 Subject: [PATCH 09/10] revert changes to integration ci for cloud set up --- .github/workflows/integration.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index acf4df7..194ac2a 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -28,9 +28,13 @@ jobs: - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: - cloud: microk8s - microk8s-snap-channel: 1.29-strict/stable - juju-agent-version: 3.1.7 + provider: microk8s + channel: "1.29-strict/stable" + bootstrap-constraints: "cores=2 mem=2G" + juju-channel: 3.1/stable + # This is needed until + # https://bugs.launchpad.net/juju/+bug/1977582 is fixed + bootstrap-options: "--agent-version 3.1.7" - name: Install rockcraft run: | sudo snap install rockcraft --classic --revision 1206 From aabced39e666caa7d2601a97baded1485af11757 Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Fri, 19 Jul 2024 13:12:31 +0000 Subject: [PATCH 10/10] skip network test --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a532055..ff8ebfd 100644 --- a/tox.ini +++ b/tox.ini @@ -45,7 +45,7 @@ commands = bash -ec 'microk8s ctr image import {env:name}_*-$(yq .base rockcraft.yaml | \ cut -c 8-)_edge_amd64.rock --base-name {env:registry_namespace}/{env:name}' bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {env:branch} {env:repo} operator; fi' {posargs} - tox --workdir operator -c operator -e integration -- tests/integration/ha_tests/test_ha.py + tox --workdir operator -c operator -e integration -- tests/integration/ha_tests/test_ha.py --deselect tests/integration/ha_tests/test_ha.py::test_network_cut [testenv:tls-integration]