Skip to content

Commit f5d927e

Browse files
authored
Debug mode (#73)
* refactor: update Taskfile.yaml to set silent mode for various tasks This commit modifies the Taskfile.yaml by setting the 'silent' attribute to true for several tasks, enhancing the output control during task execution. The changes aim to streamline the task execution experience by reducing unnecessary output for specific operations. * docs: enhance README and workflow documentation with verbose mode usage This commit adds a "Quick Start" section to the README.md, outlining essential task commands for development and deployment. It also expands the development workflow documentation to include detailed instructions on using verbose mode for debugging tasks. Additionally, the task reference document is updated to clarify task control options, including examples of using verbose and silent modes. * chore: remove silent mode from various tasks in utils.yml This commit updates the utils.yml file by removing the 'silent' attribute from several tasks, allowing for more verbose output during task execution. This change aims to improve visibility and debugging capabilities for internal tasks.
1 parent 0284242 commit f5d927e

File tree

5 files changed

+89
-30
lines changed

5 files changed

+89
-30
lines changed

applications/wg-easy/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,30 @@ applications/wg-easy/
6868
└── Taskfile.yaml # Main task definitions
6969
```
7070

71+
## Quick Start
72+
73+
The pattern provides a complete workflow from development to deployment. Here are the essential commands:
74+
75+
```bash
76+
# List all available tasks
77+
task --list
78+
79+
# Create a test environment and deploy (verbose mode for detailed output)
80+
task -v full-test-cycle
81+
82+
# Individual development tasks
83+
task cluster-create # Create test cluster
84+
task -v helm-install # Deploy charts with detailed output
85+
task test # Run validation tests
86+
task cluster-delete # Clean up resources
87+
88+
# Release preparation
89+
task release-prepare # Package charts and merge configs
90+
task release-create # Create and promote release
91+
```
92+
93+
**Tip**: Use `task -v <taskname>` for detailed execution output during development and debugging.
94+
7195
## Architecture Overview
7296

7397
Key components:

applications/wg-easy/Taskfile.yaml

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,17 @@ vars:
4949
CMX_VM_USER: '{{.CMX_VS_USER}}'
5050
CMX_VM_PUBLIC_KEY: '{{.CMX_VM_PUBLIC_KEY}}'
5151

52+
silent: true
53+
5254
tasks:
5355
default:
5456
desc: Show available tasks
55-
silent: true
5657
cmds:
5758
- task --list
5859

5960
cluster-create:
6061
desc: Create a test cluster using Replicated Compatibility Matrix (use EMBEDDED=true for embedded clusters)
6162
run: once
62-
silent: false
6363
vars:
6464
EMBEDDED: '{{.EMBEDDED | default "false"}}'
6565
TIMEOUT: '{{if eq .EMBEDDED "true"}}420{{else}}300{{end}}'
@@ -98,7 +98,6 @@ tasks:
9898
9999
test:
100100
desc: Run a basic test suite
101-
silent: false
102101
cmds:
103102
- echo "Running basic tests..."
104103
- echo "This is a placeholder for actual tests"
@@ -107,7 +106,6 @@ tasks:
107106

108107
verify-kubeconfig:
109108
desc: Verify kubeconfig
110-
silent: false
111109
run: once
112110
cmds:
113111
- |
@@ -125,7 +123,6 @@ tasks:
125123
126124
setup-kubeconfig:
127125
desc: Get kubeconfig and prepare cluster for application deployment
128-
silent: false
129126
run: once
130127
cmds:
131128
- task: utils:get-kubeconfig
@@ -147,7 +144,6 @@ tasks:
147144

148145
dependencies-update:
149146
desc: Update Helm dependencies for all charts
150-
silent: false
151147
run: once
152148
cmds:
153149
- echo "Updating Helm dependencies for all charts..."
@@ -161,7 +157,6 @@ tasks:
161157

162158
cluster-ports-expose:
163159
desc: Expose configured ports for a cluster and capture exposed URLs
164-
silent: false
165160
run: once
166161
status:
167162
- |
@@ -190,7 +185,6 @@ tasks:
190185

191186
helm-preflight:
192187
desc: Run preflight checks on Helm charts using preflight CLI (use DRY_RUN=true for dry-run)
193-
silent: false
194188
vars:
195189
DRY_RUN: '{{.DRY_RUN | default "false"}}'
196190
cmds:
@@ -209,7 +203,6 @@ tasks:
209203

210204
helm-install:
211205
desc: Install all charts using helmfile
212-
silent: true
213206
vars:
214207
HELM_ENV: '{{.HELM_ENV | default "default"}}'
215208
cmds:
@@ -235,7 +228,6 @@ tasks:
235228

236229
helm-uninstall:
237230
desc: Uninstall all charts using helm uninstall
238-
silent: false
239231
cmds:
240232
- echo "Uninstalling all charts via helm"
241233
- |
@@ -257,7 +249,6 @@ tasks:
257249

258250
cluster-delete:
259251
desc: Delete all test clusters with matching name and clean up kubeconfig
260-
silent: false
261252
cmds:
262253
- echo "Deleting clusters named {{.CLUSTER_NAME}}..."
263254
- |
@@ -281,7 +272,6 @@ tasks:
281272

282273
release-prepare:
283274
desc: Prepare release files by copying replicated YAML files and packaging Helm charts
284-
silent: false
285275
cmds:
286276
- echo "Preparing release files..."
287277
- rm -rf ./release
@@ -346,7 +336,6 @@ tasks:
346336

347337
release-create:
348338
desc: Create and promote a release using the Replicated CLI
349-
silent: false
350339
run: once
351340
vars:
352341
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
@@ -366,7 +355,6 @@ tasks:
366355

367356
customer-create:
368357
desc: Create a new customer or get existing customer with matching name and return their ID
369-
silent: false
370358
run: once
371359
vars:
372360
CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}'
@@ -413,7 +401,6 @@ tasks:
413401
414402
gcp-vm-create:
415403
desc: Create a simple GCP VM instance
416-
silent: false
417404
vars:
418405
GCP_MACHINE_TYPE: '{{.GCP_MACHINE_TYPE | default "e2-standard-2"}}'
419406
GCP_DISK_SIZE: '{{.GCP_DISK_SIZE | default "100"}}'
@@ -434,7 +421,6 @@ tasks:
434421

435422
gcp-vm-delete:
436423
desc: Delete the GCP VM instance for K8s and VPN
437-
silent: false
438424
status:
439425
- "! gcloud compute instances describe {{.VM_NAME}} --project={{.GCP_PROJECT}} --zone={{.GCP_ZONE}} &>/dev/null"
440426
cmds:
@@ -447,7 +433,6 @@ tasks:
447433

448434
embedded-cluster-setup:
449435
desc: Setup Replicated embedded cluster on the GCP VM
450-
silent: false
451436
vars:
452437
RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}'
453438
AUTH_TOKEN: '{{.AUTH_TOKEN | default "2usDXzovcJNcpn54yS5tFQVNvCq"}}'
@@ -470,7 +455,6 @@ tasks:
470455

471456
customer-ls:
472457
desc: List customers for the application
473-
silent: false
474458
vars:
475459
OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}'
476460
requires:
@@ -481,7 +465,6 @@ tasks:
481465

482466
customer-delete:
483467
desc: Archive a customer by ID
484-
silent: false
485468
vars:
486469
CUSTOMER_ID: '{{.CUSTOMER_ID}}'
487470
requires:
@@ -507,7 +490,6 @@ tasks:
507490
508491
clean:
509492
desc: Remove temporary Helm directories, chart dependencies, and release folder
510-
silent: false
511493
cmds:
512494
- echo "Cleaning temporary directories and dependencies..."
513495
- |
@@ -535,7 +517,6 @@ tasks:
535517

536518
full-test-cycle:
537519
desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete, and clean up build artifacts
538-
silent: false
539520
cmds:
540521
- task: cluster-create
541522
- task: setup-kubeconfig
@@ -549,7 +530,6 @@ tasks:
549530
cmx-vm-create:
550531
desc: Create a CMX VM instance using Replicated CLI
551532
run: once
552-
silent: true
553533
status:
554534
- |
555535
# Check if VM is running
@@ -575,15 +555,13 @@ tasks:
575555
576556
cmx-vm-delete:
577557
desc: Delete a CMX VM instance
578-
silent: true
579558
cmds:
580559
- |
581560
echo "Deleting CMX VM {{.CMX_VM_NAME}}..."
582561
replicated vm rm {{.CMX_VM_NAME}}
583562
584563
cmx-vm-install:
585564
desc: Download and install the app as Embedded Cluster on CMX VM
586-
silent: true
587565
requires:
588566
vars: [REPLICATED_LICENSE_ID]
589567
vars:

applications/wg-easy/docs/development-workflow.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ Before starting the development workflow, ensure you have the following tools in
2626

2727
All other tools will be automatically provided through task commands and containers.
2828

29+
### Debugging with Verbose Mode
30+
31+
All tasks run in silent mode by default. When debugging issues or understanding what's happening during development, use the verbose flag:
32+
33+
```bash
34+
# Show detailed execution for debugging
35+
task -v cluster-create
36+
task -v helm-install
37+
38+
# Standard silent output for production use
39+
task cluster-create
40+
task helm-install
41+
```
42+
2943
## Workflow Stages
3044

3145
### Stage 1: Chart Dependencies and Verification
@@ -135,6 +149,16 @@ Deploy individual charts to a test cluster to verify functionality.
135149
task setup-kubeconfig
136150
```
137151

152+
**Debugging cluster issues:**
153+
```bash
154+
# Use verbose mode to see detailed cluster creation process
155+
task -v cluster-create
156+
task -v setup-kubeconfig
157+
158+
# Check cluster status manually
159+
task cluster-list
160+
```
161+
138162
2. Run preflight checks on your chart:
139163

140164
```bash
@@ -143,6 +167,12 @@ Deploy individual charts to a test cluster to verify functionality.
143167
helm template ./charts/wg-easy | kubectl preflight - --dry-run
144168
```
145169

170+
**Debugging preflight issues:**
171+
```bash
172+
# See detailed preflight execution
173+
task -v helm-preflight
174+
```
175+
146176
3. Install a single chart:
147177

148178
```bash

applications/wg-easy/docs/task-reference.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,39 @@
22

33
This document provides a concise reference for the tasks available in the WG-Easy Helm chart development pattern, organized by their purpose in the development workflow.
44

5+
## Task Control Options
6+
7+
All tasks are configured to run in silent mode by default, showing only essential output. You can control the verbosity level using Task's built-in flags:
8+
9+
| Flag | Description | Example |
10+
|------|-------------|---------|
11+
| `--verbose` or `-v` | Show detailed task execution information including commands being run | `task -v cluster-create` |
12+
| `--silent` or `-s` | Suppress all output except errors | `task -s dependencies-update` |
13+
| (default) | Silent mode - shows command output but not task execution details | `task cluster-create` |
14+
15+
### Verbose Mode Examples
16+
17+
**Development and Debugging:**
18+
```bash
19+
# See detailed cluster creation process
20+
task -v cluster-create
21+
22+
# Debug helm installation issues
23+
task -v helm-install
24+
25+
# Watch full test cycle execution
26+
task -v full-test-cycle
27+
```
28+
29+
**Production Use:**
30+
```bash
31+
# Suppress all output for automation
32+
task -s release-prepare
33+
34+
# Standard output for CI/CD
35+
task release-create
36+
```
37+
538
## Development Tasks
639

740
These tasks support the iterative development process, focusing on fast feedback loops.

applications/wg-easy/taskfiles/utils.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ tasks:
44
get-kubeconfig:
55
desc: Get kubeconfig for the test cluster (internal)
66
internal: true
7-
silent: false
87
run: once
98
cmds:
109
- |
@@ -16,7 +15,6 @@ tasks:
1615
remove-k3s-traefik:
1716
desc: Remove pre-installed Traefik from k3s clusters (internal)
1817
internal: true
19-
silent: false
2018
run: once
2119
status:
2220
- |
@@ -58,7 +56,6 @@ tasks:
5856
wait-for-cluster:
5957
desc: Wait for cluster to be in running state
6058
internal: true
61-
silent: true
6259
vars:
6360
CLUSTER_NAME: '{{.CLUSTER_NAME}}'
6461
TIMEOUT: '{{.TIMEOUT | default "300"}}'
@@ -90,7 +87,6 @@ tasks:
9087
9188
port-operations:
9289
desc: Expose and check status of ports
93-
silent: true
9490
vars:
9591
OPERATION: '{{.OPERATION | default "expose"}}'
9692
CLUSTER_NAME: '{{.CLUSTER_NAME}}'
@@ -125,7 +121,6 @@ tasks:
125121
126122
vendor-api-auth:
127123
desc: Verify authorization against Replicated Vendor API
128-
silent: false
129124
vars:
130125
API_TOKEN: '{{.REPLICATED_API_TOKEN | default (env "REPLICATED_API_TOKEN")}}'
131126
cmds:
@@ -160,7 +155,6 @@ tasks:
160155
gcp-operations:
161156
desc: GCP VM operations
162157
internal: true
163-
silent: true
164158
vars:
165159
OPERATION: '{{.OPERATION}}'
166160
GCP_PROJECT: '{{.GCP_PROJECT}}'

0 commit comments

Comments
 (0)