Skip to content

test: debug

test: debug #17

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.RUNNER_PAT }}
id: get-runners
run: |
set -euo pipefail
echo "Fetching available runners..."
response_file=$(mktemp)
gh api /orgs/${{ github.repository_owner }}/actions/runners \
--paginate \
--jq '.runners' > "$response_file"
# 设置 dnode_count 的值
dnode_count=2
# 过滤并格式化 runners
filtered_runners=$(jq -c --argjson count "$dnode_count" '
map(
select(
.labels |
(map(.name) | index("fractal")) != null and
(map(.name) | index("edge_td")) != null
)
| {
name,
labels: (
.labels | map(.name) | join(", ") |
split(", ") |
map(select(. != "")) |
["self-hosted", "Linux", "X64"] + .
)
}
)[:$count]' "$response_file")
echo "✅ Selected runners with formatted labels:"
echo "$filtered_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 |
# (map(.name) |
# contains(["fractal"]) and
# contains(["edge_td"])
# )
# )
# | {name, labels}
# )' "$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
# 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 }}