test: debug #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy TDengine Cluster | |
on: | |
push: | |
branches: | |
- test/fractal | |
# on: | |
# workflow_dispatch: | |
# inputs: | |
# version: | |
# description: 'Enter the version of TDengine to install' | |
# required: true | |
# default: '3.3.5.1' | |
# group: | |
# description: 'Enter the group for the runner' | |
# required: true | |
# default: 'default' | |
# dnode_count: | |
# description: 'Number of nodes to deploy' | |
# required: true | |
# default: '2' | |
permissions: | |
actions: read | |
contents: read | |
jobs: | |
find-runners: | |
runs-on: ubuntu-latest | |
outputs: | |
runners: ${{ steps.get-runners.outputs.runners }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get Available Runners | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
id: get-runners | |
run: | | |
set -euo pipefail | |
echo "Fetching available runners..." | |
response_file=$(mktemp) | |
if ! gh api "/orgs/${{ github.repository_owner }}/actions/runners" \ | |
--method GET \ | |
--paginate \ | |
--jq '.runners' > "$response_file"; | |
then | |
echo "❌ Failed to fetch runners" | |
exit 1 | |
fi | |
# 验证响应内容 | |
if [ ! -s "$response_file" ]; then | |
echo "⚠️ Empty API response" | |
exit 1 | |
fi | |
# 处理JSON数据 | |
filtered_runners=$(jq -c ' | |
map( | |
select( | |
.labels | any( | |
.name | test("fractal|edge_td"; "i") | |
) | |
) | |
| {name, ip: .ip_address} | |
)' "$response_file") | |
# 验证JSON有效性 | |
if ! jq -e . >/dev/null 2>&1 <<< "$filtered_runners"; then | |
echo "❌ Invalid JSON output" | |
exit 1 | |
fi | |
echo "✅ Filtered runners:" | |
jq . <<< "$filtered_runners" | |
# 使用JSON格式输出 | |
echo "runners=$filtered_runners" >> $GITHUB_OUTPUT | |
# response=$(/orgs/${{ github.repository_owner }}/actions/runners) | |
# if [ -z "$response" ]; then | |
# echo "No response from GitHub API" | |
# exit 1 | |
# else | |
# echo "Response from GitHub API: $response" | |
# fi | |
# available_runners=$(/orgs/${{ github.repository_owner }}/actions/runners | jq -r '.runners[] | select(.labels | any(.name | contains("fractal") or contains("edge_td"))) | {name: .name, ip: .ip_address}') | |
# echo "Available runners: $available_runners" | |
# echo "runners=$available_runners" >> $GITHUB_OUTPUT | |
# call-install: | |
# runs-on: | |
# group: ${{ github.event.inputs.group }} | |
# labels: ${{ fromJson(github.event.inputs.labels) }} | |
# steps: | |
# - name: Check and Install TDengine Enterprise | |
# uses: taosdata/.github/.github/actions/install-tdengine@test/fractal | |
# with: | |
# version: ${{ github.event.inputs.version }} | |
# group: ${{ github.event.inputs.group }} | |
# labels: ${{ github.event.inputs.labels }} | |
# NAS_DOWNLOAD_URL: ${{ secrets.NAS_DOWNLOAD_URL }} |