diff --git a/applications/wg-easy/README.md b/applications/wg-easy/README.md index 89117101..73297507 100644 --- a/applications/wg-easy/README.md +++ b/applications/wg-easy/README.md @@ -68,6 +68,30 @@ applications/wg-easy/ └── Taskfile.yaml # Main task definitions ``` +## Quick Start + +The pattern provides a complete workflow from development to deployment. Here are the essential commands: + +```bash +# List all available tasks +task --list + +# Create a test environment and deploy (verbose mode for detailed output) +task -v full-test-cycle + +# Individual development tasks +task cluster-create # Create test cluster +task -v helm-install # Deploy charts with detailed output +task test # Run validation tests +task cluster-delete # Clean up resources + +# Release preparation +task release-prepare # Package charts and merge configs +task release-create # Create and promote release +``` + +**Tip**: Use `task -v ` for detailed execution output during development and debugging. + ## Architecture Overview Key components: diff --git a/applications/wg-easy/Taskfile.yaml b/applications/wg-easy/Taskfile.yaml index 1c5eb454..8c134d7c 100644 --- a/applications/wg-easy/Taskfile.yaml +++ b/applications/wg-easy/Taskfile.yaml @@ -49,17 +49,17 @@ vars: CMX_VM_USER: '{{.CMX_VS_USER}}' CMX_VM_PUBLIC_KEY: '{{.CMX_VM_PUBLIC_KEY}}' +silent: true + tasks: default: desc: Show available tasks - silent: true cmds: - task --list cluster-create: desc: Create a test cluster using Replicated Compatibility Matrix (use EMBEDDED=true for embedded clusters) run: once - silent: false vars: EMBEDDED: '{{.EMBEDDED | default "false"}}' TIMEOUT: '{{if eq .EMBEDDED "true"}}420{{else}}300{{end}}' @@ -98,7 +98,6 @@ tasks: test: desc: Run a basic test suite - silent: false cmds: - echo "Running basic tests..." - echo "This is a placeholder for actual tests" @@ -107,7 +106,6 @@ tasks: verify-kubeconfig: desc: Verify kubeconfig - silent: false run: once cmds: - | @@ -125,7 +123,6 @@ tasks: setup-kubeconfig: desc: Get kubeconfig and prepare cluster for application deployment - silent: false run: once cmds: - task: utils:get-kubeconfig @@ -147,7 +144,6 @@ tasks: dependencies-update: desc: Update Helm dependencies for all charts - silent: false run: once cmds: - echo "Updating Helm dependencies for all charts..." @@ -161,7 +157,6 @@ tasks: cluster-ports-expose: desc: Expose configured ports for a cluster and capture exposed URLs - silent: false run: once status: - | @@ -190,7 +185,6 @@ tasks: helm-preflight: desc: Run preflight checks on Helm charts using preflight CLI (use DRY_RUN=true for dry-run) - silent: false vars: DRY_RUN: '{{.DRY_RUN | default "false"}}' cmds: @@ -209,7 +203,6 @@ tasks: helm-install: desc: Install all charts using helmfile - silent: true vars: HELM_ENV: '{{.HELM_ENV | default "default"}}' cmds: @@ -235,7 +228,6 @@ tasks: helm-uninstall: desc: Uninstall all charts using helm uninstall - silent: false cmds: - echo "Uninstalling all charts via helm" - | @@ -257,7 +249,6 @@ tasks: cluster-delete: desc: Delete all test clusters with matching name and clean up kubeconfig - silent: false cmds: - echo "Deleting clusters named {{.CLUSTER_NAME}}..." - | @@ -281,7 +272,6 @@ tasks: release-prepare: desc: Prepare release files by copying replicated YAML files and packaging Helm charts - silent: false cmds: - echo "Preparing release files..." - rm -rf ./release @@ -346,7 +336,6 @@ tasks: release-create: desc: Create and promote a release using the Replicated CLI - silent: false run: once vars: RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}' @@ -366,7 +355,6 @@ tasks: customer-create: desc: Create a new customer or get existing customer with matching name and return their ID - silent: false run: once vars: CUSTOMER_NAME: '{{.CUSTOMER_NAME | default "test-customer"}}' @@ -413,7 +401,6 @@ tasks: gcp-vm-create: desc: Create a simple GCP VM instance - silent: false vars: GCP_MACHINE_TYPE: '{{.GCP_MACHINE_TYPE | default "e2-standard-2"}}' GCP_DISK_SIZE: '{{.GCP_DISK_SIZE | default "100"}}' @@ -434,7 +421,6 @@ tasks: gcp-vm-delete: desc: Delete the GCP VM instance for K8s and VPN - silent: false status: - "! gcloud compute instances describe {{.VM_NAME}} --project={{.GCP_PROJECT}} --zone={{.GCP_ZONE}} &>/dev/null" cmds: @@ -447,7 +433,6 @@ tasks: embedded-cluster-setup: desc: Setup Replicated embedded cluster on the GCP VM - silent: false vars: RELEASE_CHANNEL: '{{.RELEASE_CHANNEL | default "Unstable"}}' AUTH_TOKEN: '{{.AUTH_TOKEN | default "2usDXzovcJNcpn54yS5tFQVNvCq"}}' @@ -470,7 +455,6 @@ tasks: customer-ls: desc: List customers for the application - silent: false vars: OUTPUT_FORMAT: '{{.OUTPUT_FORMAT | default "table"}}' requires: @@ -481,7 +465,6 @@ tasks: customer-delete: desc: Archive a customer by ID - silent: false vars: CUSTOMER_ID: '{{.CUSTOMER_ID}}' requires: @@ -507,7 +490,6 @@ tasks: clean: desc: Remove temporary Helm directories, chart dependencies, and release folder - silent: false cmds: - echo "Cleaning temporary directories and dependencies..." - | @@ -535,7 +517,6 @@ tasks: full-test-cycle: desc: Create cluster, get kubeconfig, expose ports, update dependencies, deploy charts, test, and delete, and clean up build artifacts - silent: false cmds: - task: cluster-create - task: setup-kubeconfig @@ -549,7 +530,6 @@ tasks: cmx-vm-create: desc: Create a CMX VM instance using Replicated CLI run: once - silent: true status: - | # Check if VM is running @@ -575,7 +555,6 @@ tasks: cmx-vm-delete: desc: Delete a CMX VM instance - silent: true cmds: - | echo "Deleting CMX VM {{.CMX_VM_NAME}}..." @@ -583,7 +562,6 @@ tasks: cmx-vm-install: desc: Download and install the app as Embedded Cluster on CMX VM - silent: true requires: vars: [REPLICATED_LICENSE_ID] vars: diff --git a/applications/wg-easy/docs/development-workflow.md b/applications/wg-easy/docs/development-workflow.md index b8552a2e..f4ce823d 100644 --- a/applications/wg-easy/docs/development-workflow.md +++ b/applications/wg-easy/docs/development-workflow.md @@ -26,6 +26,20 @@ Before starting the development workflow, ensure you have the following tools in All other tools will be automatically provided through task commands and containers. +### Debugging with Verbose Mode + +All tasks run in silent mode by default. When debugging issues or understanding what's happening during development, use the verbose flag: + +```bash +# Show detailed execution for debugging +task -v cluster-create +task -v helm-install + +# Standard silent output for production use +task cluster-create +task helm-install +``` + ## Workflow Stages ### Stage 1: Chart Dependencies and Verification @@ -135,6 +149,16 @@ Deploy individual charts to a test cluster to verify functionality. task setup-kubeconfig ``` + **Debugging cluster issues:** + ```bash + # Use verbose mode to see detailed cluster creation process + task -v cluster-create + task -v setup-kubeconfig + + # Check cluster status manually + task cluster-list + ``` + 2. Run preflight checks on your chart: ```bash @@ -143,6 +167,12 @@ Deploy individual charts to a test cluster to verify functionality. helm template ./charts/wg-easy | kubectl preflight - --dry-run ``` + **Debugging preflight issues:** + ```bash + # See detailed preflight execution + task -v helm-preflight + ``` + 3. Install a single chart: ```bash diff --git a/applications/wg-easy/docs/task-reference.md b/applications/wg-easy/docs/task-reference.md index 8062300e..cb70fe9e 100644 --- a/applications/wg-easy/docs/task-reference.md +++ b/applications/wg-easy/docs/task-reference.md @@ -2,6 +2,39 @@ 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. +## Task Control Options + +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: + +| Flag | Description | Example | +|------|-------------|---------| +| `--verbose` or `-v` | Show detailed task execution information including commands being run | `task -v cluster-create` | +| `--silent` or `-s` | Suppress all output except errors | `task -s dependencies-update` | +| (default) | Silent mode - shows command output but not task execution details | `task cluster-create` | + +### Verbose Mode Examples + +**Development and Debugging:** +```bash +# See detailed cluster creation process +task -v cluster-create + +# Debug helm installation issues +task -v helm-install + +# Watch full test cycle execution +task -v full-test-cycle +``` + +**Production Use:** +```bash +# Suppress all output for automation +task -s release-prepare + +# Standard output for CI/CD +task release-create +``` + ## Development Tasks These tasks support the iterative development process, focusing on fast feedback loops. diff --git a/applications/wg-easy/taskfiles/utils.yml b/applications/wg-easy/taskfiles/utils.yml index 21f6d26e..0b216663 100644 --- a/applications/wg-easy/taskfiles/utils.yml +++ b/applications/wg-easy/taskfiles/utils.yml @@ -4,7 +4,6 @@ tasks: get-kubeconfig: desc: Get kubeconfig for the test cluster (internal) internal: true - silent: false run: once cmds: - | @@ -16,7 +15,6 @@ tasks: remove-k3s-traefik: desc: Remove pre-installed Traefik from k3s clusters (internal) internal: true - silent: false run: once status: - | @@ -58,7 +56,6 @@ tasks: wait-for-cluster: desc: Wait for cluster to be in running state internal: true - silent: true vars: CLUSTER_NAME: '{{.CLUSTER_NAME}}' TIMEOUT: '{{.TIMEOUT | default "300"}}' @@ -90,7 +87,6 @@ tasks: port-operations: desc: Expose and check status of ports - silent: true vars: OPERATION: '{{.OPERATION | default "expose"}}' CLUSTER_NAME: '{{.CLUSTER_NAME}}' @@ -125,7 +121,6 @@ tasks: vendor-api-auth: desc: Verify authorization against Replicated Vendor API - silent: false vars: API_TOKEN: '{{.REPLICATED_API_TOKEN | default (env "REPLICATED_API_TOKEN")}}' cmds: @@ -160,7 +155,6 @@ tasks: gcp-operations: desc: GCP VM operations internal: true - silent: true vars: OPERATION: '{{.OPERATION}}' GCP_PROJECT: '{{.GCP_PROJECT}}'