Skip to content

Commit 24a755d

Browse files
authored
[DPE-2788] update data-platform-workflows (#308)
* Initial switch * Add missing integration deps * Remove schedule * No excludes * Bump libs and actions * Increase upgrade timeout
1 parent f72ef88 commit 24a755d

File tree

18 files changed

+1016
-904
lines changed

18 files changed

+1016
-904
lines changed

.github/renovate.json5

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": ["github>canonical/data-platform//renovate_presets/charm.json5"],
4+
"reviewers": ["dragomirp", "marceloneppel", "taurus-forever"],
5+
"packageRules": [
6+
// Later rules override earlier rules
7+
],
8+
"regexManagers": [
9+
{
10+
"fileMatch": ["(^|/)([\\w-]*)charmcraft\\.ya?ml$"],
11+
"matchStrings": ["- (?<depName>.*?)(?:\\[.*?\\])?==(?<currentValue>.*?) +# renovate"],
12+
"datasourceTemplate": "pypi",
13+
"versioningTemplate": "loose"
14+
}
15+
]
16+
}

.github/workflows/ci.yaml

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,38 @@ on:
2222
jobs:
2323
lint:
2424
name: Lint
25-
runs-on: ubuntu-latest
26-
timeout-minutes: 5
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
30-
- name: Install tox
31-
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
32-
run: python3 -m pip install tox
33-
- name: Run linters
34-
run: tox run -e lint
25+
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v5.1.2
3526

3627
unit-test:
37-
name: Unit tests
38-
runs-on: ubuntu-latest
39-
timeout-minutes: 5
28+
name: Unit test charm
4029
strategy:
4130
matrix:
4231
juju-version:
4332
- "juju2"
4433
- "juju3"
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 5
4536
steps:
4637
- name: Checkout
47-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
48-
- name: Install tox
49-
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
50-
run: python3 -m pip install tox
38+
uses: actions/checkout@v4
39+
- name: Install tox & poetry
40+
run: |
41+
pipx install tox
42+
pipx install poetry
5143
- name: Run tests
5244
run: tox run -e unit-${{ matrix.juju-version }}
5345

5446
build:
55-
name: Build charms
56-
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2
47+
name: Build charm
48+
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v5.1.2
49+
permissions:
50+
actions: write # Needed to manage GitHub Actions cache
5751

58-
integration-test:
52+
gh-hosted-integration-test:
5953
strategy:
6054
fail-fast: false
61-
max-parallel: 6
6255
matrix:
63-
tox-environments:
56+
tox-environment:
6457
- backup-integration
6558
- charm-integration
6659
- database-relation-integration
@@ -73,10 +66,17 @@ jobs:
7366
- tls-integration
7467
- upgrade-integration
7568
- upgrade-from-stable-integration
76-
agent-versions:
77-
- "2.9.45" # renovate: latest juju 2
78-
- "3.1.6" # renovate: latest juju 3
79-
name: ${{ matrix.tox-environments }} | ${{ matrix.agent-versions }}
69+
juju-snap-channel: ["2.9/stable", "3.1/stable"]
70+
include:
71+
- juju-snap-channel: "3.1/stable"
72+
agent-version: "3.1.6"
73+
libjuju-version: "3.2.2"
74+
exclude-mark: "juju2"
75+
- juju-snap-channel: "2.9/stable"
76+
agent-version: "2.9.45"
77+
libjuju-version: "2.9.45.0"
78+
exclude-mark: "juju3"
79+
name: ${{ matrix.juju-snap-channel }} - (GH hosted) ${{ matrix.tox-environment }}
8080
needs:
8181
- lint
8282
- unit-test
@@ -85,41 +85,43 @@ jobs:
8585
timeout-minutes: 120
8686
steps:
8787
- name: Checkout
88-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
89-
- name: Set channel
88+
uses: actions/checkout@v4
89+
- name: Install tox & poetry
9090
run: |
91-
juju_channel=$(echo "${{ matrix.agent-versions }}" | cut -c 1-3)
92-
echo "channel=${juju_channel}/stable" >> "$GITHUB_ENV"
93-
juju_major=$(echo "${{ matrix.agent-versions }}" | cut -c 1)
94-
echo "libjuju=juju${juju_major}" >> "$GITHUB_ENV"
91+
pipx install tox
92+
pipx install poetry
9593
- name: Setup operator environment
96-
# TODO: Replace with custom image on self-hosted runner
9794
uses: charmed-kubernetes/actions-operator@main
9895
with:
9996
provider: microk8s
10097
channel: "1.28-strict/stable"
101-
bootstrap-options: "--agent-version ${{ matrix.agent-versions }}"
102-
juju-channel: "${{ env.channel }}"
98+
bootstrap-options: "--agent-version ${{ matrix.agent-version }}"
99+
juju-channel: ${{ matrix.juju-snap-channel }}
100+
- name: Update python-libjuju version
101+
if: ${{ matrix.juju-snap-channel == '2.9/stable' }}
102+
run: poetry add --lock --group integration juju@'${{ matrix.libjuju-version }}'
103103
- name: Download packed charm(s)
104104
uses: actions/download-artifact@v3
105105
with:
106106
name: ${{ needs.build.outputs.artifact-name }}
107-
- name: Select tests
108-
id: select-tests
107+
- name: Select test stability level
108+
id: select-test-stability
109109
run: |
110-
if [ "${{ github.event_name }}" == "schedule" ]
110+
if [[ "${{ github.event_name }}" == "schedule" ]]
111111
then
112112
echo Running unstable and stable tests
113-
echo "mark_expression=" >> $GITHUB_OUTPUT
113+
echo "mark_expression=" >> "$GITHUB_OUTPUT"
114114
else
115115
echo Skipping unstable tests
116-
echo "mark_expression=and not unstable" >> $GITHUB_OUTPUT
116+
echo "mark_expression=and not unstable" >> "$GITHUB_OUTPUT"
117117
fi
118118
- name: Run integration tests
119-
run: tox run -e ${{ matrix.tox-environments }}-${{ env.libjuju }} -- -m 'not not${{ env.libjuju }} ${{ steps.select-tests.outputs.mark_expression }}' --keep-models
119+
run: tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-stability.outputs.mark_expression }}' --keep-models
120120
env:
121-
AWS_ACCESS_KEY: "${{ secrets.AWS_ACCESS_KEY }}"
122-
AWS_SECRET_KEY: "${{ secrets.AWS_SECRET_KEY }}"
123-
GCP_ACCESS_KEY: "${{ secrets.GCP_ACCESS_KEY }}"
124-
GCP_SECRET_KEY: "${{ secrets.GCP_SECRET_KEY }}"
125-
CI_PACKED_CHARMS: ${{ needs.build.outputs.charms }}
121+
SECRETS_FROM_GITHUB: |
122+
{
123+
"AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
124+
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
125+
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
126+
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
127+
}

.github/workflows/lib-check.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ on:
1414
- 'LICENSE'
1515
- '**.md'
1616
- 'renovate.json'
17-
schedule:
18-
- cron: '53 0 * * *' # Daily at 00:53 UTC
19-
# Triggered on push to branch "main" by .github/workflows/release.yaml
20-
workflow_call:
2117

2218
jobs:
2319
lib-check:
@@ -27,7 +23,7 @@ jobs:
2723
if: ${{ github.event.pull_request.head.repo.full_name == 'canonical/postgresql-k8s-operator' }}
2824
steps:
2925
- name: Checkout
30-
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
26+
uses: actions/checkout@v4
3127
with:
3228
fetch-depth: 0
3329
- name: Check libs

.github/workflows/release.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
- renovate.json
1313
- poetry.lock
1414
- pyproject.toml
15-
- '.github/**.md'
1615
- '.github/workflows/ci.yaml'
1716
- '.github/workflows/lib-check.yaml'
1817

@@ -21,6 +20,8 @@ jobs:
2120
name: Tests
2221
uses: ./.github/workflows/ci.yaml
2322
secrets: inherit
23+
permissions:
24+
actions: write # Needed to manage GitHub Actions cache
2425

2526
release-libraries:
2627
name: Release libraries
@@ -41,14 +42,14 @@ jobs:
4142

4243
build:
4344
name: Build charm
44-
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v2
45+
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v5.1.2
4546

4647
release:
4748
name: Release charm
4849
needs:
4950
- ci-tests
5051
- build
51-
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v2
52+
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v5.1.2
5253
with:
5354
channel: 14/edge
5455
artifact-name: ${{ needs.build.outputs.artifact-name }}

.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@f398b1deef66493fc2018625bcbfa0078b8627bc # v5
12+
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v5.1.2
1313
with:
1414
jira-base-url: https://warthogs.atlassian.net
1515
jira-project-key: DPE

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ build/
55
.coverage
66
__pycache__/
77
*.py[cod]
8+
requirements.txt
9+
requirements-last-build.txt
810

911
# PyCharm project folder.
1012
.idea/

charmcraft.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ bases:
88
channel: "22.04"
99
parts:
1010
charm:
11+
override-pull: |
12+
craftctl default
13+
if [[ ! -f requirements.txt ]]
14+
then
15+
echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
16+
exit 1
17+
fi
1118
build-packages:
1219
- libffi-dev
1320
- libssl-dev

0 commit comments

Comments
 (0)