Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-3074] Fix rock entry point for MongoDB 5 #29

Merged
merged 17 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ 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: |
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
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 --channel=latest/stable --revision 1206
- uses: actions/download-artifact@v3
with:
name: mongodb-rock
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
2 changes: 1 addition & 1 deletion retag_rock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 9 additions & 1 deletion rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 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
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: |
Expand Down Expand Up @@ -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
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {env:branch} {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e integration

[testenv:ha-integration]
Expand All @@ -42,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 {env:branch} {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e ha-integration

[testenv:tls-integration]
Expand All @@ -56,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 {env:branch} {env:repo} operator; fi' {posargs}
tox --workdir operator -c operator -e tls-integration
Loading