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-2788] update data-platform-workflows #308

Merged
merged 6 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
16 changes: 16 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>canonical/data-platform//renovate_presets/charm.json5"],
"reviewers": ["dragomirp", "marceloneppel", "taurus-forever"],
"packageRules": [
// Later rules override earlier rules
],
"regexManagers": [
{
"fileMatch": ["(^|/)([\\w-]*)charmcraft\\.ya?ml$"],
"matchStrings": ["- (?<depName>.*?)(?:\\[.*?\\])?==(?<currentValue>.*?) +# renovate"],
"datasourceTemplate": "pypi",
"versioningTemplate": "loose"
}
]
}
94 changes: 48 additions & 46 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,45 +22,38 @@ on:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Install tox
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
run: python3 -m pip install tox
- name: Run linters
run: tox run -e lint
uses: canonical/data-platform-workflows/.github/workflows/[email protected]

unit-test:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 5
name: Unit test charm
strategy:
matrix:
juju-version:
- "juju2"
- "juju3"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Install tox
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
run: python3 -m pip install tox
uses: actions/checkout@v3
- name: Install tox & poetry
run: |
pipx install tox
pipx install poetry
- name: Run tests
run: tox run -e unit-${{ matrix.juju-version }}

build:
name: Build charms
uses: canonical/data-platform-workflows/.github/workflows/build_charms_with_cache.yaml@v2
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/[email protected]
permissions:
actions: write # Needed to manage GitHub Actions cache

integration-test:
gh-hosted-integration-test:
strategy:
fail-fast: false
max-parallel: 6
matrix:
tox-environments:
tox-environment:
- backup-integration
- charm-integration
- database-relation-integration
Expand All @@ -73,10 +66,17 @@ jobs:
- tls-integration
- upgrade-integration
- upgrade-from-stable-integration
agent-versions:
- "2.9.45" # renovate: latest juju 2
- "3.1.6" # renovate: latest juju 3
name: ${{ matrix.tox-environments }} | ${{ matrix.agent-versions }}
juju-snap-channel: ["2.9/stable", "3.1/stable"]
include:
- juju-snap-channel: "3.1/stable"
agent-version: "3.1.6"
libjuju-version: "3.2.2"
exclude-mark: "juju2"
- juju-snap-channel: "2.9/stable"
agent-version: "2.9.45"
libjuju-version: "2.9.45.0"
exclude-mark: "juju3"
name: ${{ matrix.juju-snap-channel }} - (GH hosted) ${{ matrix.tox-environment }}
needs:
- lint
- unit-test
Expand All @@ -85,41 +85,43 @@ jobs:
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
- name: Set channel
uses: actions/checkout@v3
- name: Install tox & poetry
run: |
juju_channel=$(echo "${{ matrix.agent-versions }}" | cut -c 1-3)
echo "channel=${juju_channel}/stable" >> "$GITHUB_ENV"
juju_major=$(echo "${{ matrix.agent-versions }}" | cut -c 1)
echo "libjuju=juju${juju_major}" >> "$GITHUB_ENV"
pipx install tox
pipx install poetry
- name: Setup operator environment
# TODO: Replace with custom image on self-hosted runner
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: "1.28-strict/stable"
bootstrap-options: "--agent-version ${{ matrix.agent-versions }}"
juju-channel: "${{ env.channel }}"
bootstrap-options: "--agent-version ${{ matrix.agent-version }}"
juju-channel: ${{ matrix.juju-snap-channel }}
- name: Update python-libjuju version
if: ${{ matrix.juju-snap-channel == '2.9/stable' }}
run: poetry add --lock --group integration juju@'${{ matrix.libjuju-version }}'
- name: Download packed charm(s)
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact-name }}
- name: Select tests
id: select-tests
- name: Select test stability level
id: select-test-stability
run: |
if [ "${{ github.event_name }}" == "schedule" ]
if [[ "${{ github.event_name }}" == "schedule" ]]
then
echo Running unstable and stable tests
echo "mark_expression=" >> $GITHUB_OUTPUT
echo "mark_expression=" >> "$GITHUB_OUTPUT"
else
echo Skipping unstable tests
echo "mark_expression=and not unstable" >> $GITHUB_OUTPUT
echo "mark_expression=and not unstable" >> "$GITHUB_OUTPUT"
fi
- name: Run integration tests
run: tox run -e ${{ matrix.tox-environments }}-${{ env.libjuju }} -- -m 'not not${{ env.libjuju }} ${{ steps.select-tests.outputs.mark_expression }}' --keep-models
run: tox run -e ${{ matrix.tox-environment }} -- -m 'not ${{ matrix.exclude-mark }} ${{ steps.select-test-stability.outputs.mark_expression }}' --keep-models
env:
AWS_ACCESS_KEY: "${{ secrets.AWS_ACCESS_KEY }}"
AWS_SECRET_KEY: "${{ secrets.AWS_SECRET_KEY }}"
GCP_ACCESS_KEY: "${{ secrets.GCP_ACCESS_KEY }}"
GCP_SECRET_KEY: "${{ secrets.GCP_SECRET_KEY }}"
CI_PACKED_CHARMS: ${{ needs.build.outputs.charms }}
SECRETS_FROM_GITHUB: |
{
"AWS_ACCESS_KEY": "${{ secrets.AWS_ACCESS_KEY }}",
"AWS_SECRET_KEY": "${{ secrets.AWS_SECRET_KEY }}",
"GCP_ACCESS_KEY": "${{ secrets.GCP_ACCESS_KEY }}",
"GCP_SECRET_KEY": "${{ secrets.GCP_SECRET_KEY }}",
}
4 changes: 0 additions & 4 deletions .github/workflows/lib-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ on:
- 'LICENSE'
- '**.md'
- 'renovate.json'
schedule:
- cron: '53 0 * * *' # Daily at 00:53 UTC
# Triggered on push to branch "main" by .github/workflows/release.yaml
workflow_call:

jobs:
lib-check:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ on:
- renovate.json
- poetry.lock
- pyproject.toml
- '.github/**.md'
- '.github/workflows/ci.yaml'
- '.github/workflows/lib-check.yaml'

Expand All @@ -21,6 +20,8 @@ jobs:
name: Tests
uses: ./.github/workflows/ci.yaml
secrets: inherit
permissions:
actions: write # Needed to manage GitHub Actions cache

release-libraries:
name: Release libraries
Expand All @@ -41,14 +42,14 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v2
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v5.1.2

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v2
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v5.1.2
with:
channel: 14/edge
artifact-name: ${{ needs.build.outputs.artifact-name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sync_issue_to_jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
jobs:
sync:
name: Sync GitHub issue to Jira
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@f398b1deef66493fc2018625bcbfa0078b8627bc # v5
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v5.1.2
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ build/
.coverage
__pycache__/
*.py[cod]
requirements.txt
requirements-last-build.txt

# PyCharm project folder.
.idea/
7 changes: 7 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ bases:
channel: "22.04"
parts:
charm:
override-pull: |
craftctl default
if [[ ! -f requirements.txt ]]
then
echo 'ERROR: Use "tox run -e build" instead of calling "charmcraft pack" directly' >&2
exit 1
fi
build-packages:
- libffi-dev
- libssl-dev
Expand Down
4 changes: 2 additions & 2 deletions lib/charms/postgresql_k8s/v0/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 18
LIBPATCH = 19

INVALID_EXTRA_USER_ROLE_BLOCKING_MESSAGE = "invalid role(s) for extra user roles"

Expand Down Expand Up @@ -514,7 +514,7 @@ def build_postgresql_parameters(
)
if profile == "production":
# Use 25% of the available memory for shared_buffers.
# and the remaind as cache memory.
# and the remaining as cache memory.
shared_buffers = int(available_memory * 0.25)
effective_cache_size = int(available_memory - shared_buffers)
parameters.setdefault("shared_buffers", f"{int(shared_buffers/10**6)}MB")
Expand Down
Loading