Files
iot-dc3/dc3-cli/examples/ci-script.sh
T
pnoker b828719d38 feat(cli): adopt dc3-cli into the repository as a standalone module
Move the previously untracked TypeScript CLI into iot-dc3 as an
independently managed module next to dc3-web:

- pnpm workspace (pnpm@11.24.0) with esbuild build approval,
  package renamed to iot-dc3-cli, npm lockfile dropped
- add eslint flat config; lint now runs green after removing
  unused imports/vars and adding switch-case breaks in config.ts
- document CLI conventions and commands in AGENTS.md
2026-09-01 22:03:13 +08:00

40 lines
835 B
Bash
Executable File

#!/bin/bash
# CI/CD Integration Script for dc3-cli
# Uses environment variable for password (never commit real credentials)
set -e
# Check required env vars
if [ -z "$DC3_GATEWAY" ]; then
echo "Error: DC3_GATEWAY is not set"
exit 1
fi
if [ -z "$DC3_PASSWORD" ]; then
echo "Error: DC3_PASSWORD is not set"
exit 1
fi
# Configure and login
dc3 config set gateway "$DC3_GATEWAY"
dc3 auth login \
--tenant "${DC3_TENANT:-default}" \
--username "${DC3_USERNAME:-cicd-bot}" \
--password "$DC3_PASSWORD" \
--store env
echo "✓ Authenticated"
# Run commands
echo "=== Device List ==="
dc3 device list --format json
echo "=== Dashboard Health ==="
dc3 dashboard health --format json
echo "=== Alert Stats ==="
dc3 alert stats --format json
# Cleanup (optional — token will auto-expire)
echo "✓ CI checks completed"