Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions lib/os-modules/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@ vars:
terraform-datadog-users \
terraform-github-teams \
terraform-github-organization \
terraform-googleworkspace-user-group-management \
terraform-googleworkspace-users-groups-automation \
terraform-postgres-automation \
terraform-secrets-helper \
terraform-spacelift-automation \
terraform-spacelift-aws-integrations \
terraform-spacelift-events-collector-audit-trail \
terraform-spacelift-policies
SYNC_BRANCH: chore/sync-with-template
SHARED_TMP_DIR: .tmp-template-sync
tasks:
sync:
desc: |
Expand All @@ -38,10 +41,7 @@ tasks:
.terraform-docs.yaml
LICENSE
aqua.yaml
TMP_DIR: .tmp-template-sync
cmds:
- rm -rf {{.TMP_DIR}}
- git clone --depth 1 https://github.com/masterpointio/terraform-module-template.git {{.TMP_DIR}}
- |
# Convert newlines to spaces and remove backslashes
modules=$(echo "{{.MODULES}}" | tr '\n' ' ' | sed 's/\\//g')
Expand All @@ -51,10 +51,9 @@ tasks:
for file in {{.FILES}}
do
echo " Syncing $file"
rsync -av --delete {{.TMP_DIR}}/$file ../$module/
rsync -av --delete {{.SHARED_TMP_DIR}}/$file ../$module/
done
done
- rm -rf {{.TMP_DIR}}

pull-and-branch:
desc: |
Expand Down Expand Up @@ -114,6 +113,17 @@ tasks:
cd -
done

setup-template:
desc: Set up the template repository in a shared temporary directory
cmds:
- rm -rf {{.SHARED_TMP_DIR}}
- git clone --depth 1 https://github.com/masterpointio/terraform-module-template.git {{.SHARED_TMP_DIR}}

cleanup-template:
desc: Clean up the shared temporary directory
cmds:
- rm -rf {{.SHARED_TMP_DIR}}

sync-all:
desc: |
Pull main branch, create a sync branch, and sync with template for specified Terraform open-source module repos.
Expand All @@ -130,5 +140,7 @@ tasks:
vars:
MODULES: "{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}{{.DEFAULT_MODULES}}{{end}}"
cmds:
- task: setup-template
- task: pull-and-branch
- task: sync
- task: cleanup-template