windmill-4-bash-scripts

Sub-skill of windmill: 4. Bash Scripts.

5 stars

Best use case

windmill-4-bash-scripts is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Sub-skill of windmill: 4. Bash Scripts.

Teams using windmill-4-bash-scripts should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/4-bash-scripts/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/_archive/operations/automation/windmill/4-bash-scripts/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/4-bash-scripts/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How windmill-4-bash-scripts Compares

Feature / Agentwindmill-4-bash-scriptsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Sub-skill of windmill: 4. Bash Scripts.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 4. Bash Scripts

## 4. Bash Scripts


```bash
#!/bin/bash
# scripts/devops/deploy_service.sh
# Deploy a service with health checks and rollback capability.

# Windmill automatically provides these as environment variables
# SERVICE_NAME, VERSION, ENVIRONMENT, DRY_RUN

set -euo pipefail

# Get secrets from Windmill resources
DEPLOY_KEY=$(curl -s -H "Authorization: Bearer $WM_TOKEN" \
  "$BASE_INTERNAL_URL/api/w/$WM_WORKSPACE/resources/get/u/admin/deploy_key" | jq -r '.value.key')

AWS_REGION=$(curl -s -H "Authorization: Bearer $WM_TOKEN" \
  "$BASE_INTERNAL_URL/api/w/$WM_WORKSPACE/resources/get/u/admin/aws_config" | jq -r '.value.region')

log() {
  echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}

deploy_service() {
  local service=$1
  local version=$2
  local env=$3

  log "Deploying $service version $version to $env"

  # Update ECS service
  if [[ "$DRY_RUN" == "true" ]]; then
    log "[DRY RUN] Would update ECS service $service to $version"
    return 0
  fi

  aws ecs update-service \
    --cluster "${env}-cluster" \
    --service "$service" \
    --force-new-deployment \
    --region "$AWS_REGION"

  log "Deployment initiated"
}

wait_for_healthy() {
  local service=$1
  local env=$2
  local max_wait=300
  local interval=10
  local elapsed=0

  log "Waiting for $service to become healthy..."

  while [[ $elapsed -lt $max_wait ]]; do
    local running_count=$(aws ecs describe-services \
      --cluster "${env}-cluster" \
      --services "$service" \
      --region "$AWS_REGION" \
      --query 'services[0].runningCount' \
      --output text)

    local desired_count=$(aws ecs describe-services \
      --cluster "${env}-cluster" \
      --services "$service" \
      --region "$AWS_REGION" \
      --query 'services[0].desiredCount' \
      --output text)

    if [[ "$running_count" == "$desired_count" ]]; then
      log "Service healthy: $running_count/$desired_count tasks running"
      return 0
    fi

    log "Waiting... ($running_count/$desired_count tasks running)"
    sleep $interval
    elapsed=$((elapsed + interval))
  done

  log "ERROR: Service did not become healthy within ${max_wait}s"
  return 1
}

rollback() {
  local service=$1
  local env=$2

  log "Rolling back $service in $env"

  # Get previous task definition
  local prev_task_def=$(aws ecs describe-services \
    --cluster "${env}-cluster" \
    --services "$service" \
    --region "$AWS_REGION" \
    --query 'services[0].deployments[1].taskDefinition' \
    --output text)

  if [[ -z "$prev_task_def" || "$prev_task_def" == "None" ]]; then
    log "ERROR: No previous task definition found for rollback"
    return 1
  fi

  aws ecs update-service \
    --cluster "${env}-cluster" \
    --service "$service" \
    --task-definition "$prev_task_def" \
    --region "$AWS_REGION"

  log "Rollback initiated to $prev_task_def"
}

# Main execution
main() {
  log "=== Deployment Started ==="
  log "Service: $SERVICE_NAME"
  log "Version: $VERSION"
  log "Environment: $ENVIRONMENT"
  log "Dry Run: $DRY_RUN"

  # Deploy
  if ! deploy_service "$SERVICE_NAME" "$VERSION" "$ENVIRONMENT"; then
    log "ERROR: Deployment failed"
    exit 1
  fi

  # Wait for health (skip in dry run)
  if [[ "$DRY_RUN" != "true" ]]; then
    if ! wait_for_healthy "$SERVICE_NAME" "$ENVIRONMENT"; then
      log "Deployment failed health check, initiating rollback"
      rollback "$SERVICE_NAME" "$ENVIRONMENT"
      exit 1
    fi
  fi

  log "=== Deployment Completed Successfully ==="

  # Output result as JSON for Windmill
  cat <<EOF
{
  "status": "success",
  "service": "$SERVICE_NAME",
  "version": "$VERSION",
  "environment": "$ENVIRONMENT",
  "timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
}
EOF
}

main
```

Related Skills

bash-pipefail-grep-error-handling

5
from vamseeachanta/workspace-hub

Handle grep exit codes safely under set -eo pipefail by isolating pipeline failure scope

bash-script-framework-example-1-create-new-cli-tool

5
from vamseeachanta/workspace-hub

Sub-skill of bash-script-framework: Example 1: Create New CLI Tool (+1).

bash-script-framework

5
from vamseeachanta/workspace-hub

Create organized bash script structure with color output, menu systems, error handling, and cross-platform support. Standardizes CLI tooling.

bash-cli-framework-5-error-handling

5
from vamseeachanta/workspace-hub

Sub-skill of bash-cli-framework: 5. Error Handling (+1).

bash-cli-framework-1-color-definitions

5
from vamseeachanta/workspace-hub

Sub-skill of bash-cli-framework: 1. Color Definitions (+3).

docker-6-development-workflow-scripts

5
from vamseeachanta/workspace-hub

Sub-skill of docker: 6. Development Workflow Scripts.

hardware-assessment-scripts

5
from vamseeachanta/workspace-hub

Sub-skill of hardware-assessment: Scripts.

windmill-integration-with-database-and-slack

5
from vamseeachanta/workspace-hub

Sub-skill of windmill: Integration with Database and Slack.

windmill-8-resource-and-secrets-management

5
from vamseeachanta/workspace-hub

Sub-skill of windmill: 8. Resource and Secrets Management.

windmill-6-schedule-management

5
from vamseeachanta/workspace-hub

Sub-skill of windmill: 6. Schedule Management.

windmill-5-flow-orchestration

5
from vamseeachanta/workspace-hub

Sub-skill of windmill: 5. Flow Orchestration.

windmill-3-go-scripts

5
from vamseeachanta/workspace-hub

Sub-skill of windmill: 3. Go Scripts.