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

Feat/release and promote hw observer #22

Merged
merged 1 commit into from
Jun 5, 2024
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/terraform-apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
repository:
# The naming of the files should be $REPO_$BRANCH.tfvars
- charmed-openstack-upgrader_main
- hardware-observer-operator_main
steps:
- name: Checkout branch
uses: actions/checkout@v4
Expand Down
22 changes: 22 additions & 0 deletions terraform-plans/configs/hardware-observer-operator_main.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
repository = "hardware-observer-operator"
branch = "main"
repository_description = "A charm to setup prometheus exporter for IPMI, RedFish and RAID devices from different vendors."
workflow_files = {
codeowners = {
source = "./files/github/CODEOWNERS"
destination = ".github/CODEOWNERS"
variables = {}
}
promote = {
source = "./files/github/charm_promote.yaml"
destination = ".github/workflows/promote.yaml"
variables = {}
}
release = {
source = "./files/github/charm_release.yaml"
destination = ".github/workflows/release.yaml"
variables = {
branch = "main"
}
}
}
25 changes: 25 additions & 0 deletions terraform-plans/files/github/charm_promote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Promote charm to other tracks and channels
samuelallan72 marked this conversation as resolved.
Show resolved Hide resolved

on:
workflow_dispatch:
inputs:
destination-channel:
description: 'Destination Channel, e.g. latest/candidate'
required: true
origin-channel:
description: 'Origin Channel, e.g. latest/edge'
required: true

jobs:
promote-charm:
name: Promote charm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Release charm to channel
uses: canonical/charming-actions/[email protected]
with:
credentials: $${{ secrets.CHARMHUB_TOKEN }}
github-token: $${{ secrets.GITHUB_TOKEN }}
destination-channel: $${{ github.event.inputs.destination-channel }}
origin-channel: $${{ github.event.inputs.origin-channel }}
29 changes: 29 additions & 0 deletions terraform-plans/files/github/charm_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release to Edge

on:
push:
branches: [ ${vars.branch} ]
release:
types: [ published ]

jobs:
check:
uses: ./.github/workflows/check.yaml
secrets: inherit

release:
needs: check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize lxd # This should dropped once it's implemented on charming-actions itself. https://github.com/canonical/charming-actions/issues/140
uses: canonical/[email protected]
- name: Upload charm to charmhub
uses: canonical/charming-actions/[email protected]
with:
credentials: "$${{ secrets.CHARMHUB_TOKEN }}"
github-token: "$${{ secrets.GITHUB_TOKEN }}"
channel: "latest/edge"
# Note(rgildein): Right now we are not using destructive-mode, since our charmcraft.yaml is designed with a single build-on and the ability to run-on multiple bases. Running with destructive-mode would require aligning the base defined in this job with the one defined in charmcraft.yaml (build-on).
destructive-mode: false
2 changes: 1 addition & 1 deletion terraform-plans/modules/GitHub/workflows/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ locals {
locals {
changed_files = {
for file_key, file_info in var.workflow_files : file_key => file_info
if file(file_info.source) != local.repository_files_content[file_info.destination]
if templatefile(file_info.source, { vars = file_info.variables }) != local.repository_files_content[file_info.destination]
}
}

Expand Down