-
Notifications
You must be signed in to change notification settings - Fork 135
fix: cherry-pick fixes from main into the 2.23-maintenance branch #2588
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
base: 2.23-maintenance
Are you sure you want to change the base?
Changes from all commits
434bc3b
55b552b
0221cc5
f83ad82
253d811
206115b
b98d64d
40d1936
5a7cdea
4cc0f79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Build Operator Wheels | ||
|
|
||
| on: | ||
| workflow_call: | ||
| outputs: | ||
| artifact-name: | ||
| description: "Name of the artifact containing the wheels" | ||
| value: ${{ jobs.build-wheels.outputs.artifact-name }} | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| build-wheels: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| artifact-name: ${{ steps.artifact-name.outputs.name }} | ||
| steps: | ||
| - name: Checkout the operator repository | ||
| uses: actions/checkout@v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 | ||
|
|
||
| - name: Build wheels | ||
| run: uv build --all | ||
|
|
||
| - name: Set artifact name | ||
| id: artifact-name | ||
| run: echo "name=operator-wheels-${{ github.sha }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Upload wheels as artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ${{ steps.artifact-name.outputs.name }} | ||
| path: dist/*.whl | ||
| retention-days: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,49 +6,70 @@ on: | |
| - main | ||
| pull_request: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| build-wheels: | ||
| uses: ./.github/workflows/_build-wheels.yaml | ||
|
|
||
| db-charm-tests: | ||
| runs-on: ubuntu-latest | ||
| needs: build-wheels | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - charm-repo: canonical/postgresql-operator | ||
| commit: 33ca7f308fa4289cdf45ceefcb335f373713431d # 2025-06-21T22:22:22Z | ||
| - charm-repo: canonical/postgresql-k8s-operator | ||
| commit: a6753b27440a17ed5f37d4c2c5c6f53b1d3a1f7f # 2025-06-22T11:27:17Z | ||
| commit: c434df80953409f290e7ea6e76f78a3ec46cecc2 # 2026-05-30T03:35:40Z | ||
| - charm-repo: canonical/mysql-operator | ||
| commit: 411fb45ecfe200d22b46af9cbacaf72e8eb09da7 # 2025-06-23T14:51:47Z | ||
| - charm-repo: canonical/mysql-k8s-operator | ||
| commit: 7b5775c9d07fd32c4453d93dfc51cf1b4d6c8024 # rev257 rev256 2025-06-23T15:19:19Z | ||
| steps: | ||
| - name: Checkout the ${{ matrix.charm-repo }} repository | ||
| uses: actions/checkout@v4 | ||
| uses: actions/checkout@v6.0.2 | ||
| with: | ||
| repository: ${{ matrix.charm-repo }} | ||
| persist-credentials: false | ||
| ref: ${{ matrix.commit }} | ||
|
|
||
| - name: Checkout the operator repository | ||
| uses: actions/checkout@v4 | ||
| - name: Download operator wheels | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| path: myops | ||
| persist-credentials: false | ||
| name: ${{ needs.build-wheels.outputs.artifact-name }} | ||
| path: operator-wheels | ||
|
|
||
| - name: Install patch dependencies | ||
| run: pip install poetry~=2.0 | ||
|
|
||
| - name: Update 'ops' dependency in test charm to latest | ||
| run: | | ||
| ops_wheel="$(ls operator-wheels/ops-[0-9]*.whl)" | ||
| ops_tracing_wheel="$(ls operator-wheels/ops_tracing-*.whl)" | ||
| if [ -e "requirements.txt" ]; then | ||
| sed -i -e "/^ops[ ><=]/d" -e "/canonical\/operator/d" -e "/#egg=ops/d" requirements.txt | ||
| echo -e "\ngit+$GITHUB_SERVER_URL/$GITHUB_REPOSITORY@$GITHUB_SHA#egg=ops" >> requirements.txt | ||
| echo -e "\n${ops_wheel}" >> requirements.txt | ||
| else | ||
| sed -i -e "s/^ops[ ><=].*/ops = {path = \"myops\"}/" pyproject.toml | ||
| poetry lock | ||
| # The charm may declare ops with the 'tracing' extra, which pulls in | ||
| # ops-tracing from PyPI. Replacing ops with a local wheel drops the | ||
| # extra, so install the matching ops-tracing wheel explicitly when | ||
| # the charm asked for it. Check before `poetry remove`, which | ||
| # strips the ops line from pyproject.toml. | ||
| if grep -qE 'ops[^a-z]+=.*tracing|ops\[[^]]*tracing' pyproject.toml; then | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to double check my understanding, the first sub pattern matches something like while the second pattern matches
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's right. The first alternative ( (I wish all the poetry usage would go away, but some people really like it.) |
||
| wants_tracing=1 | ||
| else | ||
| wants_tracing=0 | ||
| fi | ||
| poetry remove ops --lock | ||
| if [ "${wants_tracing}" = "1" ]; then | ||
| poetry add "${ops_wheel}" "${ops_tracing_wheel}" --lock | ||
| else | ||
| poetry add "${ops_wheel}" --lock | ||
| fi | ||
| fi | ||
|
|
||
| - name: Install dependencies | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the pattern for
ops_tracingwheel is more relaxed compared toops_wheelhere?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
[0-9]inops-[0-9]*.whlis defensive: without it, the glob would also match anything starting withops-(for example a futureops-tools-*.whl). Wheel filenames normalise-to_in the package portion, soops_tracing-*.whlalready can't be matched byops-*— there's no similarly-named package to disambiguate against, so the looser pattern is fine.