Skip to content
Snippets Groups Projects
Commit dfce6509 authored by Timo Furrer's avatar Timo Furrer
Browse files

Merge branch 'trigger-in-pipeline-tests' into 'main'

Add more integration tests for trigger in child pipeline

See merge request components/opentofu!191
parents c9c3d6bd 13981f46
Branches
Tags
No related merge requests found
...@@ -291,8 +291,15 @@ include: ...@@ -291,8 +291,15 @@ include:
# job template, but the issue is that we cannot default it to something # job template, but the issue is that we cannot default it to something
# meaningful other than `null` - but `null` is also not yet supported, see # meaningful other than `null` - but `null` is also not yet supported, see
# https://gitlab.com/gitlab-org/gitlab/-/issues/440468 # https://gitlab.com/gitlab-org/gitlab/-/issues/440468
'$[[ inputs.job_name_prefix ]]delete-state': '.$[[ inputs.job_name_prefix ]]delete-state:dummy:true':
stage: .pre
script: 'false'
'.$[[ inputs.job_name_prefix ]]delete-state:dummy:false':
needs: ['$[[ inputs.job_name_prefix ]]destroy'] needs: ['$[[ inputs.job_name_prefix ]]destroy']
'$[[ inputs.job_name_prefix ]]delete-state':
extends: '.$[[ inputs.job_name_prefix ]]delete-state:dummy:$[[ inputs.trigger_in_child_pipeline ]]'
rules: rules:
- if: '"$[[ inputs.trigger_in_child_pipeline ]]" != "false"' - if: '"$[[ inputs.trigger_in_child_pipeline ]]" != "false"'
when: never when: never
...@@ -302,6 +309,7 @@ include: ...@@ -302,6 +309,7 @@ include:
# NOTE: the following configuration is only used if `trigger_in_child_pipeline` is enabled. # NOTE: the following configuration is only used if `trigger_in_child_pipeline` is enabled.
stages: stages:
- $[[ inputs.stage_validate ]] - $[[ inputs.stage_validate ]]
- $[[ inputs.stage_test ]]
- $[[ inputs.stage_build ]] - $[[ inputs.stage_build ]]
- $[[ inputs.stage_deploy ]] - $[[ inputs.stage_deploy ]]
- $[[ inputs.stage_cleanup ]] - $[[ inputs.stage_cleanup ]]
...@@ -322,9 +330,10 @@ stages: ...@@ -322,9 +330,10 @@ stages:
extends: '.$[[ inputs.job_name_prefix ]]$[[ inputs.child_pipeline_name ]]:bridge_job_stage:$[[ inputs.trigger_in_child_pipeline ]]' extends: '.$[[ inputs.job_name_prefix ]]$[[ inputs.child_pipeline_name ]]:bridge_job_stage:$[[ inputs.trigger_in_child_pipeline ]]'
trigger: trigger:
include: include:
- local: /templates/validate-plan-apply.yml - local: /templates/full-pipeline.yml
inputs: inputs:
stage_validate: $[[ inputs.stage_validate ]] stage_validate: $[[ inputs.stage_validate ]]
stage_test: $[[ inputs.stage_test ]]
stage_build: $[[ inputs.stage_build ]] stage_build: $[[ inputs.stage_build ]]
stage_deploy: $[[ inputs.stage_deploy ]] stage_deploy: $[[ inputs.stage_deploy ]]
stage_cleanup: $[[ inputs.stage_cleanup ]] stage_cleanup: $[[ inputs.stage_cleanup ]]
......
...@@ -233,8 +233,15 @@ include: ...@@ -233,8 +233,15 @@ include:
# job template, but the issue is that we cannot default it to something # job template, but the issue is that we cannot default it to something
# meaningful other than `null` - but `null` is also not yet supported, see # meaningful other than `null` - but `null` is also not yet supported, see
# https://gitlab.com/gitlab-org/gitlab/-/issues/440468 # https://gitlab.com/gitlab-org/gitlab/-/issues/440468
'$[[ inputs.job_name_prefix ]]delete-state': '.$[[ inputs.job_name_prefix ]]delete-state:dummy:true':
stage: .pre
script: 'false'
'.$[[ inputs.job_name_prefix ]]delete-state:dummy:false':
needs: ['$[[ inputs.job_name_prefix ]]destroy'] needs: ['$[[ inputs.job_name_prefix ]]destroy']
'$[[ inputs.job_name_prefix ]]delete-state':
extends: '.$[[ inputs.job_name_prefix ]]delete-state:dummy:$[[ inputs.trigger_in_child_pipeline ]]'
rules: rules:
- if: '"$[[ inputs.trigger_in_child_pipeline ]]" != "false"' - if: '"$[[ inputs.trigger_in_child_pipeline ]]" != "false"'
when: never when: never
......
include:
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/full-pipeline@$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_TF_ROOT
state_name: $TEST_TF_STATE_NAME
# Required to run everything immediately, instead of manually.
fmt_rules: [{when: always}]
validate_rules: [{when: always}]
test_rules: [{when: always}]
plan_rules: [{when: always}]
apply_rules: [{when: always}]
destroy_rules: [{when: always}]
delete_state_rules: [{when: always}]
trigger_in_child_pipeline: true
include:
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/apply@$CI_COMMIT_SHA
inputs:
image_registry_base: $GITLAB_OPENTOFU_IMAGE_BASE
version: $CI_COMMIT_SHA
opentofu_version: $OPENTOFU_VERSION
as: 'setup:apply'
stage: setup
root_dir: $TEST_TF_ROOT
state_name: $TEST_TF_STATE_NAME
no_plan: true
# Required to run everything immediately, instead of manually.
rules: [{when: always}]
- component: $CI_SERVER_FQDN/$CI_PROJECT_PATH/validate-plan-destroy@$CI_COMMIT_SHA
inputs:
image_registry_base: $GITLAB_OPENTOFU_IMAGE_BASE
version: $CI_COMMIT_SHA
opentofu_version: $OPENTOFU_VERSION
root_dir: $TEST_TF_ROOT
state_name: $TEST_TF_STATE_NAME
# Required to run everything immediately, instead of manually.
fmt_rules: [{when: always}]
validate_rules: [{when: always}]
plan_rules: [{when: always}]
destroy_rules: [{when: always}]
delete_state_rules: [{when: always}]
trigger_in_child_pipeline: true
child_pipeline_stage: test
stages: [setup, test]
...@@ -11,10 +11,12 @@ component: ...@@ -11,10 +11,12 @@ component:
matrix: matrix:
- PIPELINE_NAME: - PIPELINE_NAME:
- Defaults - Defaults
- FullPipelineTriggerInChildPipeline
- JobTemplates - JobTemplates
- TestJob - TestJob
- ModuleRelease - ModuleRelease
- Destroy - Destroy
- ValidatePlanDestroyTriggerInChildPipeline
- VarFile - VarFile
- WarningOnNonEmptyPlan - WarningOnNonEmptyPlan
- TriggerInChildPipeline - TriggerInChildPipeline
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment