Skip to content

DA178 phase 1 design #313

@NohaIhab

Description

@NohaIhab

Automation design for Phase 1 of DA178 - Frequent stable release infrastructure MVP
Designed in collaboration with @carlcsaposs-canonical thank you for the extensive support!

Usage (of reusable workflows, in caller repositories)

Add promote_to_candidate.yaml file to .github/workflows

name: Promote charms to candidate

on:
  workflow_dispatch:
  schedule:
    - cron: '43 0 * * 2'  # Every Tuesday at 00:43 UTC

jobs:
  refine-cron:
    name: Limit cron to every 6 weeks
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - name: Check if week number is multiple of 6
        id: check
        shell: python
        run: |
          import datetime
          import json
          import os

          if "${{ github.event_name }}" == "workflow_dispatch":
              run_workflow = True
          else:
              week = datetime.date.today().isocalendar().week
              print(f"{week=}")
              run_workflow = week % 6 == 0
          output = f"run_workflow={json.dumps(run_workflow)}"

          print(output)
          with open(os.environ["GITHUB_OUTPUT"], "a") as file:
              file.write(output)
    outputs:
      run-workflow: ${{ steps.check.outputs.run_workflow }}
  
  promote:
    name: Promote charms to candidate
    if: ${{ fromJSON(needs.refine-cron.outputs.run-workflow) }}
    needs:
      - refine-cron
    uses: canonical/data-platform-workflows/.github/workflows/_promote_charms_to_candidate.yaml@v0.0.0
    with:
      mattermost-usernames-release-notes-editors: janedoe,johndoe
      mattermost-usernames-engineering-managers: janedoe,johndoe
      mattermost-usernames-product-managers: janedoe,johndoe
    secrets:
      charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
      mattermost-bot-token: ${{ secrets.MATTERMOST_BOT_TOKEN }}
    permissions:
      contents: write  # Needed to create GitHub release
      issues: write  # Needed to create GitHub issue

Add promote_to_stable.yaml file to .github/workflows

name: Promote charms to stable

on:
  issues:
    types:
      - labeled

jobs:
  promote:
    name: Promote charms to stable
    uses: canonical/data-platform-workflows/.github/workflows/_promote_charms_to_stable.yaml@v0.0.0
    secrets:
      charmhub-token: ${{ secrets.CHARMHUB_TOKEN }}
    permissions:
      contents: write  # Needed to publish GitHub release
      issues: write  # Needed to edit GitHub issue

Interface of reusable workflows

_promote_charms_to_candidate.yaml

on:
  workflow_call:
    inputs:
      mattermost-usernames-release-notes-editors:
        description: Comma separated list of Mattermost usernames to notify to edit release notes (e.g. "janedoe,johndoe")
        required: true
        type: string
      mattermost-usernames-engineering-managers:
        description: Comma separated list of Mattermost usernames to notify to approve stable release as engineering manager (e.g. "janedoe,johndoe")
        required: true
        type: string
      mattermost-usernames-product-managers:
        description: Comma separated list of Mattermost usernames to notify to approve stable release as product manager (e.g. "janedoe,johndoe")
        required: true
        type: string
      charmcraft-snap-revision:
        description: charmcraft snap revision
        required: false
        type: string
      charmcraft-snap-channel:
        description: |
          charmcraft snap channel

          Cannot be used if `charmcraft-snap-revision` input is passed
        required: false
        type: string
    secrets:
      charmhub-token:
        description: Charmhub login token
        required: true
      mattermost-bot-token:
        description: Mattermost bot user token
        required: true

_promote_charms_to_stable.yaml

on:
  workflow_call:
    inputs:
      charmcraft-snap-revision:
        description: charmcraft snap revision
        required: false
        type: string
      charmcraft-snap-channel:
        description: |
          charmcraft snap channel

          Cannot be used if `charmcraft-snap-revision` input is passed
        required: false
        type: string
    secrets:
      charmhub-token:
        description: Charmhub login token
        required: true

User experience

Every 6 weeks, for each branch with _promote_charms_to_candidate.yaml—or by manual workflow dispatch:

  • If the latest commit was not successfully released to edge, a Mattermost message will be sent:

    Failed to promote '16' branch to candidate—latest commit on '16' branch was not released to edge (with release_charm_edge.yaml). @taurus

  • Otherwise:
    • The latest commit will be released to candidate

    • A draft GitHub release with automatically generated release notes will be created

    • GitHub issue will be created

      Title

      Release v16/1.96.0 to stable

      Description

      Release notes: https://github.com/canonical/postgresql-operator/releases/tag/untagged-6948f3c292f75bb91ca7

      v16/1.96.0 will be automatically released to stable once these conditions are met:

      • this issue has stable: Solutions QA tests passed label
      • this issue has stable: release notes curated label
      • this issue has stable: product manager approved label
      • this issue has stable: engineering manager approved label
    • A Mattermost message will be sent:

      postgresql-operator v16/1.96.0 promoted to candidate.

      Promotion to stable pending: https://github.com/canonical/postgresql-operator/issues/0

      • @avgomes Please edit release notes & add label
      • @taurus Please add label after Solutions QA tests pass
      • @taurus Please add label to approve as engineering manager
      • @mwnsiri Please add label to approve as product manager

Once a GitHub issue has all the required labels:

GitHub issue labels

name
description
color

stable: Solutions QA tests passed
Solutions QA has approved stable release
#8717ff

stable: release notes curated
Release notes in draft GitHub release are ready to publish
#d5cfe1

stable: engineering manager approved
Engineering manager has approved stable release
#c5def5

stable: product manager approved
Product manager has approved stable release
#c2e0c6

Future improvements

  • Once the new Solutions QA API is available (that is replacing weebl), replace Solutions QA label with direct integration to Soltuions QA API
  • After stable release, close as not planned all open issues with a lower charm refresh compatibility version
  • Daily Mattermost message to remind people who haven't added the label they are responsible for
  • Phase 2 of DA178

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions