This commit is contained in:
Work 2026-01-28 14:35:32 +03:00
parent 42b6bcedfd
commit 7dadea3e98

View File

@ -86,13 +86,16 @@ ${needs_section}
VALIDATE_JOB
# Plan needs для secrets - ждём plan зависимостей
# Plan needs и before_script для secrets
plan_needs="validate-${job_prefix}"
plan_before_script="cd \$TG_ROOT && ls -la"
if [ "$component" = "secrets" ]; then
plan_needs="validate-${job_prefix}
- plan-${env}-namespace
- plan-${env}-s3
- plan-${env}-database"
# Для secrets инициализируем зависимости чтобы получить их outputs
plan_before_script="cd ../namespace && terragrunt init -upgrade -reconfigure && cd ../s3 && terragrunt init -upgrade -reconfigure && cd ../database && terragrunt init -upgrade -reconfigure && cd \$TG_ROOT && ls -la"
fi
cat >> "$OUTPUT_FILE" << PLAN_JOB
@ -106,8 +109,7 @@ plan-${job_prefix}:
needs:
- ${plan_needs}
before_script:
- cd \$TG_ROOT
- ls -la
- ${plan_before_script}
script:
- terragrunt init -upgrade -reconfigure
- terragrunt plan -out=tfplan
@ -130,11 +132,14 @@ PLAN_JOB
when_clause="manual"
apply_needs="plan-${job_prefix}"
apply_before_script="cd \$TG_ROOT && ls -la"
if [ "$component" = "secrets" ]; then
apply_needs="plan-${job_prefix}
- apply-${env}-namespace
- apply-${env}-s3
- apply-${env}-database"
# Для secrets инициализируем зависимости чтобы получить их outputs
apply_before_script="cd ../namespace && terragrunt init -upgrade -reconfigure && cd ../s3 && terragrunt init -upgrade -reconfigure && cd ../database && terragrunt init -upgrade -reconfigure && cd \$TG_ROOT && ls -la"
fi
cat >> "$OUTPUT_FILE" << APPLY_JOB
@ -145,12 +150,10 @@ apply-${job_prefix}:
TG_ROOT: "${full_component_dir}"
ENVIRONMENT: "${env}"
YC_FOLDER_ID: "\$${folder_var}"
TG_SKIP_DEPENDENCY_OUTPUTS: "false"
needs:
- ${apply_needs}
before_script:
- cd \$TG_ROOT
- ls -la
- ${apply_before_script}
script:
- terragrunt init -upgrade -reconfigure
- terragrunt apply -auto-approve