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