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