Skip to content

Windmill Bash

Add variables from

Create content

# shellcheck shell=bash
LOG_FILE="sync_${TARGET}_${NAME}_$(date +"%Y%m%d-%H%M%S").log"
LOG_FILE_LOCAL="/tmp/${LOG_FILE}"
LOG_FILE_S2="app_sync_logs/${TARGET}/${LOG_FILE}"

S3_URL=$(wmill variable get f/sync/s3_url --json | jq -r .value)
S3_OKEN=$(wmill variable get f/sync/s3_token --json | jq -r .value)

Usage in other script

wmill script get f/include/vars-get --json | jq -r .content > /tmp/v.sh; set -a; source /tmp/v.sh;  set +a

Store JSON in resource

Create resource type: json Create resource f/sync/app_info

{
  "server1": {
    "IP": "10.0.0.1",
    "APP_PATH": "/srv/app1"
  },
  "server8": {
    "IP": "10.0.0.9",
    "APP_PATH": "/srv/app8"
  }
}

Read Data in script

APP_PATH=$(wmill resource get "f/sync/app_info" --json | jq -r --arg t "$APP" '.value[$t].APP_PATH // ""')