diff --git a/.github/workflows/container-startup-debug.yml b/.github/workflows/container-startup-debug.yml new file mode 100644 index 000000000..8450e188a --- /dev/null +++ b/.github/workflows/container-startup-debug.yml @@ -0,0 +1,143 @@ +name: Container startup debug + +on: + pull_request: + branches: [refactor] + +jobs: + debug: + runs-on: ubuntu-24.04 + timeout-minutes: 25 + permissions: + contents: read + env: + AWS_ACCESS_KEY_ID: debug + AWS_SECRET_ACCESS_KEY: debug + AWS_SESSION_TOKEN: debug + AWS_REGION: us-east-1 + AWS_DEFAULT_REGION: us-east-1 + AWS_EC2_METADATA_DISABLED: "true" + AGENTCORE_TELEMETRY_DISABLED: "1" + + steps: + - uses: actions/checkout@v7 + + - uses: actions/checkout@v7 + with: + repository: Hweinstock/agentcore-cli + ref: fix/project-dev-full-output + path: source + + - uses: oven-sh/setup-bun@v2 + + - uses: actions/setup-node@v4 + with: + node-version: "24" + + - uses: astral-sh/setup-uv@v6 + + - working-directory: source + run: bun install --frozen-lockfile + + - working-directory: source + run: bun run build + + - name: Create one container project and start project dev + shell: bash + run: | + set -uo pipefail + + debug_root="$RUNNER_TEMP/agentcore-container-debug" + mkdir -p "$debug_root" + cli=(node "$GITHUB_WORKSPACE/source/dist/index.js") + + "${cli[@]}" project create \ + --name "ctdbg${GITHUB_RUN_ID}" \ + --template empty \ + --skip-git \ + --json \ + >"$debug_root/create.stdout" \ + 2>"$debug_root/create.stderr" + create_status=$? + if [ "$create_status" -ne 0 ]; then + exit "$create_status" + fi + + project_dir="$(node -e 'console.log(JSON.parse(require("fs").readFileSync(process.argv[1], "utf8")).project.path)' "$debug_root/create.stdout")" + + runtime_specs=( + "agent_python_minimal|agent-python-minimal" + "agent_python_strands|agent-python-strands" + "py_strands_container|agent-python-strands-container" + "agent_python_langchain|agent-python-langchain" + "agent_ts_strands|agent-typescript-strands" + "agent_ts_vercel|agent-typescript-vercel" + "mcp_python_fastmcp|mcp-python-fastmcp" + "a2a_python_strands|a2a-python-strands" + "agui_python_strands|agui-python-strands" + ) + + : >"$debug_root/timing" + for spec in "${runtime_specs[@]}"; do + IFS="|" read -r runtime_name runtime_template <<<"$spec" + echo "$(date --iso-8601=seconds) add $runtime_name" >>"$debug_root/timing" + ( + cd "$project_dir" + "${cli[@]}" project add runtime \ + --name "$runtime_name" \ + --template "$runtime_template" \ + --json + ) >"$debug_root/add-$runtime_name.stdout" 2>"$debug_root/add-$runtime_name.stderr" + add_status=$? + echo "$(date --iso-8601=seconds) add $runtime_name exit=$add_status" >>"$debug_root/timing" + if [ "$add_status" -ne 0 ]; then + exit "$add_status" + fi + done + + echo "$(date --iso-8601=seconds) project-dev start" >>"$debug_root/timing" + set +e + ( + cd "$project_dir" + timeout --signal=TERM --kill-after=20s 360s \ + "${cli[@]}" project dev --mode headless + ) >"$debug_root/dev.stdout" 2>"$debug_root/dev.stderr" + dev_status=$? + echo "$(date --iso-8601=seconds) project-dev exit=$dev_status" >>"$debug_root/timing" + echo "$dev_status" >"$debug_root/dev.exit" + exit "$dev_status" + + - name: Collect container diagnostics + if: always() + shell: bash + run: | + set +e + debug_root="$RUNNER_TEMP/agentcore-container-debug" + + for file in timing create.stdout create.stderr dev.stdout dev.stderr dev.exit; do + echo "===== $file =====" + if [ -f "$debug_root/$file" ]; then + sed -n '1,1200p' "$debug_root/$file" + else + echo "(missing)" + fi + done + + for file in "$debug_root"/add-*.stdout "$debug_root"/add-*.stderr; do + echo "===== ${file##*/} =====" + if [ -f "$file" ]; then + sed -n '1,80p' "$file" + fi + done + + echo "===== project spec =====" + find "$debug_root" -path '*/agentcore/agentcore.json' -print -exec sed -n '1,240p' {} \; + + echo "===== docker info =====" + docker info + + echo "===== docker ps -a =====" + docker ps -a + + echo "===== docker images =====" + docker images