Skip to content

Commit 8d9d719

Browse files
committed
fix: renames snaplet vars to avoid collisions
fix: clean needs to be passed the snapshot path
1 parent 3b565f8 commit 8d9d719

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

lib/snaplet/Taskfile.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,29 +96,36 @@ tasks:
9696
fi
9797
9898
download:
99-
desc: Downloads a snaplet snapshot from a given S3 Bucket. Pass in SNAPSHOT_NAME to download a specific snapshot from the bucket.
99+
desc: Downloads a snaplet snapshot to the local machine.
100+
summary: |
101+
Downloads a given snaplet snapshot from a given S3 Bucket.
102+
Pass in RESTORE_SNAPSHOT to download a specific snapshot from the bucket.
103+
Pass in SNAPSHOT_ENV to download the snapshot for a specific environment.
104+
Pass in SNAPLET_BUCKET to download from a specific bucket.
100105
silent: true
101106
deps:
102-
- clean
103-
- validate-snaplet-bucket-access
107+
- task: clean
108+
vars:
109+
SNAPSHOT_PATH: "{{.SNAPSHOT_PATH}}"
110+
- task: validate-snaplet-bucket-access
104111
vars:
105-
SNAPSHOT_NAME: '{{.SNAPSHOT_NAME | default "latest"}}'
106-
SNAPSHOT_PATH: ".snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.SNAPSHOT_NAME}}"
112+
RESTORE_SNAPSHOT: '{{.RESTORE_SNAPSHOT | default "latest"}}'
113+
SNAPSHOT_PATH: ".snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}}"
107114
requires:
108115
vars:
109116
- SNAPLET_BUCKET
110117
- SNAPSHOT_ENV
111118
cmds:
112-
- aws s3 cp --quiet --sse=AES256 --recursive {{.SNAPLET_BUCKET}}/{{.SNAPSHOT_ENV}}/{{.SNAPSHOT_NAME}} {{.SNAPSHOT_PATH}}
113-
- printf "\n\n⬇ Snapshot downloaded to {{.SNAPSHOT_PATH}}"
119+
- aws s3 cp --quiet --sse=AES256 --recursive {{.SNAPLET_BUCKET}}/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}} {{.SNAPSHOT_PATH}}
120+
- printf "\n\n⬇ Snapshot downloaded to {{.SNAPSHOT_PATH}}\n\n"
114121

115122
restore:
116-
desc: Restores the given SNAPSHOT_NAME to the SNAPLET_TARGET_DATABASE_URL database.
123+
desc: Restores the given RESTORE_SNAPSHOT to the SNAPLET_TARGET_DATABASE_URL database.
117124
prompt: This will wipe all of the data in the given SNAPLET_TARGET_DATABASE_URL. Are you sure?
118125
silent: true
119126
vars:
120-
SNAPSHOT_NAME: '{{.SNAPSHOT_NAME | default "latest"}}'
121-
SNAPSHOT_PATH: .snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.SNAPSHOT_NAME}}
127+
RESTORE_SNAPSHOT: '{{.RESTORE_SNAPSHOT | default "latest"}}'
128+
SNAPSHOT_PATH: .snaplet/snapshots/{{.SNAPSHOT_ENV}}/{{.RESTORE_SNAPSHOT}}
122129
requires:
123130
vars:
124131
- SNAPLET_TARGET_DATABASE_URL

lib/toolbox/Taskfile.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ vars:
77
VERSION:
88
sh: git rev-parse --short HEAD
99
REGISTRY_URL_FULL: "{{.REGISTRY_URL}}/{{.LATEST_IMAGE_TAG}}"
10-
CONTAINERFILE_PATH: ./Dockerfile
10+
CONTAINERFILE_PATH: '{{.CONTAINERFILE_PATH | default "./Dockerfile"}}'
1111
AWS_REGION: '{{.AWS_REGION | default "us-east-1"}}'
1212

1313
tasks:
@@ -25,7 +25,7 @@ tasks:
2525
- IMAGE_NAME
2626
- CONTAINERFILE_PATH
2727
cmds:
28-
- docker build --tag {{.LASTEST_IMAGE_TAG}} --tag {{.VERSION_IMAGE_TAG}} {{.CONTAINERFILE_PATH}}
28+
- "docker build --tag {{.LATEST_IMAGE_TAG}} --tag {{.VERSION_IMAGE_TAG}} -f {{.CONTAINERFILE_PATH}} ."
2929
- echo "Done building and tagging toolbox 💯 Tagged as {{.VERSION_IMAGE_TAG}} + {{.LATEST_IMAGE_TAG}}"
3030

3131
install:
@@ -50,7 +50,7 @@ tasks:
5050
run:
5151
desc: Run our toolbox image while also mounting your $HOME folder to `/localhost` in the container
5252
cmds:
53-
- /usr/local/bin/{{.IMAGE_NAME}}
53+
- "{{.IMAGE_NAME}}"
5454
# TODO
5555
# ## Publish the toolbox image to our ECR repo
5656
# publish: build

0 commit comments

Comments
 (0)