Skip to content

Commit 98c5a6b

Browse files
committed
Update internal taskfile from main
Signed-off-by: Scott Rigby <[email protected]>
1 parent 3751248 commit 98c5a6b

File tree

1 file changed

+72
-54
lines changed

1 file changed

+72
-54
lines changed

applications/wg-easy/taskfiles/internal.yaml

Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ includes:
66

77
vars:
88
# Application configuration
9-
APP_SLUG: '{{.REPLICATED_APP | default "wg-easy"}}'
9+
APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}'
10+
APP_SLUG: '{{.REPLICATED_APP_SLUG | default "wg-easy-cre"}}'
1011

1112
# Release configuration
12-
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
13+
RELEASE_CHANNELd: '{{.RELEASE_CHANNEL | default "Unstable"}}'
1314
RELEASE_VERSION: '{{.RELEASE_VERSION | default "0.0.1"}}'
1415
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
1516

@@ -33,7 +34,19 @@ vars:
3334
GCP_ZONE: '{{.GCP_ZONE | default "us-central1-a"}}'
3435
VM_NAME: '{{.VM_NAME | default (printf "%s-dev" (or (env "GUSER") "user"))}}'
3536

37+
# Container workflow configuration
38+
DEV_CONTAINER_REGISTRY: '{{.DEV_CONTAINER_REGISTRY | default "ghcr.io"}}'
39+
DEV_CONTAINER_IMAGE: '{{.DEV_CONTAINER_IMAGE | default "replicatedhq/platform-examples/wg-easy-tools"}}'
40+
DEV_CONTAINER_TAG: '{{.DEV_CONTAINER_TAG | default "latest"}}'
41+
DEV_CONTAINER_NAME: '{{.DEV_CONTAINER_NAME | default "wg-easy-tools"}}'
42+
CONTAINER_RUNTIME: '{{.CONTAINER_RUNTIME | default "podman"}}'
43+
3644
tasks:
45+
default:
46+
desc: Show available tasks
47+
silent: true
48+
cmds:
49+
- task --list
3750

3851
cluster-create:
3952
desc: Create a test cluster using Replicated Compatibility Matrix (use EMBEDDED=true for embedded clusters)
@@ -43,24 +56,24 @@ tasks:
4356
EMBEDDED: '{{.EMBEDDED | default "false"}}'
4457
LICENSE_ID: '{{if eq .EMBEDDED "true"}}{{.LICENSE_ID | default "2cmqT1dBVHZ3aSH21kPxWtgoYGr"}}{{end}}'
4558
TIMEOUT: '{{if eq .EMBEDDED "true"}}420{{else}}300{{end}}'
59+
TTL: '{{.TTL | default "4h"}}'
4660
status:
4761
- replicated cluster ls --output json | jq -e '.[] | select(.name == "{{.CLUSTER_NAME}}")' > /dev/null
4862
cmds:
4963
- |
5064
if [ "{{.EMBEDDED}}" = "true" ]; then
5165
echo "Creating embedded cluster {{.CLUSTER_NAME}} with license ID {{.LICENSE_ID}}..."
52-
replicated cluster create --distribution embedded-cluster --name {{.CLUSTER_NAME}} --license-id {{.LICENSE_ID}}
66+
replicated cluster create --distribution embedded-cluster --name {{.CLUSTER_NAME}} --license-id {{.LICENSE_ID}} --ttl {{.TTL}}
5367
else
5468
echo "Creating cluster {{.CLUSTER_NAME}} with distribution {{.DISTRIBUTION}}..."
55-
replicated cluster create --name {{.CLUSTER_NAME}} --distribution {{.DISTRIBUTION}} --version {{.K8S_VERSION}} --disk {{.DISK_SIZE}} --instance-type {{.INSTANCE_TYPE}}
69+
replicated cluster create --name {{.CLUSTER_NAME}} --distribution {{.DISTRIBUTION}} --version {{.K8S_VERSION}} --disk {{.DISK_SIZE}} --instance-type {{.INSTANCE_TYPE}} --ttl {{.TTL}}
5670
fi
5771
- task: utils:wait-for-cluster
5872
vars:
5973
TIMEOUT: "{{.TIMEOUT}}"
6074

61-
list-cluster:
75+
cluster-list:
6276
desc: List the cluster
63-
silent: false
6477
cmds:
6578
- |
6679
CLUSTER_ID=$(replicated cluster ls --output json | jq -r '.[] | select(.name == "{{.CLUSTER_NAME}}") | .id')
@@ -119,18 +132,19 @@ tasks:
119132
dependencies-update:
120133
desc: Update Helm dependencies for all charts
121134
silent: false
135+
run: once
122136
cmds:
123137
- echo "Updating Helm dependencies for all charts..."
124138
- |
125139
# Find all charts and update their dependencies
126-
for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
140+
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
127141
echo "Updating dependency $chart_dir"
128-
helm dependency update "$chart_dir"
142+
helm dependency update --skip-refresh "$chart_dir"
129143
done
130144
- echo "All dependencies updated!"
131145

132146
cluster-ports-expose:
133-
desc: Expose configured ports and capture exposed URLs
147+
desc: Expose configured ports for a cluster and capture exposed URLs
134148
silent: false
135149
run: once
136150
status:
@@ -159,7 +173,7 @@ tasks:
159173
- cluster-create
160174

161175
helm-install:
162-
desc: Deploy all charts using helmfile
176+
desc: Install all charts using helmfile
163177
silent: false
164178
cmds:
165179
- echo "Installing all charts via helmfile"
@@ -177,10 +191,10 @@ tasks:
177191
# Deploy with helmfile
178192
echo "Using $ENV_VARS"
179193
eval "KUBECONFIG={{.KUBECONFIG_FILE}} $ENV_VARS helmfile sync --wait"
180-
- echo "All charts deployed!"
194+
- echo "All charts installed!"
181195
deps:
182196
- setup-kubeconfig
183-
- ports-expose
197+
- cluster-ports-expose
184198

185199
cluster-delete:
186200
desc: Delete all test clusters with matching name and clean up kubeconfig
@@ -262,10 +276,10 @@ tasks:
262276
- echo "Packaging Helm charts..."
263277
- |
264278
# Find top-level directories containing Chart.yaml files
265-
for chart_dir in $(find . -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
279+
for chart_dir in $(find charts/ -maxdepth 2 -name "Chart.yaml" | xargs dirname); do
266280
echo "Packaging chart: $chart_dir"
267281
# Navigate to chart directory, package it, and move the resulting .tgz to release folder
268-
(cd "$chart_dir" && helm package . && mv *.tgz ../release/)
282+
(cd "$chart_dir" && helm package . && mv *.tgz ../../release/)
269283
done
270284
271285
- echo "Release files prepared in ./release/ directory"
@@ -275,16 +289,20 @@ tasks:
275289
release-create:
276290
desc: Create and promote a release using the Replicated CLI
277291
silent: false
292+
run: once
278293
vars:
279294
CHANNEL: '{{.CHANNEL | default "Unstable"}}'
295+
VERSION: '{{.VERSION | default "0.0.1"}}'
280296
RELEASE_NOTES: '{{.RELEASE_NOTES | default "Release created via task release-create"}}'
297+
requires:
298+
vars: [APP_SLUG, VERSION]
281299
cmds:
282-
- echo "Creating and promoting release for $APP_SLUG to channel $CHANNEL..."
300+
- echo "Creating and promoting release for {{.APP_SLUG}} to channel {{.CHANNEL}}..."
283301
- |
284302
# Create and promote the release in one step
285303
echo "Creating release from files in ./release directory..."
286-
replicated release create --app $APP_SLUG --yaml-dir ./release --release-notes "$RELEASE_NOTES" --promote $CHANNEL --version $VERSION
287-
echo "Release version $VERSION created and promoted to channel $CHANNEL"
304+
replicated release create --app {{.APP_SLUG}} --yaml-dir ./release --release-notes "{{.RELEASE_NOTES}}" --promote {{.CHANNEL}} --version {{.VERSION}}
305+
echo "Release version {{.VERSION}} created and promoted to channel {{.CHANNEL}}"
288306
deps:
289307
- release-prepare
290308

@@ -335,43 +353,6 @@ tasks:
335353
# Extract and output just the customer ID
336354
echo "$CUSTOMER_JSON" | jq -r '.id'
337355
338-
customer-ls:
339-
desc: List customers for the application
340-
silent: false
341-
vars:
342-
OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}'
343-
requires:
344-
vars: [APP_SLUG]
345-
cmds:
346-
- echo "Listing customers for app {{.APP_SLUG}}..."
347-
- replicated customer ls --app {{.APP_SLUG}} --output {{.OUTPUT_FORMAT}}
348-
349-
customer-delete:
350-
desc: Archive a customer by ID
351-
silent: false
352-
vars:
353-
CUSTOMER_ID: '{{.CUSTOMER_ID}}'
354-
requires:
355-
vars: [APP_SLUG, CUSTOMER_ID]
356-
cmds:
357-
- echo "Archiving customer with ID {{.CUSTOMER_ID}} from app {{.APP_SLUG}}..."
358-
- |
359-
# Verify customer exists before attempting to archive
360-
CUSTOMER_EXISTS=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .id')
361-
if [ -z "$CUSTOMER_EXISTS" ]; then
362-
echo "Error: Customer with ID {{.CUSTOMER_ID}} not found for app {{.APP_SLUG}}"
363-
exit 1
364-
fi
365-
366-
# Get customer name for confirmation message
367-
CUSTOMER_NAME=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .name')
368-
369-
# Archive the customer
370-
replicated customer archive {{.CUSTOMER_ID}} --app {{.APP_SLUG}}
371-
372-
# Confirm archiving
373-
echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived"
374-
375356
gcp-vm-create:
376357
desc: Create a simple GCP VM instance
377358
silent: false
@@ -429,6 +410,43 @@ tasks:
429410
GCP_ZONE: '{{.GCP_ZONE}}'
430411
VM_NAME: '{{.VM_NAME}}'
431412

413+
customer-ls:
414+
desc: List customers for the application
415+
silent: false
416+
vars:
417+
OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}'
418+
requires:
419+
vars: [APP_SLUG]
420+
cmds:
421+
- echo "Listing customers for app {{.APP_SLUG}}..."
422+
- replicated customer ls --app {{.APP_SLUG}} --output {{.OUTPUT_FORMAT}}
423+
424+
customer-delete:
425+
desc: Archive a customer by ID
426+
silent: false
427+
vars:
428+
CUSTOMER_ID: '{{.CUSTOMER_ID}}'
429+
requires:
430+
vars: [APP_SLUG, CUSTOMER_ID]
431+
cmds:
432+
- echo "Archiving customer with ID {{.CUSTOMER_ID}} from app {{.APP_SLUG}}..."
433+
- |
434+
# Verify customer exists before attempting to archive
435+
CUSTOMER_EXISTS=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .id')
436+
if [ -z "$CUSTOMER_EXISTS" ]; then
437+
echo "Error: Customer with ID {{.CUSTOMER_ID}} not found for app {{.APP_SLUG}}"
438+
exit 1
439+
fi
440+
441+
# Get customer name for confirmation message
442+
CUSTOMER_NAME=$(replicated customer ls --app {{.APP_SLUG}} --output json | jq -r '.[] | select(.id=="{{.CUSTOMER_ID}}") | .name')
443+
444+
# Archive the customer
445+
replicated customer archive {{.CUSTOMER_ID}} --app {{.APP_SLUG}}
446+
447+
# Confirm archiving
448+
echo "Customer '$CUSTOMER_NAME' (ID: {{.CUSTOMER_ID}}) successfully archived"
449+
432450
clean:
433451
desc: Remove temporary Helm directories, chart dependencies, and release folder
434452
silent: false

0 commit comments

Comments
 (0)