Skip to content

Commit

Permalink
[DPE-4189] Fix TLS double-restart + update charm components - move to…
Browse files Browse the repository at this point in the history
… DP lib (#244)

* Upgrade dependencies

* fix tests

* fix tests

* fix tests

* add self-signed-certificates

* fix users initialisation

* fix users initialisation

* fix users initialisation

* fix users initialisation

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* update CI libs

* fix tox tasks

* fix tox tasks

* fix tox tasks

* Added missing group mark

* Added pytest asyncio

* added conftests + fixed paths

* Added logs

* revert

* updated data interfaces client applications

* removed trailing slash

* fixed app charm path

* removed unnecessary restart on TLS cert available +

* move user init code out of repl set init code

* fix user of db_intialised

* fix unit tests

* remove check for repl set initialised in init users

* fix use of self.db_initialised and update unit tests

* Update ci.yaml

* mock tenacity to shorten unit test time

* remove print

* bumped dp worfklows lib

* fix tox

* fix jira sync

* uncommented unit test in CI

* Update .github/workflows/ci.yaml

Co-authored-by: Carl Csaposs <carl.csaposs@canonical.com>

* Update .github/workflows/ci.yaml

Co-authored-by: Carl Csaposs <carl.csaposs@canonical.com>

* Update tox.ini

Co-authored-by: Carl Csaposs <carl.csaposs@canonical.com>

* PR feedback

* PR feedback

* Update libs

* Update .github/workflows/ci.yaml

Co-authored-by: Carl Csaposs <carl.csaposs@canonical.com>

* Update libs

* juju version as a variable

* pr feedback

* pr feedback

* env variables

* env variables removal

* env variables removal

* env variables removal

* Update .gitignore

Co-authored-by: Carl Csaposs <carl.csaposs@canonical.com>

* removed bcrypt

* removed bcrypt

---------

Co-authored-by: Mia Altieri <mgaltier200@gmail.com>
Co-authored-by: Carl Csaposs <carl.csaposs@canonical.com>
  • Loading branch information
3 people committed May 6, 2024
1 parent a9b5c96 commit 015a5de
Show file tree
Hide file tree
Showing 41 changed files with 7,546 additions and 3,377 deletions.
127 changes: 45 additions & 82 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,120 +3,83 @@
name: Tests

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true

on:
pull_request:
schedule:
- cron: "53 0 * * *" # Daily at 00:53 UTC
- cron: '53 0 * * *' # Daily at 00:53 UTC
# Triggered on push to branch "main" by .github/workflows/release.yaml
workflow_call:

jobs:
lint:
name: Lint
uses: canonical/data-platform-workflows/.github/workflows/lint.yaml@v13.1.2

lib-check:
name: Check libraries
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
- 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
with:
fetch-depth: 0
- run: |
# Workaround for https://github.com/canonical/charmcraft/issues/1389#issuecomment-1880921728
touch requirements.txt
- name: Check libs
uses: canonical/charming-actions/check-libraries@2.4.0
with:
credentials: ${{ secrets.CHARMHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
use-labels: false
fail-build: ${{ github.event_name == 'pull_request' }}

unit-test:
name: Unit tests
name: Unit test charm
runs-on: ubuntu-latest
timeout-minutes: 25 # TODO: reduce to 5 minutes
steps:
- name: Checkout
uses: actions/checkout@v3
- 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@v4
- name: Install tox & poetry
run: |
pipx install tox
pipx install poetry
- name: Run tests
run: tox run -e unit

build:
name: Build charm | ${{ matrix.path }}
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.2
strategy:
fail-fast: true
matrix:
charms: [".", "tests/integration/ha_tests/application_charm", "tests/integration/relation_tests/application-charm"]
name: Build ${{matrix.charms}} charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v8
path:
- .
- tests/integration/ha_tests/application_charm
- tests/integration/relation_tests/application-charm
with:
charmcraft-snap-revision: 1349
path-to-charm-directory: ${{matrix.charms}}
cache: true
path-to-charm-directory: ${{ matrix.path }}

integration-test:
strategy:
fail-fast: false
matrix:
tox-environments:
- charm-integration
- ha-integration
- tls-integration
- metrics-integration
name: ${{ matrix.tox-environments }}
name: Integration test charm | 3.1.7
needs:
- lint
- unit-test
- build
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup operator environment
# TODO: Replace with custom image on self-hosted runner
uses: charmed-kubernetes/actions-operator@main
with:
provider: microk8s
channel: "1.27-strict/stable"
bootstrap-constraints: "cores=2 mem=2G"
juju-channel: 3.1/stable
bootstrap-options: "--agent-version 3.1.6"
- name: Download packed charm(s)
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.artifact-name }}
- name: Check juju version
run: |
echo $(juju --version)
- name: Free disk space
run: |
echo "Free disk space before cleanup"
df -T
# free space in the runner
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Free disk space after cleanup"
df -T
- name: Select tests
id: select-tests
run: |
if [ "${{ github.event_name }}" == "schedule" ]
then
echo Running unstable and stable tests
echo "mark_expression=" >> $GITHUB_OUTPUT
else
echo Skipping unstable tests
echo "mark_expression=not unstable" >> $GITHUB_OUTPUT
fi
- name: Run integration tests
# set a predictable model name so it can be consumed by charm-logdump-action
run: sg snap_microk8s -c "tox run -e ${{ matrix.tox-environments }} -- --model testing -m '${{ steps.select-tests.outputs.mark_expression }}'"
env:
CI_PACKED_CHARMS: ${{ needs.build.outputs.charms }}

- name: Dump logs
uses: canonical/charm-logdump-action@main
if: failure()
with:
app: mongodb-k8s
model: testing
uses: canonical/data-platform-workflows/.github/workflows/integration_test_charm.yaml@v13.1.2
with:
artifact-prefix: packed-charm-cache-true
cloud: microk8s
microk8s-snap-channel: 1.29-strict/stable
juju-agent-version: 3.1.7
secrets:
integration-test: |
{ "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 }}", }
13 changes: 5 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ jobs:
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check libs
uses: canonical/charming-actions/check-libraries@2.3.0
uses: canonical/charming-actions/check-libraries@2.4.0
with:
# FIXME: CHARMHUB_TOKEN will expire in 2024-01-20
# NOTE: CHARMHUB_TOKEN is only allowed in latest/edge, latest/candidate
credentials: "${{ secrets.CHARMHUB_TOKEN }}"
github-token: "${{ secrets.GITHUB_TOKEN }}"
Expand All @@ -30,19 +29,17 @@ jobs:

build:
name: Build charm
uses: canonical/data-platform-workflows/.github/workflows/build_charm_without_cache.yaml@v8
with:
charmcraft-snap-channel: "latest/edge"
uses: canonical/data-platform-workflows/.github/workflows/build_charm.yaml@v13.1.2

release:
name: Release charm
needs:
- ci-tests
- build
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v8
uses: canonical/data-platform-workflows/.github/workflows/release_charm.yaml@v13.1.2
with:
channel: 6/edge
artifact-name: ${{ needs.build.outputs.artifact-name }}
artifact-prefix: ${{ needs.build.outputs.artifact-prefix }}
secrets:
charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
permissions:
Expand Down
4 changes: 2 additions & 2 deletions .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@v8
uses: canonical/data-platform-workflows/.github/workflows/sync_issue_to_jira.yaml@v13.1.2
with:
jira-base-url: https://warthogs.atlassian.net
jira-project-key: DPE
Expand All @@ -18,4 +18,4 @@ jobs:
jira-api-token: ${{ secrets.JIRA_API_TOKEN }}
jira-user-email: ${{ secrets.JIRA_USER_EMAIL }}
permissions:
issues: write # Needed to create GitHub issue comment
issues: write # Needed to create GitHub issue comment
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ pyvenv.cfg
share/
.idea/
.tox/

/requirements.txt
/requirements-last-build.txt
Loading

0 comments on commit 015a5de

Please sign in to comment.