Skip to content

Commit f3dce3a

Browse files
gbereniceGowiem
andauthored
chore: updates repos and optimizes sync-all (#19)
## what - Adds new OS repos. - Moves template files to one shared dir to avoid pulling them each time. ## why - Internal householding. ## references - N/A <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved sync process to use a shared temporary directory for template files. - Added setup and cleanup steps to handle template repository management automatically during sync operations. - **Chores** - Updated default modules list with two new Terraform modules. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Matt Gowie <matt@masterpoint.io>
1 parent f910efa commit f3dce3a

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/os-modules/Taskfile.yaml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ vars:
77
terraform-datadog-users \
88
terraform-github-teams \
99
terraform-github-organization \
10+
terraform-googleworkspace-users-groups-automation \
1011
terraform-postgres-automation \
1112
terraform-secrets-helper \
1213
terraform-spacelift-automation \
1314
terraform-spacelift-aws-integrations \
1415
terraform-spacelift-events-collector-audit-trail \
1516
terraform-spacelift-policies
1617
SYNC_BRANCH: chore/sync-with-template
18+
SHARED_TMP_DIR: .tmp-template-sync
1719
tasks:
1820
sync:
1921
desc: |
@@ -38,10 +40,7 @@ tasks:
3840
.terraform-docs.yaml
3941
LICENSE
4042
aqua.yaml
41-
TMP_DIR: .tmp-template-sync
4243
cmds:
43-
- rm -rf {{.TMP_DIR}}
44-
- git clone --depth 1 https://github.com/masterpointio/terraform-module-template.git {{.TMP_DIR}}
4544
- |
4645
# Convert newlines to spaces and remove backslashes
4746
modules=$(echo "{{.MODULES}}" | tr '\n' ' ' | sed 's/\\//g')
@@ -51,10 +50,9 @@ tasks:
5150
for file in {{.FILES}}
5251
do
5352
echo " Syncing $file"
54-
rsync -av --delete {{.TMP_DIR}}/$file ../$module/
53+
rsync -av --delete {{.SHARED_TMP_DIR}}/$file ../$module/
5554
done
5655
done
57-
- rm -rf {{.TMP_DIR}}
5856
5957
pull-and-branch:
6058
desc: |
@@ -114,6 +112,17 @@ tasks:
114112
cd -
115113
done
116114
115+
setup-template:
116+
desc: Set up the template repository in a shared temporary directory
117+
cmds:
118+
- task: cleanup-template
119+
- git clone --depth 1 https://github.com/masterpointio/terraform-module-template.git {{.SHARED_TMP_DIR}}
120+
121+
cleanup-template:
122+
desc: Clean up the shared temporary directory
123+
cmds:
124+
- rm -rf {{.SHARED_TMP_DIR}}
125+
117126
sync-all:
118127
desc: |
119128
Pull main branch, create a sync branch, and sync with template for specified Terraform open-source module repos.
@@ -130,5 +139,7 @@ tasks:
130139
vars:
131140
MODULES: "{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}{{.DEFAULT_MODULES}}{{end}}"
132141
cmds:
142+
- task: setup-template
133143
- task: pull-and-branch
134144
- task: sync
145+
- task: cleanup-template

0 commit comments

Comments
 (0)