From 19204b4ae1a827ffb10e76a4836bc03f6749fde1 Mon Sep 17 00:00:00 2001 From: Work Date: Mon, 26 Jan 2026 16:15:57 +0300 Subject: [PATCH] change pipeline generation + add tf dockerfile --- scripts/generate-pipeline.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/scripts/generate-pipeline.sh b/scripts/generate-pipeline.sh index 8b1c930..663cf60 100755 --- a/scripts/generate-pipeline.sh +++ b/scripts/generate-pipeline.sh @@ -96,8 +96,19 @@ validate-${job_prefix}: - export S3_SECRET_KEY="\${S3_SECRET_KEY}" - cd \${TG_ROOT} - ls -la - - rm -rf .terragrunt-cache - export TF_PLUGIN_CACHE_DIR=/root/.terraform.d/plugin-cache + - | + if [ -n "$needs_deps" ]; then + for dep in $needs_deps; do + dep_component=$(echo "$dep" | sed "s/validate-${env}-//") + dep_cache_path="${component_dir}/../${dep_component}/.terragrunt-cache" + if [ -d "${dep_cache_path}" ]; then + echo "Restoring .terragrunt-cache from ${dep_component}" + mkdir -p .terragrunt-cache + cp -r "${dep_cache_path}"/* .terragrunt-cache/ 2>/dev/null || true + fi + done + fi script: - env | grep -E "(S3_|AWS_)" || echo "No S3/AWS vars found" - terragrunt init -upgrade -reconfigure @@ -108,11 +119,22 @@ validate-${job_prefix}: - if: '\$CI_COMMIT_BRANCH =~ /^feature\/.*/' - if: '\$CI_PIPELINE_SOURCE == "pipeline"' interruptible: true + artifacts: + paths: + - "\${TG_ROOT}/.terragrunt-cache/**/*" + expire_in: 1 hour + when: always EOF if [ -n "$needs_deps" ]; then cat >> "$OUTPUT_FILE" << EOF needs: +EOF + for dep in $needs_deps; do + echo " - ${dep}" >> "$OUTPUT_FILE" + done + cat >> "$OUTPUT_FILE" << EOF + dependencies: EOF for dep in $needs_deps; do echo " - ${dep}" >> "$OUTPUT_FILE" @@ -141,7 +163,6 @@ plan-${job_prefix}: - export AWS_SECRET_ACCESS_KEY="\${AWS_SECRET_ACCESS_KEY}" - cd \${TG_ROOT} - ls -la - - rm -rf .terragrunt-cache script: - terragrunt init -upgrade -reconfigure - terragrunt plan -out=tfplan @@ -187,7 +208,6 @@ apply-${job_prefix}: - export AWS_SECRET_ACCESS_KEY="\${AWS_SECRET_ACCESS_KEY}" - cd \${TG_ROOT} - ls -la - - rm -rf .terragrunt-cache script: - terragrunt init -upgrade -reconfigure - terragrunt apply tfplan