Skip to content

Commit 8f90b89

Browse files
committed
Improve DX
Signed-off-by: Scott Rigby <[email protected]>
1 parent 7a19505 commit 8f90b89

File tree

3 files changed

+25
-54
lines changed

3 files changed

+25
-54
lines changed

applications/wg-easy/Taskfile.yaml

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,11 @@
11
version: "3"
22

3+
# This is a shim taskfile for running tasks inside Podman
4+
# The actual taskfile that is mounted within the container lives in taskfiles/internal.yaml
5+
36
includes:
4-
utils: ./taskfiles/utils.yml
57
dev: ./taskfiles/container.yml
68

7-
vars:
8-
# Application configuration
9-
APP_NAME: '{{.REPLICATED_APP | default "wg-easy"}}'
10-
11-
# Cluster configuration
12-
CLUSTER_NAME: '{{.CLUSTER_NAME | default "test-cluster"}}'
13-
K8S_VERSION: '{{.K8S_VERSION | default "1.32.2"}}'
14-
DISK_SIZE: '{{.DISK_SIZE | default "100"}}'
15-
INSTANCE_TYPE: '{{.INSTANCE_TYPE | default "r1.small"}}'
16-
DISTRIBUTION: '{{.DISTRIBUTION | default "k3s"}}'
17-
KUBECONFIG_FILE: './{{.CLUSTER_NAME}}.kubeconfig'
18-
19-
# Ports configuration
20-
EXPOSE_PORTS:
21-
- port: 30443
22-
protocol: https
23-
- port: 30080
24-
protocol: http
25-
26-
# GCP default configuration
27-
GCP_PROJECT: '{{.GCP_PROJECT | default "replicated-qa"}}'
28-
GCP_ZONE: '{{.GCP_ZONE | default "us-central1-a"}}'
29-
VM_NAME: '{{.VM_NAME | default (printf "%s-dev" (or (env "GUSER") "user"))}}'
30-
31-
# Container workflow configuration
32-
DEV_CONTAINER_REGISTRY: '{{.DEV_CONTAINER_REGISTRY | default "ghcr.io"}}'
33-
DEV_CONTAINER_IMAGE: '{{.DEV_CONTAINER_IMAGE | default "replicatedhq/platform-examples/wg-easy-tools"}}'
34-
DEV_CONTAINER_TAG: '{{.DEV_CONTAINER_TAG | default "latest"}}'
35-
DEV_CONTAINER_NAME: '{{.DEV_CONTAINER_NAME | default "wg-easy-tools"}}'
36-
CONTAINER_RUNTIME: '{{.CONTAINER_RUNTIME | default "podman"}}'
37-
389
tasks:
3910
default:
4011
desc: Show available tasks

applications/wg-easy/taskfiles/container.yml

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
11
version: "3"
22

3+
vars:
4+
DEV_CONTAINER_REGISTRY: '{{.DEV_CONTAINER_REGISTRY | default "ghcr.io"}}'
5+
DEV_CONTAINER_IMAGE: '{{.DEV_CONTAINER_IMAGE | default "replicatedhq/platform-examples/wg-easy-tools"}}'
6+
DEV_CONTAINER_TAG: '{{.DEV_CONTAINER_TAG | default "latest"}}'
7+
DEV_CONTAINER_NAME: '{{.DEV_CONTAINER_NAME | default "wg-easy-tools"}}'
8+
CONTAINER_RUNTIME: '{{.CONTAINER_RUNTIME | default "podman"}}'
9+
310
# Development environment tasks
411
tasks:
12+
shell:
13+
desc: Attach to development container shell
14+
silent: true
15+
requires:
16+
vars: [DEV_CONTAINER_NAME]
17+
deps:
18+
- task: start
19+
cmds:
20+
- echo "Connecting to {{.DEV_CONTAINER_NAME}}..."
21+
- '{{.CONTAINER_RUNTIME}} exec -it {{.DEV_CONTAINER_NAME}} {{.CMD}}'
22+
vars:
23+
CMD: |-
24+
{{if .CMD}}bash -c '{{.CMD}}'{{else}}/bin/bash{{end}}
25+
526
build-image:
627
desc: Build development container image
728
vars:
@@ -45,7 +66,7 @@ tasks:
4566
# Start container with host networking for kubectl port-forward compatibility
4667
CONTAINER_ID=$({{.CONTAINER_RUNTIME}} run --rm --name {{.DEV_CONTAINER_NAME}} -d \
4768
-v $(pwd):/workspace \
48-
-v $(pwd)/internal/Taskfile.yaml:/workspace/Taskfile.yaml \
69+
-v $(pwd)/taskfiles/internal.yaml:/workspace/Taskfile.yaml \
4970
-e REPLICATED_API_TOKEN={{ .REPLICATED_API_TOKEN }} \
5071
{{.IMAGE_NAME}} bash -c 'trap "exit 0" TERM; sleep infinity & wait')
5172
@@ -56,20 +77,6 @@ tasks:
5677
exit 1
5778
fi
5879
59-
shell:
60-
desc: Attach to development container shell
61-
silent: true
62-
requires:
63-
vars: [DEV_CONTAINER_NAME]
64-
deps:
65-
- task: start
66-
cmds:
67-
- echo "Connecting to {{.DEV_CONTAINER_NAME}}..."
68-
- '{{.CONTAINER_RUNTIME}} exec -it {{.DEV_CONTAINER_NAME}} {{.CMD}}'
69-
vars:
70-
CMD: |-
71-
{{if .CMD}}bash -c '{{.CMD}}'{{else}}/bin/bash{{end}}
72-
7380
stop:
7481
desc: Stop development container
7582
silent: true

applications/wg-easy/internal/Taskfile.yaml renamed to applications/wg-easy/taskfiles/internal.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ vars:
2828
GCP_ZONE: '{{.GCP_ZONE | default "us-central1-a"}}'
2929
VM_NAME: '{{.VM_NAME | default (printf "%s-dev" (or (env "GUSER") "user"))}}'
3030

31-
# Container workflow configuration
32-
DEV_CONTAINER_REGISTRY: '{{.DEV_CONTAINER_REGISTRY | default "ghcr.io"}}'
33-
DEV_CONTAINER_IMAGE: '{{.DEV_CONTAINER_IMAGE | default "replicatedhq/platform-examples/wg-easy-tools"}}'
34-
DEV_CONTAINER_TAG: '{{.DEV_CONTAINER_TAG | default "latest"}}'
35-
DEV_CONTAINER_NAME: '{{.DEV_CONTAINER_NAME | default "wg-easy-tools"}}'
36-
CONTAINER_RUNTIME: '{{.CONTAINER_RUNTIME | default "podman"}}'
37-
3831
tasks:
3932
default:
4033
desc: Show available tasks

0 commit comments

Comments
 (0)