This commit is contained in:
Work 2026-01-28 13:39:12 +03:00
parent 9c2f9be993
commit e4fba4871e

View File

@ -33,8 +33,6 @@ find live -name "terragrunt.hcl" -not -path "*/.terragrunt-cache/*" | sort | whi
fi
job_prefix="${env}-${component}"
# Путь к компоненту (working directory уже terraform/)
full_component_dir="${component_dir}"
needs_section=""
@ -59,13 +57,13 @@ find live -name "terragrunt.hcl" -not -path "*/.terragrunt-cache/*" | sort | whi
cat >> "$OUTPUT_FILE" << VALIDATE_JOB
validate-${job_prefix}:
stage: validate
image: \${TERRAFORM_IMAGE_NAME}
image: \$TERRAFORM_IMAGE_NAME
variables:
TG_ROOT: "${full_component_dir}"
ENVIRONMENT: "${env}"
YC_FOLDER_ID: "\${${folder_var}}"
YC_FOLDER_ID: "\$${folder_var}"
before_script:
- cd \${TG_ROOT}
- cd \$TG_ROOT
- echo "Working directory:" && pwd
- ls -la
script:
@ -89,15 +87,15 @@ VALIDATE_JOB
cat >> "$OUTPUT_FILE" << PLAN_JOB
plan-${job_prefix}:
stage: plan
image: \${TERRAFORM_IMAGE_NAME}
image: \$TERRAFORM_IMAGE_NAME
variables:
TG_ROOT: "${full_component_dir}"
ENVIRONMENT: "${env}"
YC_FOLDER_ID: "\${${folder_var}}"
YC_FOLDER_ID: "\$${folder_var}"
needs:
- validate-${job_prefix}
before_script:
- cd \${TG_ROOT}
- cd \$TG_ROOT
- ls -la
script:
- terragrunt init -upgrade -reconfigure
@ -123,7 +121,6 @@ PLAN_JOB
when_clause="on_success"
fi
# Apply dependencies для secrets
apply_needs="plan-${job_prefix}"
if [ "$component" = "secrets" ]; then
apply_needs="plan-${job_prefix}
@ -135,15 +132,15 @@ PLAN_JOB
cat >> "$OUTPUT_FILE" << APPLY_JOB
apply-${job_prefix}:
stage: apply
image: \${TERRAFORM_IMAGE_NAME}
image: \$TERRAFORM_IMAGE_NAME
variables:
TG_ROOT: "${full_component_dir}"
ENVIRONMENT: "${env}"
YC_FOLDER_ID: "\${${folder_var}}"
YC_FOLDER_ID: "\$${folder_var}"
needs:
- ${apply_needs}
before_script:
- cd \${TG_ROOT}
- cd \$TG_ROOT
- ls -la
script:
- terragrunt init -upgrade -reconfigure