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

Charm review PR #34

Open
wants to merge 1 commit into
base: charm-review-base
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 18 additions & 0 deletions .github/.jira_sync_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# From https://github.com/canonical/gh-jira-sync-bot#client-side-configuration
settings:
jira_project_key: "IAM"
status_mapping:
opened: Untriaged
closed: done
components:
- GLAuth
labels:
- bug
- enhancement
add_gh_comment: true
sync_description: true
sync_comments: true
epic_key: "IAM-471"
label_mapping:
enhancement: Story
bug: Bug
24 changes: 24 additions & 0 deletions .github/workflows/on_pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: On Pull Request

on:
pull_request:

jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v4 is already out. You might wanna update this.


- 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
19 changes: 19 additions & 0 deletions .github/workflows/on_push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: On Push

on:
push:
branches:
- main
- track/**

jobs:
tests:
name: Run Tests
uses: ./.github/workflows/tests.yaml

publish-charm:
name: Publish Charm
needs: tests
uses: ./.github/workflows/publish.yaml
secrets:
CHARMCRAFT_CREDENTIALS: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
15 changes: 15 additions & 0 deletions .github/workflows/on_schedule.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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 }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}

tests:
name: Run Tests
uses: ./.github/workflows/tests.yaml
25 changes: 25 additions & 0 deletions .github/workflows/promote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Promote Charm

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above.

- name: Release charm to channel
uses: canonical/charming-actions/release-charm@2.3.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.4.0 is available.

with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
destination-channel: ${{ github.event.inputs.destination-channel }}
origin-channel: ${{ github.event.inputs.origin-channel }}
58 changes: 58 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish Charm

on:
workflow_call:
inputs:
source_branch:
description: source branch to publish
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: source branch to publish
required: false
default: ''
type: string

jobs:
publish-charm:
name: Publish Charm
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might wanna consider configuring Dependabot to automatically update the versions for you.

with:
fetch-depth: 0
ref: ${{ inputs.source_branch }}

- name: Select CharmHub channel
uses: canonical/charming-actions/channel@2.3.0
id: select-channel
if: ${{ inputs.destination_channel == '' }}

- 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/upload-charm@2.3.0
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
channel: ${{ steps.parse-inputs.outputs.destination_channel }}
23 changes: 23 additions & 0 deletions .github/workflows/release_libs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release Charm Library

on:
push:
branches:
- main
paths:
- "lib/charms/glauth_k8s/**"

jobs:
release-libs:
name: Release charm library
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Release charm library
uses: canonical/charming-actions/release-libraries@main
with:
credentials: ${{ secrets.CHARMCRAFT_CREDENTIALS }}
github-token: ${{ secrets.GITHUB_TOKEN }}
55 changes: 55 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run Tests

on:
workflow_dispatch:
workflow_call:

jobs:
unit-test:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

- 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.28-strict/stable
juju-channel: 3.2
bootstrap-options: '--agent-version=3.2.0'

- name: Run integration tests
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 container logs
run: kubectl logs glauth-k8s-0 -c glauth -n testing
if: failure()
51 changes: 51 additions & 0 deletions .github/workflows/update_libs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# reusable workflow for checking library versions and opening PRs to bump
name: Update Charm Libraries

on:
workflow_call:
inputs:
charmcraft_channel:
description: Channel from which to install charmcraft
default: 'latest/candidate'
required: false
type: string
secrets:
CHARMCRAFT_CREDENTIALS:
required: true
PAT_TOKEN:
required: true
workflow_dispatch:
inputs:
charmcraft_channel:
description: Channel from which to install charmcraft
default: 'latest/candidate'
required: false
type: string

jobs:
update-libs:
name: Update charm libraries
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0

- run: sudo snap install charmcraft --channel ${{ inputs.charmcraft_channel }} --classic

- name: update charm libs
run: charmcraft fetch-lib
env:
CHARMCRAFT_AUTH: ${{ secrets.CHARMCRAFT_CREDENTIALS }}

- name: Create Pull Request
id: create-pull-request
uses: canonical/create-pull-request@main
with:
github-token: ${{ secrets.PAT_TOKEN }}
commit-message: Update charm libs
branch-name: 'automated-update-charm-libs'
title: (Automated) Update Charm Libs
body: Update charm libs
upsert: true
ignore-no-changes: true
Loading
Loading