diff --git a/tests/integration-tests/ValidatePlanApply.gitlab-ci.yml b/tests/integration-tests/ValidatePlanApply.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..ce33dd7073fed6ffe7db45e53007e2528f353e95 --- /dev/null +++ b/tests/integration-tests/ValidatePlanApply.gitlab-ci.yml @@ -0,0 +1,22 @@ +include: + - component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/validate-plan-apply@$CI_COMMIT_SHA + inputs: + image_registry_base: $GITLAB_OPENTOFU_IMAGE_BASE + version: $CI_COMMIT_SHA + base_os: $GITLAB_OPENTOFU_BASE_IMAGE_OS + opentofu_version: $OPENTOFU_VERSION + root_dir: $TEST_GITLAB_TOFU_ROOT_DIR + state_name: $TEST_GITLAB_TOFU_STATE_NAME + fmt_rules: [{when: on_success}] + validate_rules: [{when: on_success}] + plan_rules: [{when: on_success}] + apply_rules: [{when: on_success}] + + # For CI Terraform state cleanup + - component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/delete-state@$CI_COMMIT_SHA + inputs: + stage: cleanup + state_name: $TEST_GITLAB_TOFU_STATE_NAME + rules: [{when: always}] + +stages: [validate, build, deploy, cleanup] diff --git a/tests/integration-tests/TriggerInChildPipeline.gitlab-ci.yml b/tests/integration-tests/ValidatePlanApplyTriggerInChildPipeline.gitlab-ci.yml similarity index 100% rename from tests/integration-tests/TriggerInChildPipeline.gitlab-ci.yml rename to tests/integration-tests/ValidatePlanApplyTriggerInChildPipeline.gitlab-ci.yml diff --git a/tests/integration-tests/Destroy.gitlab-ci.yml b/tests/integration-tests/ValidatePlanDestroy.gitlab-ci.yml similarity index 100% rename from tests/integration-tests/Destroy.gitlab-ci.yml rename to tests/integration-tests/ValidatePlanDestroy.gitlab-ci.yml diff --git a/tests/integration.gitlab-ci.yml b/tests/integration.gitlab-ci.yml index 9165372622a0bdd0ae329e2670b0b9baac351726..5d4c185c388279a4db66495a9b20eb2e33213341 100644 --- a/tests/integration.gitlab-ci.yml +++ b/tests/integration.gitlab-ci.yml @@ -1,8 +1,8 @@ -component: +full-pipeline: stage: test-integration variables: OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION - TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX TEST_GITLAB_TOFU_ROOT_DIR: tests/iac trigger: include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml @@ -12,14 +12,111 @@ component: - PIPELINE_NAME: - Defaults - FullPipelineTriggerInChildPipeline + - VarFile + GITLAB_OPENTOFU_BASE_IMAGE_OS: + - alpine + - debian + +validate-plan-apply: + stage: test-integration + variables: + OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_ROOT_DIR: tests/iac + trigger: + include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml + strategy: depend + parallel: + matrix: + - PIPELINE_NAME: + - ValidatePlanApply + - ValidatePlanApplyTriggerInChildPipeline + GITLAB_OPENTOFU_BASE_IMAGE_OS: + - alpine + - debian + +validate-plan-destroy: + stage: test-integration + variables: + OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_ROOT_DIR: tests/iac + trigger: + include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml + strategy: depend + parallel: + matrix: + - PIPELINE_NAME: + - ValidatePlanDestroy + - ValidatePlanDestroyTriggerInChildPipeline + GITLAB_OPENTOFU_BASE_IMAGE_OS: + - alpine + - debian + +job-templates: + stage: test-integration + variables: + OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_ROOT_DIR: tests/iac + trigger: + include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml + strategy: depend + parallel: + matrix: + - PIPELINE_NAME: - JobTemplates + GITLAB_OPENTOFU_BASE_IMAGE_OS: + - alpine + - debian + +test-job-template: + stage: test-integration + variables: + OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_ROOT_DIR: tests/iac + trigger: + include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml + strategy: depend + parallel: + matrix: + - PIPELINE_NAME: - TestJob + GITLAB_OPENTOFU_BASE_IMAGE_OS: + - alpine + - debian + +module-release-job-template: + stage: test-integration + variables: + OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_ROOT_DIR: tests/iac + trigger: + include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml + strategy: depend + parallel: + matrix: + - PIPELINE_NAME: - ModuleRelease - - Destroy - - ValidatePlanDestroyTriggerInChildPipeline - - VarFile + GITLAB_OPENTOFU_BASE_IMAGE_OS: + - alpine + - debian + +plan-job-template: + stage: test-integration + variables: + OPENTOFU_VERSION: $LATEST_OPENTOFU_VERSION + TEST_GITLAB_TOFU_STATE_NAME: ci-integration-$CI_JOB_NAME_SLUG-$CI_PIPELINE_IID-$CI_NODE_INDEX + TEST_GITLAB_TOFU_ROOT_DIR: tests/iac + trigger: + include: tests/integration-tests/$PIPELINE_NAME.gitlab-ci.yml + strategy: depend + parallel: + matrix: + - PIPELINE_NAME: - WarningOnNonEmptyPlan - - TriggerInChildPipeline GITLAB_OPENTOFU_BASE_IMAGE_OS: - alpine - debian