From e0844e96d5b1eeba4fa3f4165185b4a4d0996e92 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Wed, 1 Jun 2022 17:58:23 -0700 Subject: [PATCH 01/15] Updated workflows and stages to match current workflows Closes #7 Signed-off-by: Vamsy Sivaarcca --- .github/workflows/notify.yaml | 15 ++---- .github/workflows/publish-assets.yaml | 34 -------------- .github/workflows/publish-metadata.yaml | 12 +++++ .github/workflows/verify-pr.yaml | 18 ++++++++ .github/workflows/verify-workflow.yaml | 47 +++++++++++++++++++ .github/workflows/verify.yaml | 61 ++++--------------------- test/stages/stage0.tf | 21 +++++++++ 7 files changed, 113 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/publish-assets.yaml create mode 100644 .github/workflows/publish-metadata.yaml create mode 100644 .github/workflows/verify-pr.yaml create mode 100644 .github/workflows/verify-workflow.yaml diff --git a/.github/workflows/notify.yaml b/.github/workflows/notify.yaml index e41df19..482ae60 100644 --- a/.github/workflows/notify.yaml +++ b/.github/workflows/notify.yaml @@ -1,16 +1,11 @@ +name: Notify + on: release: types: [published] jobs: notify: - runs-on: ubuntu-latest - - steps: - - name: Publish repository dispatch - uses: ibm-garage-cloud/action-repository-dispatch@main - with: - notifyRepo: ibm-garage-cloud/ibm-garage-iteration-zero - eventType: released - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} + uses: cloud-native-toolkit/action-workflows/.github/workflows/notify.yaml@v1 + secrets: + TOKEN: ${{ secrets.TOKEN }} diff --git a/.github/workflows/publish-assets.yaml b/.github/workflows/publish-assets.yaml deleted file mode 100644 index b704534..0000000 --- a/.github/workflows/publish-assets.yaml +++ /dev/null @@ -1,34 +0,0 @@ -name: Publish assets - -on: - release: - types: - - published - -jobs: - publish-assets: - runs-on: ubuntu-latest - - env: - DIST_DIR: ./dist - PUBLISH_BRANCH: gh-pages - - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: ${{ github.event.release.tag_name }} - - - name: Build catalog - uses: ibm-garage-cloud/action-module-catalog@main - with: - tagName: ${{ github.event.release.tag_name }} - distDir: ${{ env.DIST_DIR }} - publishBranch: ${{ env.PUBLISH_BRANCH }} - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ${{ env.DIST_DIR }} - publish_branch: ${{ env.PUBLISH_BRANCH }} \ No newline at end of file diff --git a/.github/workflows/publish-metadata.yaml b/.github/workflows/publish-metadata.yaml new file mode 100644 index 0000000..84c4cd3 --- /dev/null +++ b/.github/workflows/publish-metadata.yaml @@ -0,0 +1,12 @@ +name: Publish metadata + +on: + release: + types: + - published + +jobs: + publish-assets: + uses: cloud-native-toolkit/action-workflows/.github/workflows/publish-metadata.yaml@v1 + secrets: + TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/verify-pr.yaml b/.github/workflows/verify-pr.yaml new file mode 100644 index 0000000..d8d1949 --- /dev/null +++ b/.github/workflows/verify-pr.yaml @@ -0,0 +1,18 @@ +name: Verify PR + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the main branch +on: + pull_request: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + verify: + if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }} + uses: ./.github/workflows/verify-workflow.yaml + secrets: + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} + + verifyMetadata: + uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-module-metadata.yaml@v1 diff --git a/.github/workflows/verify-workflow.yaml b/.github/workflows/verify-workflow.yaml new file mode 100644 index 0000000..836da1e --- /dev/null +++ b/.github/workflows/verify-workflow.yaml @@ -0,0 +1,47 @@ +name: Verify + +# Controls when the action will run. +on: + workflow_call: + secrets: + IBMCLOUD_API_KEY: + required: true + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + verify: + if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }} + runs-on: ubuntu-latest + container: quay.io/ibmgaragecloud/cli-tools:v0.15 + + strategy: + matrix: + testcase: + - ocp4_latest + fail-fast: false + + env: + HOME: /home/devops + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Verify deploy on ${{ matrix.testcase }} + uses: cloud-native-toolkit/action-module-verify-deploy@main + with: + clusterId: ${{ matrix.testcase }} + validateDeployScript: .github/scripts/validate-deploy.sh + env: + TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} + + - name: Verify destroy on ${{ matrix.testcase }} + uses: cloud-native-toolkit/action-module-verify-destroy@main + if: ${{ always() }} + with: + clusterId: ${{ matrix.testcase }} + env: + TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml index 7cafb6e..0ceaad9 100644 --- a/.github/workflows/verify.yaml +++ b/.github/workflows/verify.yaml @@ -1,65 +1,24 @@ -name: Verify and release module +name: Verify # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the main branch on: push: branches: [ main ] - pull_request: - branches: [ main ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: verify: if: ${{ !contains( github.event.pull_request.labels.*.name, 'skip ci' ) }} - runs-on: ubuntu-latest - container: quay.io/ibmgaragecloud/cli-tools:v0.10.0-lite - - strategy: - matrix: - platform: [ocp4_latest] - # max-parallel: 1 - fail-fast: false - - env: - HOME: /home/devops + uses: ./.github/workflows/verify-workflow.yaml + secrets: + IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - name: Checkout - uses: actions/checkout@v1 - - - name: Verify deploy on ${{ matrix.platform }} - uses: ibm-garage-cloud/action-module-verify-deploy@main - with: - clusterId: ${{ matrix.platform }} - validateDeployScript: .github/scripts/validate-deploy.sh - env: - TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} - IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} - - - name: Verify destroy on ${{ matrix.platform }} - uses: ibm-garage-cloud/action-module-verify-destroy@main - if: ${{ always() }} - with: - clusterId: ${{ matrix.platform }} - env: - TF_VAR_ibmcloud_api_key: ${{ secrets.IBMCLOUD_API_KEY }} - IBMCLOUD_API_KEY: ${{ secrets.IBMCLOUD_API_KEY }} + verifyMetadata: + uses: cloud-native-toolkit/action-workflows/.github/workflows/verify-module-metadata.yaml@v1 release: - # if: ${{ github.event_name == 'push' }} - needs: verify - runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' }} - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Drafts your next Release notes as Pull Requests are merged into "main" - - uses: release-drafter/release-drafter@v5 - with: - # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml - config-name: release-drafter.yaml - publish: true - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} + needs: [verify, verifyMetadata] + uses: cloud-native-toolkit/action-workflows/.github/workflows/release-module.yaml@v1 + secrets: + TOKEN: ${{ secrets.TOKEN }} diff --git a/test/stages/stage0.tf b/test/stages/stage0.tf index ca88e62..fc53b9f 100644 --- a/test/stages/stage0.tf +++ b/test/stages/stage0.tf @@ -1,2 +1,23 @@ terraform { + required_version = ">= 0.13.0" + + required_providers { + ibm = { + source = "ibm-cloud/ibm" + version = ">= 1.22.0" + } + } } + +module setup_clis { + source = "github.com/cloud-native-toolkit/terraform-util-clis.git" + + bin_dir = "${path.cwd}/test_bin_dir" + clis = ["jq", "ibmcloud-is"] +} + +resource local_file bin_dir { + filename = "${path.cwd}/.bin_dir" + + content = module.setup_clis.bin_dir +} \ No newline at end of file From 47a939ec8b599dc82d7abdc35769aef922178a88 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Wed, 1 Jun 2022 18:08:03 -0700 Subject: [PATCH 02/15] Updated main.tf file to clear version constraints Closes #7 Signed-off-by: Vamsy Sivaarcca --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index e1f2ca3..591696d 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,5 @@ provider "ibm" { - version = ">= 1.17.0" + #version = ">= 1.25.0" region = local.key-protect-region } From d3e20a4b1f294c2a1c952885c5be0ea27435906f Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Wed, 1 Jun 2022 18:13:19 -0700 Subject: [PATCH 03/15] Updated stage files Closes #7 Signed-off-by: Vamsy Sivaarcca --- test/stages/stage0.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/stages/stage0.tf b/test/stages/stage0.tf index fc53b9f..636eaa6 100644 --- a/test/stages/stage0.tf +++ b/test/stages/stage0.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 0.13.0" + required_version = ">= 0.15.0" required_providers { ibm = { source = "ibm-cloud/ibm" - version = ">= 1.22.0" + version = ">= 1.25.0" } } } From ae6bf65ab48deeb12883e0eb39017a89d29a2263 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Wed, 1 Jun 2022 18:17:40 -0700 Subject: [PATCH 04/15] Updated metadata.yml Signed-off-by: Vamsy Sivaarcca --- .github/workflows/publish-metadata.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-metadata.yaml b/.github/workflows/publish-metadata.yaml index 84c4cd3..f2b1d9c 100644 --- a/.github/workflows/publish-metadata.yaml +++ b/.github/workflows/publish-metadata.yaml @@ -9,4 +9,4 @@ jobs: publish-assets: uses: cloud-native-toolkit/action-workflows/.github/workflows/publish-metadata.yaml@v1 secrets: - TOKEN: ${{ secrets.GITHUB_TOKEN }} + TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file From 88fe10e8697327cd59ae3fc82335004756089a9b Mon Sep 17 00:00:00 2001 From: Sean Sundberg Date: Thu, 2 Jun 2022 11:11:40 -0500 Subject: [PATCH 05/15] Adds empty variables array --- module.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/module.yaml b/module.yaml index 7d898dd..c2e70d3 100644 --- a/module.yaml +++ b/module.yaml @@ -11,3 +11,4 @@ versions: - kubernetes - ocp3 - ocp4 + variables: [] From c6317146f9eb013a358985610ac8e568541d86c2 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:14:01 -0700 Subject: [PATCH 06/15] Added version.tf file and provider details to provision required packages Signed-off-by: Vamsy Sivaarcca --- main.tf | 1 + module.yaml | 4 ++++ version.tf | 10 ++++++++++ 3 files changed, 15 insertions(+) create mode 100644 version.tf diff --git a/main.tf b/main.tf index 591696d..cdca889 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,6 @@ provider "ibm" { #version = ">= 1.25.0" + source = "ibm-cloud/ibm" region = local.key-protect-region } diff --git a/module.yaml b/module.yaml index c2e70d3..3905722 100644 --- a/module.yaml +++ b/module.yaml @@ -12,3 +12,7 @@ versions: - ocp3 - ocp4 variables: [] + + providers: + - name: ibm + source: "ibm-cloud/ibm" diff --git a/version.tf b/version.tf new file mode 100644 index 0000000..687403e --- /dev/null +++ b/version.tf @@ -0,0 +1,10 @@ +terraform { + required_version = ">= 0.15.0" + + required_providers { + ibm = { + source = "ibm-cloud/ibm" + version = ">= 1.25.0" + } + } +} \ No newline at end of file From 5b20c9c4c94a3f05c285bb29144dad00ab6045db Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:25:35 -0700 Subject: [PATCH 07/15] Edited module.yaml file Signed-off-by: Vamsy Sivaarcca --- module.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/module.yaml b/module.yaml index 3905722..0aee01c 100644 --- a/module.yaml +++ b/module.yaml @@ -12,7 +12,6 @@ versions: - ocp3 - ocp4 variables: [] + + - providers: - - name: ibm - source: "ibm-cloud/ibm" From 89dd905125d3950a207d01f4d965626ac98d13f8 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:31:39 -0700 Subject: [PATCH 08/15] Updated module.yaml and added provider configuration in stages Signed-off-by: Vamsy Sivaarcca --- module.yaml | 3 +++ test/stages/provider.tf | 4 ++++ 2 files changed, 7 insertions(+) create mode 100644 test/stages/provider.tf diff --git a/module.yaml b/module.yaml index 0aee01c..cf78fc3 100644 --- a/module.yaml +++ b/module.yaml @@ -12,6 +12,9 @@ versions: - ocp3 - ocp4 variables: [] + providers: + - name: ibm + source: "ibm-cloud/ibm" diff --git a/test/stages/provider.tf b/test/stages/provider.tf new file mode 100644 index 0000000..6de479b --- /dev/null +++ b/test/stages/provider.tf @@ -0,0 +1,4 @@ +provider "ibm" { + region = var.region + ibmcloud_api_key = var.ibmcloud_api_key +} \ No newline at end of file From e1c677cde9758ea974b94b62aefd17acf01882e3 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:33:56 -0700 Subject: [PATCH 09/15] Added provider version to main.tf file Signed-off-by: Vamsy Sivaarcca --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index cdca889..6a3776e 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,5 @@ provider "ibm" { - #version = ">= 1.25.0" + version = ">= 1.25.0" source = "ibm-cloud/ibm" region = local.key-protect-region } From fed502cdcde3f13350de960986581b0101e34196 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:38:51 -0700 Subject: [PATCH 10/15] Edited main.tf file to match versions Signed-off-by: Vamsy Sivaarcca --- main.tf | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/main.tf b/main.tf index 6a3776e..0310848 100644 --- a/main.tf +++ b/main.tf @@ -1,16 +1,16 @@ -provider "ibm" { - version = ">= 1.25.0" - source = "ibm-cloud/ibm" - region = local.key-protect-region -} - -data "ibm_resource_group" "resource_group" { - name = var.resource_group_name -} - -data "ibm_resource_group" "kp_resource_group" { - name = local.key-protect-resource-group -} +# provider "ibm" { +# version = ">= 1.25.0" +# source = "ibm-cloud/ibm" +# region = local.key-protect-region +# } + +# data "ibm_resource_group" "resource_group" { +# name = var.resource_group_name +# } + +# data "ibm_resource_group" "kp_resource_group" { +# name = local.key-protect-resource-group +# } locals { service = "databases-for-mongodb" From 5f63934b598c81bc930bf381b1addfbe0410d5e0 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:49:31 -0700 Subject: [PATCH 11/15] Updated version files for provider version conflicts Signed-off-by: Vamsy Sivaarcca --- main.tf | 26 +++++++++++++------------- module.yaml | 3 --- version.tf | 4 ++-- 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/main.tf b/main.tf index 0310848..cc206e3 100644 --- a/main.tf +++ b/main.tf @@ -1,16 +1,16 @@ -# provider "ibm" { -# version = ">= 1.25.0" -# source = "ibm-cloud/ibm" -# region = local.key-protect-region -# } - -# data "ibm_resource_group" "resource_group" { -# name = var.resource_group_name -# } - -# data "ibm_resource_group" "kp_resource_group" { -# name = local.key-protect-resource-group -# } +provider "ibm" { + source = "ibm-cloud/ibm" + version = ">= 1.25.0" + region = local.key-protect-region +} + +data "ibm_resource_group" "resource_group" { + name = var.resource_group_name +} + +data "ibm_resource_group" "kp_resource_group" { + name = local.key-protect-resource-group +} locals { service = "databases-for-mongodb" diff --git a/module.yaml b/module.yaml index cf78fc3..0aee01c 100644 --- a/module.yaml +++ b/module.yaml @@ -12,9 +12,6 @@ versions: - ocp3 - ocp4 variables: [] - providers: - - name: ibm - source: "ibm-cloud/ibm" diff --git a/version.tf b/version.tf index 687403e..50342df 100644 --- a/version.tf +++ b/version.tf @@ -1,10 +1,10 @@ terraform { - required_version = ">= 0.15.0" + required_version = ">= 0.13.0" required_providers { ibm = { source = "ibm-cloud/ibm" version = ">= 1.25.0" - } + } } } \ No newline at end of file From 35e74487acdbbb471dbe40386e3bc15102137324 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:54:43 -0700 Subject: [PATCH 12/15] Updated main.tf file Signed-off-by: Vamsy Sivaarcca --- main.tf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index cc206e3..fa054c0 100644 --- a/main.tf +++ b/main.tf @@ -1,8 +1,13 @@ -provider "ibm" { +terraform { + required_providers { + ibm = { source = "ibm-cloud/ibm" version = ">= 1.25.0" region = local.key-protect-region } +} +} + data "ibm_resource_group" "resource_group" { name = var.resource_group_name From e18a5a3aa3ebaa2817faed850045e499dfc1e37d Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 10:57:05 -0700 Subject: [PATCH 13/15] Updated main.tf file Signed-off-by: Vamsy Sivaarcca --- main.tf | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/main.tf b/main.tf index fa054c0..317666b 100644 --- a/main.tf +++ b/main.tf @@ -1,13 +1,7 @@ -terraform { - required_providers { - ibm = { - source = "ibm-cloud/ibm" +provider "ibm" { version = ">= 1.25.0" region = local.key-protect-region } -} -} - data "ibm_resource_group" "resource_group" { name = var.resource_group_name From 855cc27589807e3e8da76e042b37d5e29b67c459 Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 11:19:41 -0700 Subject: [PATCH 14/15] Committing to set DCO check to pass. Closes #7 Signed-off-by: Vamsy Sivaarcca --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e3f0b5c..ae6ee33 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,4 @@ module "dev_infrastructure_mongodb" { authorize-kms = var.authorize-kms == "true" } ``` - +## \ No newline at end of file From e45accf32701dcad0611bae83a99c09a94db9a6e Mon Sep 17 00:00:00 2001 From: Vamsy Sivaarcca Date: Thu, 2 Jun 2022 11:46:46 -0700 Subject: [PATCH 15/15] Updated module.yaml file to add provider and dependencies Closes #7 Signed-off-by: Vamsy Sivaarcca --- module.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module.yaml b/module.yaml index 0aee01c..753a3f3 100644 --- a/module.yaml +++ b/module.yaml @@ -11,6 +11,10 @@ versions: - kubernetes - ocp3 - ocp4 + providers: + - name: ibm + source: "ibm-cloud/ibm" + dependencies: [] variables: []