From 64fa504c0d5e4a1c9bd25d11e8c112f158f6b342 Mon Sep 17 00:00:00 2001 From: Timo Furrer <tfurrer@gitlab.com> Date: Thu, 18 Jan 2024 16:36:52 +0100 Subject: [PATCH] Fix backports testing --- CONTRIBUTING.md | 4 ++-- Makefile | 1 + backports/OpenTofu.gitlab-ci.yml | 2 +- backports/OpenTofu/Base.gitlab-ci.yml | 2 +- tests/integration-tests/BackportTemplates.gitlab-ci.yml | 8 +++++++- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8e1e1cd..4398835 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,5 +27,5 @@ because components are not yet properly supported in self-managed instances. That is, they are not bundled and it's not possible to use a component across instances. The OpenTofu CI/CD job and pipeline templates can be generated using `make backports`. -The output is generated into the `backports` folder. Please contribute those files -only upon manual inspection to the canonical GitLab repository. +The output is generated into the `backports` folder. +Please contribute those files only upon full manual inspection to the canonical GitLab repository. diff --git a/Makefile b/Makefile index 741a17b..d8c7ff9 100644 --- a/Makefile +++ b/Makefile @@ -52,3 +52,4 @@ backports: @sed -i $(BACKPORTS_BASE_FILE) -e 's/^apply:$$/.opentofu:apply:/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/destroy:/.opentofu:destroy:/' @sed -i $(BACKPORTS_BASE_FILE) -e 's/\[destroy\]/[.opentofu:destroy]/' + @sed -i $(BACKPORTS_BASE_FILE) -e 's/^delete-state:$$/.opentofu:delete-state:/' diff --git a/backports/OpenTofu.gitlab-ci.yml b/backports/OpenTofu.gitlab-ci.yml index 7632da7..83be36b 100644 --- a/backports/OpenTofu.gitlab-ci.yml +++ b/backports/OpenTofu.gitlab-ci.yml @@ -13,7 +13,7 @@ # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/OpenTofu.gitlab-ci.yml include: - - local: /backports/OpenTofu/Base.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/OpenTofu/Base.gitlab-ci.yml + - template: OpenTofu/Base.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/OpenTofu/Base.gitlab-ci.yml stages: [validate, test, build, deploy] diff --git a/backports/OpenTofu/Base.gitlab-ci.yml b/backports/OpenTofu/Base.gitlab-ci.yml index adec966..96f6f50 100644 --- a/backports/OpenTofu/Base.gitlab-ci.yml +++ b/backports/OpenTofu/Base.gitlab-ci.yml @@ -98,7 +98,7 @@ variables: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $TF_AUTO_DESTROY == "true" - when: manual -delete-state: +.opentofu:delete-state: extends: .opentofu:default stage: cleanup needs: [.opentofu:destroy] diff --git a/tests/integration-tests/BackportTemplates.gitlab-ci.yml b/tests/integration-tests/BackportTemplates.gitlab-ci.yml index 316ec52..113c20d 100644 --- a/tests/integration-tests/BackportTemplates.gitlab-ci.yml +++ b/tests/integration-tests/BackportTemplates.gitlab-ci.yml @@ -1,25 +1,31 @@ include: - - local: /backports/OpenTofu.gitlab-ci.yml + - local: /backports/OpenTofu/Base.gitlab-ci.yml stages: [validate, test, build, deploy, cleanup] # Required to run everything immediately, instead of manually. fmt: + extends: .opentofu:fmt rules: [{when: always}] validate: + extends: .opentofu:validate rules: [{when: always}] plan: + extends: .opentofu:plan rules: [{when: always}] apply: + extends: .opentofu:apply rules: [{when: always}] destroy: + extends: .opentofu:destroy rules: [{when: always}] delete-state: + extends: .opentofu:delete-states rules: [{when: always}] -- GitLab