-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: base draft charm for gauth-k8s, draft charm-lib
- Loading branch information
0 parents
commit 3979fd9
Showing
31 changed files
with
9,067 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Bug Report | ||
description: File a bug report | ||
labels: ["Type: Bug", "Status: Triage"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: > | ||
Thanks for taking the time to fill out this bug report! Before submitting your issue, please make | ||
sure you are using the latest version of the charm. If not, please switch to this image prior to | ||
posting your report to make sure it's not already solved. | ||
- type: textarea | ||
id: bug-description | ||
attributes: | ||
label: Bug Description | ||
description: > | ||
If applicable, add screenshots to help explain the problem you are facing. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: reproduction | ||
attributes: | ||
label: To Reproduce | ||
description: > | ||
Please provide a step-by-step instruction of how to reproduce the behavior. | ||
placeholder: | | ||
1. `juju deploy ...` | ||
2. `juju relate ...` | ||
3. `juju status --relations` | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: environment | ||
attributes: | ||
label: Environment | ||
description: > | ||
We need to know a bit more about the context in which you run the charm. | ||
- Are you running Juju locally, on lxd, in multipass or on some other platform? | ||
- What track and channel you deployed the charm from (ie. `latest/edge` or similar). | ||
- Version of any applicable components, like the juju snap, the model controller, lxd, microk8s, and/or multipass. | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: logs | ||
attributes: | ||
label: Relevant log output | ||
description: > | ||
Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. | ||
Fetch the logs using `juju debug-log --replay` and `kubectl logs ...`. Additional details available in the juju docs | ||
at https://juju.is/docs/olm/juju-logs | ||
render: shell | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: additional-context | ||
attributes: | ||
label: Additional context | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Enhancement Proposal | ||
description: File an enhancement proposal | ||
labels: ["Type: Enhancement", "Status: Triage"] | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: > | ||
Thanks for taking the time to fill out this enhancement proposal! Before submitting your issue, please make | ||
sure there isn't already a prior issue concerning this. If there is, please join that discussion instead. | ||
- type: textarea | ||
id: enhancement-proposal | ||
attributes: | ||
label: Enhancement Proposal | ||
description: > | ||
Describe the enhancement you would like to see in as much detail as needed. | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: On Pull Request | ||
|
||
# On pull_request, we: | ||
# * always run lint checks | ||
# * always run tests | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: python3 -m pip install tox | ||
|
||
- name: Run linters | ||
run: tox -e lint | ||
|
||
tests: | ||
name: Run Tests | ||
needs: | ||
- lint | ||
uses: ./.github/workflows/tests.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: On Push | ||
|
||
# On push to a "special" branch, we: | ||
# * always publish to charmhub at latest/edge/branchname | ||
# * always run tests | ||
# where a "special" branch is one of main/master or track/**, as | ||
# by convention these branches are the source for a corresponding | ||
# charmhub edge channel. | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- track/** | ||
|
||
jobs: | ||
tests: | ||
name: Run Tests | ||
uses: ./.github/workflows/tests.yaml | ||
|
||
# publish runs in series with tests, and only publishes if tests passes | ||
publish-charm: | ||
name: Publish Charm | ||
needs: tests | ||
uses: ./.github/workflows/publish.yaml | ||
secrets: | ||
CHARMCRAFT_CREDENTIALS: ${{ secrets.CHARMCRAFT_CREDENTIALS }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: | ||
schedule: | ||
- cron: '0 8 * * MON' | ||
|
||
jobs: | ||
update-charm-libs: | ||
name: Update Charm Libraries | ||
uses: ./.github/workflows/update_libs.yaml | ||
secrets: | ||
CHARMCRAFT_CREDENTIALS: ${{ secrets.CHARMCRAFT_CREDENTIALS }} | ||
|
||
update-deps: | ||
name: Update Dependencies | ||
uses: ./.github/workflows/renovate.yaml | ||
|
||
tests: | ||
name: Run Tests | ||
uses: ./.github/workflows/tests.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# reusable workflow for publishing all charms in this repo | ||
name: Publish | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
source_branch: | ||
description: Github branch from this repo to publish. If blank, will use the default branch | ||
default: '' | ||
required: false | ||
type: string | ||
secrets: | ||
CHARMCRAFT_CREDENTIALS: | ||
required: true | ||
|
||
workflow_dispatch: | ||
inputs: | ||
destination_channel: | ||
description: CharmHub channel to publish to | ||
required: false | ||
default: 'latest/edge' | ||
type: string | ||
source_branch: | ||
description: Github branch from this repo to publish. If blank, will use the default branch | ||
required: false | ||
default: '' | ||
type: string | ||
|
||
jobs: | ||
publish-charm: | ||
name: Publish Charm | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ inputs.source_branch }} | ||
|
||
- name: Select charmhub channel | ||
uses: canonical/charming-actions/[email protected] | ||
id: select-channel | ||
if: ${{ inputs.destination_channel == '' }} | ||
|
||
# Combine inputs from different sources to a single canonical value so later steps don't | ||
# need logic for picking the right one | ||
- name: Parse and combine inputs | ||
id: parse-inputs | ||
run: | | ||
# destination_channel | ||
destination_channel="${{ inputs.destination_channel || steps.select-channel.outputs.name }}" | ||
echo "setting output of destination_channel=$destination_channel" | ||
echo "::set-output name=destination_channel::$destination_channel" | ||
- name: Upload charm to charmhub | ||
uses: canonical/charming-actions/[email protected] | ||
with: | ||
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
channel: ${{ steps.parse-inputs.outputs.destination_channel }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# reusable workflow triggered manually | ||
name: Release charm to other tracks and channels | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
destination-channel: | ||
description: 'Destination Channel' | ||
required: true | ||
origin-channel: | ||
description: 'Origin Channel' | ||
required: true | ||
|
||
jobs: | ||
promote-charm: | ||
name: Promote charm | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Release charm to channel | ||
uses: canonical/charming-actions/[email protected] | ||
with: | ||
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
destination-channel: ${{ github.event.inputs.destination-channel }} | ||
origin-channel: ${{ github.event.inputs.origin-channel }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Release charm's libraries if they have changed | ||
name: Release Libraries | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "lib/charms/glauth_k8s/**" | ||
|
||
jobs: | ||
release-libs: | ||
name: Release any bumped library | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Release any bumped charm library | ||
uses: canonical/charming-actions/release-libraries@main | ||
with: | ||
credentials: "${{ secrets.CHARMCRAFT_CREDENTIALS }}" | ||
github-token: "${{ github.token }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# workflow for checking package versions and opening PRs to bump | ||
name: Renovate | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
renovate: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: List | ||
run: ls -la | ||
|
||
- name: Self-hosted Renovate | ||
uses: renovatebot/[email protected] | ||
with: | ||
configurationFile: renovate-config.js | ||
token: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Tests | ||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
unit-test: | ||
name: Unit tests | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: python -m pip install tox | ||
|
||
- name: Run tests | ||
run: tox -e unit | ||
|
||
integration-test-microk8s: | ||
name: Integration tests (microk8s) | ||
runs-on: ubuntu-22.04 | ||
needs: | ||
- unit-test | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup operator environment | ||
uses: charmed-kubernetes/actions-operator@main | ||
with: | ||
provider: microk8s | ||
channel: 1.26-strict/stable | ||
juju-channel: 3.2 | ||
bootstrap-options: '--agent-version=3.2.0' | ||
|
||
- name: Run integration tests | ||
# set a predictable model name so it can be consumed by charm-logdump-action | ||
run: tox -e integration -- --model testing | ||
|
||
- name: Get contexts | ||
run: kubectl config view | ||
if: failure() | ||
|
||
- name: Get juju status | ||
run: juju status --relations | ||
if: failure() | ||
|
||
- name: Get juju logs | ||
run: juju debug-log --replay --include unit-glauth-k8s-0 | ||
if: failure() | ||
|
||
- name: Get glauth-k8s container logs | ||
run: kubectl logs glauth-k8s-0 -c glauth-k8s -n testing | ||
if: failure() | ||
|
||
# Hack to overcome lack of tools (cat, tar) in the workload container | ||
- name: Get glauth config file | ||
run: | | ||
juju ssh glauth-k8s/0 "PYTHONPATH=agents/unit-glauth-k8s-0/charm/venv/ python3 -c ' | ||
from ops import pebble | ||
p = pebble.Client(\"/charm/containers/glauth-k8s/pebble.socket\") | ||
f = p.pull(\"/etc/config/glauth.cfg\") | ||
print(f.read()) | ||
'" | ||
if: failure() |
Oops, something went wrong.