Skip to content

Commit 383970a

Browse files
authored
Merge branch 'canonical:main' into test-charmed-postgresql-smoke-test
2 parents ba32f85 + b9405e0 commit 383970a

File tree

17 files changed

+1415
-1341
lines changed

17 files changed

+1415
-1341
lines changed

.github/renovate.json5

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
33
"extends": ["github>canonical/data-platform//renovate_presets/charm.json5"],
4-
"reviewers": ["dragomirp", "marceloneppel", "taurus-forever"],
4+
"reviewers": ["dragomirp", "lucasgameiroborges", "marceloneppel", "taurus-forever"],
55
"packageRules": [
66
// Later rules override earlier rules
77
{
@@ -10,6 +10,66 @@
1010
}, {
1111
"matchPackageNames": ["python"],
1212
"allowedVersions": "<3.11"
13+
},
14+
{
15+
"matchDepNames": ["Juju 2"],
16+
"matchPackageNames": ["juju/juju"],
17+
"allowedVersions": "<3.0.0",
18+
"extractVersion": "^v(?<version>.*)$",
19+
"groupName": "Juju 2"
20+
},
21+
{
22+
"matchDepNames": ["Juju 3"],
23+
"matchPackageNames": ["juju/juju"],
24+
"allowedVersions": "<3.2.0",
25+
"extractVersion": "^v(?<version>.*)$",
26+
"groupName": "Juju 3"
27+
},
28+
{
29+
"matchDepNames": ["libjuju 2"],
30+
"matchPackageNames": ["juju"],
31+
"matchManagers": ["regex"],
32+
"matchDatasources": ["pypi"],
33+
"versioning": "loose",
34+
"allowedVersions": "<3",
35+
"groupName": "Juju 2"
36+
}
37+
],
38+
"regexManagers": [
39+
{
40+
"customType": "regex",
41+
"fileMatch": ["^(workflow-templates|\\.github/workflows)/[^/]+\\.ya?ml$"],
42+
"matchStrings": [
43+
"(- agent: )(?<currentValue>.*?) +# renovate: latest juju 2"
44+
],
45+
"depNameTemplate": "Juju 2",
46+
"packageNameTemplate": "juju/juju",
47+
"datasourceTemplate": "github-releases",
48+
"versioningTemplate": "loose",
49+
"extractVersionTemplate": "Juju release"
50+
},
51+
{
52+
"customType": "regex",
53+
"fileMatch": ["^(workflow-templates|\\.github/workflows)/[^/]+\\.ya?ml$"],
54+
"matchStrings": [
55+
"(- agent: )(?<currentValue>.*?) +# renovate: latest juju 3"
56+
],
57+
"depNameTemplate": "Juju 3",
58+
"packageNameTemplate": "juju/juju",
59+
"datasourceTemplate": "github-releases",
60+
"versioningTemplate": "loose",
61+
"extractVersionTemplate": "Juju release"
62+
},
63+
{
64+
"customType": "regex",
65+
"fileMatch": ["^(workflow-templates|\\.github/workflows)/[^/]+\\.ya?ml$"],
66+
"matchStrings": [
67+
"(libjuju: )==(?<currentValue>.*?) +# renovate: latest libjuju 2"
68+
],
69+
"depNameTemplate": "libjuju 2",
70+
"packageNameTemplate": "juju",
71+
"datasourceTemplate": "pypi",
72+
"versioningTemplate": "loose"
1373
}
1474
]
1575
}

.github/workflows/ci.yaml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
jobs:
2323
lint:
2424
name: Lint
25-
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v13.0.0
25+
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v13.1.1
2626

2727
unit-test:
2828
name: Unit test charm
@@ -42,7 +42,7 @@ jobs:
4242

4343
build:
4444
name: Build charm
45-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.0.0
45+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.1
4646
with:
4747
cache: true
4848

@@ -51,17 +51,17 @@ jobs:
5151
fail-fast: false
5252
matrix:
5353
juju:
54-
- agent: 2.9.46
55-
libjuju: ^2
54+
- agent: 2.9.49 # renovate: latest juju 2
55+
libjuju: ==2.9.46.1 # renovate: latest libjuju 2
5656
allure: false
57-
- agent: 3.1.7
57+
- agent: 3.1.8 # renovate: latest juju 3
5858
allure: true
5959
name: Integration test charm | ${{ matrix.juju.agent }}
6060
needs:
6161
- lint
6262
- unit-test
6363
- build
64-
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v13.0.0
64+
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v13.1.1
6565
with:
6666
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
6767
cloud: lxd
@@ -76,6 +76,8 @@ jobs:
7676
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
7777
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
7878
"UBUNTU_PRO_TOKEN" : "${{ secrets.UBUNTU_PRO_TOKEN }}",
79+
"LANDSCAPE_ACCOUNT_NAME": "${{ secrets.LANDSCAPE_ACCOUNT_NAME }}",
80+
"LANDSCAPE_REGISTRATION_KEY": "${{ secrets.LANDSCAPE_REGISTRATION_KEY }}",
7981
}
8082
permissions:
8183
contents: write # Needed for Allure Report beta

.github/workflows/release.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ jobs:
2424

2525
build:
2626
name: Build charm
27-
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.0.0
27+
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.1
2828

2929
release:
3030
name: Release charm
3131
needs:
3232
- ci-tests
3333
- build
34-
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v13.0.0
34+
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v13.1.1
3535
with:
3636
channel: 14/edge
3737
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}

.github/workflows/sync_issue_to_jira.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
sync:
1111
name: Sync GitHub issue to Jira
12-
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v13.0.0
12+
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v13.1.1
1313
with:
1414
jira-base-url: https://warthogs.atlassian.net
1515
jira-project-key: DPE

CONTRIBUTING.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ this operator.
88
- Generally, before developing enhancements to this charm, you should consider [opening an issue
99
](https://github.com/canonical/postgresql-operator/issues) explaining your use case.
1010
- If you would like to chat with us about your use-cases or proposed implementation, you can reach
11-
us at [public Canonical Data Platform channel](https://chat.charmhub.io/charmhub/channels/data-platform)
12-
or [Discourse](https://discourse.charmhub.io/).
11+
us using any channel from our [Contacts](https://charmhub.io/postgresql/docs/r-contacts).
1312
- Familiarising yourself with the [Charmed Operator Framework](https://juju.is/docs/sdk) library
1413
will help you a lot when working on new features or bug fixes.
1514
- All enhancements require review before being merged. Code review typically examines
@@ -40,13 +39,45 @@ tox # runs 'lint' and 'unit' environments
4039

4140
## Build charm
4241

43-
Build the charm in this git repository using:
42+
The build environment assumes that there are preinstalled on the system:
43+
* [tox](https://tox.wiki/) (version 4+ !!!)
44+
* [poetry](https://python-poetry.org/)
45+
* [charmcraft](https://snapcraft.io/charmcraft)
46+
* [charmcraftcache](https://github.com/canonical/charmcraftcache)
47+
* [pipx](https://pipx.pypa.io/stable/installation/)
48+
* [libpq-dev](https://www.postgresql.org/docs/current/libpq.html)
49+
50+
To build the charm it is also necessary at least 5GB of free disk space and
51+
it is recommended to provide 4+ CPU cores and 8GB+ RAM for a decent build speed.
52+
53+
To install all above build dependencies (assuming you are on Ubuntu 22.04 LTS):
4454

4555
```shell
46-
tox run -e build-dev
56+
sudo snap install charmcraft --classic
57+
58+
sudo snap install lxd # should be pre-installed on 22.04
59+
lxd init --auto # init LXD (if never used earlier)
60+
61+
sudo apt update && sudo apt install --yes libpq-dev pipx
62+
63+
sudo apt purge tox # if old tox version is installed from apt
64+
65+
pipx ensurepath
66+
pipx install tox
67+
pipx install poetry
68+
pipx install charmcraftcache
4769
```
4870

49-
The tox build environment assumes that there is a preinstalled [poetry](https://python-poetry.org/) on the system.
71+
Ensure local pip binaries are in your $PATH (otherwise re-login to your shell):
72+
```shell
73+
charmcraftcache --help
74+
```
75+
76+
Build the charm (inside this Git repository):
77+
78+
```shell
79+
tox run -e build-dev
80+
```
5081

5182
### Deploy
5283

lib/charms/operator_libs_linux/v2/snap.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
# Increment this PATCH version before using `charmcraft publish-lib` or reset
8585
# to 0 if you are raising the major API version
86-
LIBPATCH = 4
86+
LIBPATCH = 5
8787

8888

8989
# Regex to locate 7-bit C1 ANSI sequences
@@ -580,10 +580,17 @@ def ensure(
580580
# We are installing or refreshing a snap.
581581
if self._state not in (SnapState.Present, SnapState.Latest):
582582
# The snap is not installed, so we install it.
583+
logger.info(
584+
"Installing snap %s, revision %s, tracking %s", self._name, revision, channel
585+
)
583586
self._install(channel, cohort, revision)
584587
else:
585588
# The snap is installed, but we are changing it (e.g., switching channels).
589+
logger.info(
590+
"Refreshing snap %s, revision %s, tracking %s", self._name, revision, channel
591+
)
586592
self._refresh(channel=channel, cohort=cohort, revision=revision, devmode=devmode)
593+
logger.info("The snap installation completed successfully")
587594

588595
self._update_snap_apps()
589596
self._state = state

0 commit comments

Comments
 (0)