From 5f268767b673aa6e133cf3127a0cc3c1bdab3793 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Tue, 30 Dec 2025 13:16:11 +0000 Subject: [PATCH 1/3] remove deprecated packages --- .../build-and-push-tutorial-agent.yml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/.github/workflows/build-and-push-tutorial-agent.yml b/.github/workflows/build-and-push-tutorial-agent.yml index 0ed78058..f1230ad7 100644 --- a/.github/workflows/build-and-push-tutorial-agent.yml +++ b/.github/workflows/build-and-push-tutorial-agent.yml @@ -56,6 +56,7 @@ jobs: needs: [check-permissions] outputs: agents: ${{ steps.get-agents.outputs.agents }} + all_agents: ${{ steps.get-agents.outputs.all_agents }} has_agents: ${{ steps.get-agents.outputs.has_agents }} steps: - name: Checkout repository @@ -72,6 +73,10 @@ jobs: all_agents=$(find examples/tutorials -name "manifest.yaml" -exec dirname {} \; | sort) agents_to_build=() + # Output all agents for deprecation check + all_agents_json=$(printf '%s\n' $all_agents | jq -R -s -c 'split("\n") | map(select(length > 0))') + echo "all_agents=$all_agents_json" >> $GITHUB_OUTPUT + if [ "$REBUILD_ALL" = "true" ]; then echo "Rebuild all agents requested" agents_to_build=($(echo "$all_agents")) @@ -199,3 +204,73 @@ jobs: agentex agents build $BUILD_ARGS echo "✅ Build validation successful for: ${{ matrix.agent_path }}" fi + + deprecate-agents: + name: "Deprecate Removed Agents" + runs-on: ubuntu-latest + needs: [find-agents] + steps: + - name: Find and delete deprecated agent packages + env: + GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }} + run: | + set -e + + echo "🔍 Agents in repo (from find-agents):" + # Convert JSON array of paths to package names + # e.g., "examples/tutorials/00_sync/000_hello_acp" -> "00_sync-000_hello_acp" + REPO_AGENTS=$(echo '${{ needs.find-agents.outputs.all_agents }}' | jq -r '.[]' | \ + sed 's|examples/tutorials/||' | \ + sed 's|/|-|g') + echo "$REPO_AGENTS" + + echo "" + echo "🔍 Fetching packages from GitHub Container Registry..." + PACKAGES=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/orgs/scaleapi/packages?package_type=container&per_page=100") + + # Check for API errors + if echo "$PACKAGES" | jq -e '.message' > /dev/null 2>&1; then + echo "❌ GitHub API error:" + echo "$PACKAGES" | jq '.' + exit 1 + fi + + # Verify response is an array + if ! echo "$PACKAGES" | jq -e 'type == "array"' > /dev/null 2>&1; then + echo "❌ Unexpected API response format:" + echo "$PACKAGES" | head -c 500 + exit 1 + fi + + # Filter for tutorial-agents from this repo + TUTORIAL_PACKAGES=$(echo "$PACKAGES" | \ + jq -r '.[] | select(.repository != null and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents"))) | .name') + + echo "Tutorial packages in registry:" + echo "$TUTORIAL_PACKAGES" + + # + # echo "" + # echo "🔍 Checking for deprecated packages..." + # while IFS= read -r package_name; do + # [ -z "$package_name" ] && continue + # + # # Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp + # agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||') + # + # if echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then + # echo "✅ $agent_name - still in repo" + # else + # echo "đŸ—‘ī¸ $agent_name - NOT in repo, deleting..." + # curl -s -X DELETE \ + # -H "Authorization: Bearer $GITHUB_TOKEN" \ + # -H "Accept: application/vnd.github+json" \ + # "https://api.github.com/orgs/scaleapi/packages/container/$(echo "$package_name" | sed 's|/|%2F|g')" + # echo " Deleted: $package_name" + # fi + # done <<< "$TUTORIAL_PACKAGES" + + echo "" + echo "✅ Deprecation check complete" From 8b14dcd714a093481c5abfcc7c117bf0345602c5 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Fri, 2 Jan 2026 09:59:47 -0500 Subject: [PATCH 2/3] adding deleted tutorial packages --- .../build-and-push-tutorial-agent.yml | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-and-push-tutorial-agent.yml b/.github/workflows/build-and-push-tutorial-agent.yml index f1230ad7..a8893b09 100644 --- a/.github/workflows/build-and-push-tutorial-agent.yml +++ b/.github/workflows/build-and-push-tutorial-agent.yml @@ -237,13 +237,6 @@ jobs: exit 1 fi - # Verify response is an array - if ! echo "$PACKAGES" | jq -e 'type == "array"' > /dev/null 2>&1; then - echo "❌ Unexpected API response format:" - echo "$PACKAGES" | head -c 500 - exit 1 - fi - # Filter for tutorial-agents from this repo TUTORIAL_PACKAGES=$(echo "$PACKAGES" | \ jq -r '.[] | select(.repository != null and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents"))) | .name') @@ -251,26 +244,33 @@ jobs: echo "Tutorial packages in registry:" echo "$TUTORIAL_PACKAGES" - # - # echo "" - # echo "🔍 Checking for deprecated packages..." - # while IFS= read -r package_name; do - # [ -z "$package_name" ] && continue - # - # # Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp - # agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||') - # - # if echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then - # echo "✅ $agent_name - still in repo" - # else - # echo "đŸ—‘ī¸ $agent_name - NOT in repo, deleting..." - # curl -s -X DELETE \ - # -H "Authorization: Bearer $GITHUB_TOKEN" \ - # -H "Accept: application/vnd.github+json" \ - # "https://api.github.com/orgs/scaleapi/packages/container/$(echo "$package_name" | sed 's|/|%2F|g')" - # echo " Deleted: $package_name" - # fi - # done <<< "$TUTORIAL_PACKAGES" + echo "" + echo "🔍 Checking for deprecated packages..." + while IFS= read -r package_name; do + [ -z "$package_name" ] && continue + + # Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp + agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||') + + if ! echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then + echo "đŸ—‘ī¸ $agent_name - NOT in repo, deleting..." + # URL encode the package name (replace / with %2F) + encoded_package=$(echo "$package_name" | sed 's|/|%2F|g') + response=$(curl -s -w "\n%{http_code}" -X DELETE \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/orgs/scaleapi/packages/container/${encoded_package}") + + http_code=$(echo "$response" | tail -n1) + body=$(echo "$response" | sed '$d') + + if [ "$http_code" = "204" ] || [ "$http_code" = "200" ]; then + echo " ✅ Deleted: $package_name" + else + echo " âš ī¸ Failed to delete $package_name (HTTP $http_code): $body" + fi + fi + done <<< "$TUTORIAL_PACKAGES" echo "" echo "✅ Deprecation check complete" From 0da96748cec04538966c96f13cbcdd26b4f31498 Mon Sep 17 00:00:00 2001 From: Roxanne Farhad Date: Fri, 2 Jan 2026 10:14:13 -0500 Subject: [PATCH 3/3] adding the status check --- .github/workflows/agentex-tutorials-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/agentex-tutorials-test.yml b/.github/workflows/agentex-tutorials-test.yml index eb6da476..581daf4e 100644 --- a/.github/workflows/agentex-tutorials-test.yml +++ b/.github/workflows/agentex-tutorials-test.yml @@ -313,3 +313,9 @@ jobs: echo "â„šī¸ **Tests were cancelled or skipped.**" >> $GITHUB_STEP_SUMMARY fi fi + + - name: Fail if tests failed + if: ${{ needs.test-tutorial.result != 'success' }} + run: | + echo "❌ Test jobs did not succeed. Result: ${{ needs.test-tutorial.result }}" + exit 1