Skip to content

Commit 6f6689d

Browse files
adamanciniclaude
andcommitted
add utils task to retrieve customer license ID
Adds get-customer-license task to utils.yml that: - Takes CUSTOMER_NAME parameter to lookup license ID - Uses Replicated CLI to query customers by name - Provides helpful error messages if customer not found - Outputs license ID for use in other commands/workflows Updates workflow to use the new task name for consistency. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent d3b3ffd commit 6f6689d

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/workflows/wg-easy-pr-validation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ jobs:
309309
CHANNEL_NAME=$(echo "$BRANCH_NAME" | tr '[:upper:]' '[:lower:]')
310310
311311
# Get customer license ID
312-
LICENSE_ID=$(task customer-get-license CUSTOMER_NAME="$BRANCH_NAME" | grep -o '[A-Za-z0-9]\{27\}' | head -1)
312+
LICENSE_ID=$(task get-customer-license CUSTOMER_NAME="$BRANCH_NAME" | grep -o '[A-Za-z0-9]\{27\}' | head -1)
313313
314314
# Use taskfile helm-install with replicated helmfile environment
315315
task helm-install

applications/wg-easy/taskfiles/utils.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,34 @@ tasks:
232232
exit 1
233233
fi
234234
235+
get-customer-license:
236+
desc: Retrieve a customer's license ID by name
237+
silent: false
238+
vars:
239+
CUSTOMER_NAME: '{{.CUSTOMER_NAME | default ""}}'
240+
cmds:
241+
- |
242+
if [ -z "{{.CUSTOMER_NAME}}" ]; then
243+
echo "ERROR: CUSTOMER_NAME is required"
244+
echo "Usage: task utils:get-customer-license CUSTOMER_NAME=your-customer-name"
245+
exit 1
246+
fi
247+
248+
echo "Looking up license ID for customer: {{.CUSTOMER_NAME}}"
249+
250+
# Get customer license ID using Replicated CLI
251+
LICENSE_ID=$(replicated customer ls --output json | jq -r '.[] | select(.name == "{{.CUSTOMER_NAME}}") | .license_id')
252+
253+
if [ -z "$LICENSE_ID" ] || [ "$LICENSE_ID" = "null" ]; then
254+
echo "ERROR: Could not find customer with name '{{.CUSTOMER_NAME}}'"
255+
echo "Available customers:"
256+
replicated customer ls --output json | jq -r '.[] | " - \(.name) (ID: \(.id))"'
257+
exit 1
258+
fi
259+
260+
echo "Customer '{{.CUSTOMER_NAME}}' license ID: $LICENSE_ID"
261+
echo "$LICENSE_ID"
262+
235263
gcp-operations:
236264
desc: GCP VM operations
237265
internal: true

0 commit comments

Comments
 (0)