From 1570b9a3b99c7f2205ccd55941135421a5c51735 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Wed, 29 Nov 2023 16:07:49 +0000 Subject: [PATCH 01/17] Fix rock entry point --- rockcraft.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rockcraft.yaml b/rockcraft.yaml index 6a6bbb6..7745548 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -71,3 +71,11 @@ parts: source: licenses organize: LICENSE-rock: licenses/LICENSE-rock + + entry: + plugin: dump + source: scripts + organize: + start.sh: bin/start.sh + stage: + - bin/start.sh From 599b499397cbb736b92c4c29906ef63f79addf36 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Wed, 29 Nov 2023 16:33:39 +0000 Subject: [PATCH 02/17] Test version --- rockcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rockcraft.yaml b/rockcraft.yaml index 7745548..0966a0b 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -2,7 +2,7 @@ # See LICENSE file for licensing details. name: charmed-mongodb # the name of your ROCK base: ubuntu:22.04 # the base environment for this ROCK -version: "5.0.14-12" # just for humans. Semantic versioning is recommended +version: "thisisatest" # just for humans. Semantic versioning is recommended summary: MongoDB in a rock. # 79 char long summary description: | MongoDB is a source-available cross-platform From a287f2d45b50b9f94b586e936b9c5ef92037c8a7 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 06:16:56 +0000 Subject: [PATCH 03/17] Revert test changes --- rockcraft.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rockcraft.yaml b/rockcraft.yaml index 0966a0b..9d62794 100644 --- a/rockcraft.yaml +++ b/rockcraft.yaml @@ -1,8 +1,8 @@ # Copyright 2023 Canonical Ltd. # See LICENSE file for licensing details. name: charmed-mongodb # the name of your ROCK -base: ubuntu:22.04 # the base environment for this ROCK -version: "thisisatest" # just for humans. Semantic versioning is recommended +base: ubuntu@22.04 # the base environment for this ROCK +version: "5.0.14-12" # just for humans. Semantic versioning is recommended summary: MongoDB in a rock. # 79 char long summary description: | MongoDB is a source-available cross-platform From 9c40031204a208dbc8a1f24f32558777d1a176fc Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 13:58:18 +0000 Subject: [PATCH 04/17] Update worflow files to support new rockcraft --- .github/workflows/build.yaml | 5 ----- .github/workflows/publish.yaml | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4321a4a..92c8d89 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,11 +19,6 @@ jobs: sudo snap install charmcraft --classic --revision 1349 - name: Build ROCK run: | - app_version=$(yq '.version' rockcraft.yaml) - version=$(yq '(.version|split("-"))[0]' rockcraft.yaml) - base=$(yq '(.base|split(":"))[1]' rockcraft.yaml) - tag=${version}-${base}_edge - sed -i "s/${app_version}/${tag}/g" rockcraft.yaml rockcraft pack - name: Upload locally built ROCK artifact uses: actions/upload-artifact@v3 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 10c4c87..e8d1f1c 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -40,9 +40,9 @@ jobs: - name: Import and push to GHCR run: | version=$(yq '(.version|split("-"))[0]' rockcraft.yaml) - base=$(yq '(.base|split(":"))[1]' rockcraft.yaml) + base=$(yq '(.base|split("@"))[1]' rockcraft.yaml) tag=${version}-${base}_edge sudo skopeo --insecure-policy copy \ - oci-archive:charmed-mongodb_${tag}_amd64.rock \ + oci-archive:charmed-mongodb_${version}_amd64.rock \ docker-daemon:ghcr.io/canonical/charmed-mongodb:${tag} docker push ghcr.io/canonical/charmed-mongodb:${tag} From 237be8d56e57020ed8fcee76d4665d31a0c044cb Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 14:04:28 +0000 Subject: [PATCH 05/17] Set correct branch (5/edge) for integration tests --- .github/workflows/integration.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index a44e960..b3e0f86 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -22,7 +22,9 @@ jobs: fail-fast: false steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + ref: 5/edge - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: From bcb8407b82a144dca4f8133802f091498eabb213 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 14:51:09 +0000 Subject: [PATCH 06/17] Specify 5/edge version for mongodb-k8s charm: correct way --- .github/workflows/integration.yaml | 2 -- tox.ini | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index b3e0f86..aa6347b 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -23,8 +23,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - ref: 5/edge - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: diff --git a/tox.ini b/tox.ini index 4b0d43e..0a64732 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ setenv = name=charmed-mongodb registry_namespace=ghcr.io/canonical repo=https://github.com/canonical/mongodb-k8s-operator.git + branch=5/edge [testenv:lint] description = run linters @@ -28,7 +29,7 @@ commands = then rockcraft pack; ./retag_rock.sh; fi' 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 {env:repo} operator; fi' {posargs} + bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {branch} {env:repo} operator; fi' {posargs} tox --workdir operator -c operator -e integration [testenv:ha-integration] From ff5b85df8933b51cb319cd226cfec17d3c0c3e83 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 15:14:00 +0000 Subject: [PATCH 07/17] Revert integration --- .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 aa6347b..a44e960 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -22,7 +22,7 @@ jobs: fail-fast: false steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: From 721ad9b4e940f3b4ae3537316432ad626a629166 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 15:20:50 +0000 Subject: [PATCH 08/17] Update retag_rock --- retag_rock.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retag_rock.sh b/retag_rock.sh index 30a5f74..761e00d 100755 --- a/retag_rock.sh +++ b/retag_rock.sh @@ -5,7 +5,7 @@ NAME=$(yq '.name' rockcraft.yaml) APP_VERSION=$(yq '.version' rockcraft.yaml) VERSION=$(yq '(.version|split("-"))[0]' rockcraft.yaml) -BASE=$(yq '(.base|split(":"))[1]' rockcraft.yaml) +BASE=$(yq '(.base|split("@"))[1]' rockcraft.yaml) TAG=${VERSION}-${BASE}_edge REGISTRY_NAMESPACE=ghcr.io/canonical From 426a943dfd43468b3213712d62701c13dbd4973d Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 15:35:27 +0000 Subject: [PATCH 09/17] Install rockcraft --- .github/workflows/integration.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index a44e960..a16da67 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -36,6 +36,9 @@ jobs: - name: Pin charmcraft version run: | sudo snap refresh --channel=2.2 charmcraft + - name: Install rockcraft + run: | + sudo snap install rockcraft --classic - uses: actions/download-artifact@v3 with: name: mongodb-rock From ade20b06fa698afa9c25f2105c73945b601fe9b5 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 15:50:06 +0000 Subject: [PATCH 10/17] Checkout correct rock branch --- .github/workflows/integration.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index a16da67..e8c28e9 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -22,7 +22,9 @@ jobs: fail-fast: false steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + ref: 5-22.04 - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: From 9e424fc9cfb81835da7535cb5dcc5b43f9fa001c Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 15:59:03 +0000 Subject: [PATCH 11/17] Checkout correct charm branch for tests --- .github/workflows/integration.yaml | 4 +--- tox.ini | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index e8c28e9..a16da67 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -22,9 +22,7 @@ jobs: fail-fast: false steps: - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: 5-22.04 + uses: actions/checkout@v3 - name: Setup operator environment uses: charmed-kubernetes/actions-operator@main with: diff --git a/tox.ini b/tox.ini index 0a64732..fcfb95d 100644 --- a/tox.ini +++ b/tox.ini @@ -43,7 +43,7 @@ commands = then rockcraft pack; ./retag_rock.sh; fi' 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 {env:repo} operator; fi' {posargs} + bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {branch} {env:repo} operator; fi' {posargs} tox --workdir operator -c operator -e ha-integration [testenv:tls-integration] @@ -57,5 +57,5 @@ commands = then rockcraft pack; ./retag_rock.sh; fi' 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 {env:repo} operator; fi' {posargs} + bash -ec 'if ! [ -d operator ]; then git clone --single-branch --branch {branch} {env:repo} operator; fi' {posargs} tox --workdir operator -c operator -e tls-integration From ef0ddb16fe132f8ad4e6cd78552a20ebaf770a63 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 30 Nov 2023 16:17:27 +0000 Subject: [PATCH 12/17] Checkout correct charm branch for tests --- tox.ini | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index fcfb95d..88ca01f 100644 --- a/tox.ini +++ b/tox.ini @@ -29,7 +29,7 @@ commands = then rockcraft pack; ./retag_rock.sh; fi' 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 {branch} {env:repo} operator; fi' {posargs} + 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 [testenv:ha-integration] @@ -43,7 +43,7 @@ commands = then rockcraft pack; ./retag_rock.sh; fi' 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 {branch} {env:repo} operator; fi' {posargs} + 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 [testenv:tls-integration] @@ -57,5 +57,5 @@ commands = then rockcraft pack; ./retag_rock.sh; fi' 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 {branch} {env:repo} operator; fi' {posargs} + 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 From edbfa08b0a1c55f258283807bf93e4c71674a82b Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Fri, 1 Dec 2023 11:03:46 +0000 Subject: [PATCH 13/17] Temporary disable ha-integraton 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 a16da67..54d53eb 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -18,7 +18,7 @@ jobs: needs: build strategy: matrix: - env: [integration, ha-integration, tls-integration] + env: [integration, tls-integration] fail-fast: false steps: - name: Checkout repository From 8e02caf9e6749e03a575412e07f9811f884f9c88 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Fri, 1 Dec 2023 17:14:23 +0000 Subject: [PATCH 14/17] Specify rockraft version --- .github/workflows/build.yaml | 2 +- .github/workflows/integration.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 92c8d89..6d5268c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: - name: Install dependencies run: | sudo snap install yq - sudo snap install rockcraft --classic --edge + sudo snap install rockcraft --classic --channel=latest/stable --revision 1206 sudo snap install charmcraft --classic --revision 1349 - name: Build ROCK run: | diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index 54d53eb..d864034 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -38,7 +38,7 @@ jobs: sudo snap refresh --channel=2.2 charmcraft - name: Install rockcraft run: | - sudo snap install rockcraft --classic + sudo snap install rockcraft --classic --channel=latest/stable --revision 1206 - uses: actions/download-artifact@v3 with: name: mongodb-rock From 6d02fc161060ea668971f457eb844fc855c742b1 Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Fri, 1 Dec 2023 17:44:33 +0000 Subject: [PATCH 15/17] Add keep-models tox flag for debug --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 88ca01f..7066043 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 + tox --workdir operator -c operator -e integration -- --keep-momodels [testenv:ha-integration] description = run operator integration tests @@ -44,7 +44,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 + tox --workdir operator -c operator -e ha-integration -- --keep-momodels [testenv:tls-integration] description = run operator integration tests From c5003b07ab10cd0e7d20667da77090e4be0f27df Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Fri, 1 Dec 2023 17:47:42 +0000 Subject: [PATCH 16/17] Revert change for mongodb 5 --- tox.ini | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tox.ini b/tox.ini index 7066043..8e566df 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-momodels + tox --workdir operator -c operator -e integration [testenv:ha-integration] description = run operator integration tests @@ -44,8 +44,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-momodels - + tox --workdir operator -c operator -e ha-integration [testenv:tls-integration] description = run operator integration tests skip_install = true From c0fb4292401c4926ae30d3e0b3f0db643a3769cc Mon Sep 17 00:00:00 2001 From: Mia Altieri Date: Fri, 1 Dec 2023 18:30:51 +0000 Subject: [PATCH 17/17] update workflows to match Dmitrys working local enc --- .github/workflows/integration.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d864034..249185d 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -32,13 +32,15 @@ jobs: juju-channel: 3.1/stable # This is needed until # https://bugs.launchpad.net/juju/+bug/1977582 is fixed - bootstrap-options: "--agent-version 3.1.5" + bootstrap-options: "--agent-version 3.1.6" - name: Pin charmcraft version run: | - sudo snap refresh --channel=2.2 charmcraft + sudo snap refresh charmcraft --classic --revision 1349 + sudo snap refresh charmcraft --hold=forever - name: Install rockcraft run: | sudo snap install rockcraft --classic --channel=latest/stable --revision 1206 + sudo snap refresh rockcraft --hold=forever - uses: actions/download-artifact@v3 with: name: mongodb-rock