From 0fc474446cbd84bc0c7a74f7cd0b7ae8c6eb172b Mon Sep 17 00:00:00 2001 From: Chi Wai Chan Date: Mon, 3 Jun 2024 15:42:28 +0800 Subject: [PATCH] testing --- .github/workflows/terraform-apply.yaml | 1 + .../charmed-openstack-upgrader_3.x.tfvars | 2 +- .../charmed-openstack-upgrader_main.tfvars | 2 +- .../hardware-observer-operator_main.tfvars | 2 +- .../openstack-exporter-operator_main.tfvars | 21 +++++++++++++++++++ .../modules/GitHub/workflows/main.tf | 8 +++---- 6 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 terraform-plans/configs/openstack-exporter-operator_main.tfvars diff --git a/.github/workflows/terraform-apply.yaml b/.github/workflows/terraform-apply.yaml index be0bfdf..33aa6d4 100644 --- a/.github/workflows/terraform-apply.yaml +++ b/.github/workflows/terraform-apply.yaml @@ -23,6 +23,7 @@ jobs: repository: - hardware-observer-operator_main - charmed-openstack-upgrader_main + - openstack-exporter-operator_main # The snapcraft channel for 3.x is not ready # - charmed-openstack-upgrader_3.x steps: diff --git a/terraform-plans/configs/charmed-openstack-upgrader_3.x.tfvars b/terraform-plans/configs/charmed-openstack-upgrader_3.x.tfvars index 4844c3c..a7d2376 100644 --- a/terraform-plans/configs/charmed-openstack-upgrader_3.x.tfvars +++ b/terraform-plans/configs/charmed-openstack-upgrader_3.x.tfvars @@ -14,7 +14,7 @@ workflow_files = { release = { source = "./files/github/snap_release.yaml" destination = ".github/workflows/release.yaml" - variables = { + variables = { branch = "3.x" } } diff --git a/terraform-plans/configs/charmed-openstack-upgrader_main.tfvars b/terraform-plans/configs/charmed-openstack-upgrader_main.tfvars index b01e6f9..596655e 100644 --- a/terraform-plans/configs/charmed-openstack-upgrader_main.tfvars +++ b/terraform-plans/configs/charmed-openstack-upgrader_main.tfvars @@ -14,7 +14,7 @@ workflow_files = { release = { source = "./files/github/snap_release.yaml" destination = ".github/workflows/release.yaml" - variables = { + variables = { branch = "main" } } diff --git a/terraform-plans/configs/hardware-observer-operator_main.tfvars b/terraform-plans/configs/hardware-observer-operator_main.tfvars index 8c91535..bacecad 100644 --- a/terraform-plans/configs/hardware-observer-operator_main.tfvars +++ b/terraform-plans/configs/hardware-observer-operator_main.tfvars @@ -14,7 +14,7 @@ workflow_files = { release = { source = "./files/github/charm_release.yaml" destination = ".github/workflows/release.yaml" - variables = { + variables = { branch = "main" } } diff --git a/terraform-plans/configs/openstack-exporter-operator_main.tfvars b/terraform-plans/configs/openstack-exporter-operator_main.tfvars new file mode 100644 index 0000000..a450159 --- /dev/null +++ b/terraform-plans/configs/openstack-exporter-operator_main.tfvars @@ -0,0 +1,21 @@ +repository = "openstack-exporter-operator" +branch = "main" +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" + } + } +} diff --git a/terraform-plans/modules/GitHub/workflows/main.tf b/terraform-plans/modules/GitHub/workflows/main.tf index 69e1d49..2c1b43b 100644 --- a/terraform-plans/modules/GitHub/workflows/main.tf +++ b/terraform-plans/modules/GitHub/workflows/main.tf @@ -23,7 +23,7 @@ resource "random_string" "update_uid" { locals { repo_files = flatten([ for file_key, file_info in var.workflow_files : { - file = file_info.destination + file = file_info.destination source = file_info.source } ]) @@ -44,7 +44,7 @@ data "github_repository_file" "files" { locals { repository_files_content = { for file_key, file_info in var.workflow_files : file_info.destination => - try(data.github_repository_file.files["${file_info.destination}"].content, "") + try(data.github_repository_file.files["${file_info.destination}"].content, "") } } @@ -52,7 +52,7 @@ locals { locals { changed_files = { for file_key, file_info in var.workflow_files : file_key => file_info - if templatefile(file_info.source, {vars = file_info.variables}) != local.repository_files_content[file_info.destination] + if templatefile(file_info.source, { vars = file_info.variables }) != local.repository_files_content[file_info.destination] } } @@ -72,7 +72,7 @@ resource "github_repository_file" "workflows_files" { repository = var.repository branch = github_branch.workflows_branch[0].branch file = each.value.destination - content = templatefile(each.value.source, {vars = each.value.variables}) + content = templatefile(each.value.source, { vars = each.value.variables }) commit_message = "update ${each.value.destination}" overwrite_on_create = true