Skip to content

Commit debc2b1

Browse files
authored
Merge pull request #237 from scaleapi/remove-deprecated-packages
Remove deprecated agent packages
2 parents 57d8344 + e3b702c commit debc2b1

File tree

2 files changed

+78
-6
lines changed

2 files changed

+78
-6
lines changed

.github/workflows/agentex-tutorials-test.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Test Tutorial Agents
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
workflow_dispatch:
99

1010
jobs:
@@ -23,11 +23,8 @@ jobs:
2323
# Find all tutorials with a manifest.yaml
2424
all_tutorials=$(find . -name "manifest.yaml" -exec dirname {} \; | sort | sed 's|^\./||')
2525
26-
# Include all tutorials (temporal tutorials are now included)
27-
filtered_tutorials="$all_tutorials"
28-
2926
# Convert to JSON array
30-
tutorials=$(echo "$filtered_tutorials" | jq -R -s -c 'split("\n") | map(select(length > 0))')
27+
tutorials=$(echo "$all_tutorials" | jq -R -s -c 'split("\n") | map(select(length > 0))')
3128
3229
echo "tutorials=$tutorials" >> $GITHUB_OUTPUT
3330
echo "All tutorials found: $(echo "$all_tutorials" | wc -l)"

.github/workflows/build-and-push-tutorial-agent.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
needs: [check-permissions]
5757
outputs:
5858
agents: ${{ steps.get-agents.outputs.agents }}
59+
all_agents: ${{ steps.get-agents.outputs.all_agents }}
5960
has_agents: ${{ steps.get-agents.outputs.has_agents }}
6061
steps:
6162
- name: Checkout repository
@@ -72,6 +73,10 @@ jobs:
7273
all_agents=$(find examples/tutorials -name "manifest.yaml" -exec dirname {} \; | sort)
7374
agents_to_build=()
7475
76+
# Output all agents for deprecation check
77+
all_agents_json=$(printf '%s\n' $all_agents | jq -R -s -c 'split("\n") | map(select(length > 0))')
78+
echo "all_agents=$all_agents_json" >> $GITHUB_OUTPUT
79+
7580
if [ "$REBUILD_ALL" = "true" ]; then
7681
echo "Rebuild all agents requested"
7782
agents_to_build=($(echo "$all_agents"))
@@ -275,3 +280,73 @@ jobs:
275280
docker rm "$CONTAINER_NAME" > /dev/null 2>&1 || true
276281
277282
echo "✅ All validations passed for: $FULL_IMAGE"
283+
284+
deprecate-agents:
285+
name: "Deprecate Removed Agents"
286+
runs-on: ubuntu-latest
287+
needs: [find-agents]
288+
steps:
289+
- name: Find and delete deprecated agent packages
290+
env:
291+
GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
292+
run: |
293+
set -e
294+
295+
echo "🔍 Agents in repo (from find-agents):"
296+
# Convert JSON array of paths to package names
297+
# e.g., "examples/tutorials/00_sync/000_hello_acp" -> "00_sync-000_hello_acp"
298+
REPO_AGENTS=$(echo '${{ needs.find-agents.outputs.all_agents }}' | jq -r '.[]' | \
299+
sed 's|examples/tutorials/||' | \
300+
sed 's|/|-|g')
301+
echo "$REPO_AGENTS"
302+
303+
echo ""
304+
echo "🔍 Fetching packages from GitHub Container Registry..."
305+
PACKAGES=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
306+
-H "Accept: application/vnd.github+json" \
307+
"https://api.github.com/orgs/scaleapi/packages?package_type=container&per_page=100")
308+
309+
# Check for API errors
310+
if echo "$PACKAGES" | jq -e '.message' > /dev/null 2>&1; then
311+
echo "❌ GitHub API error:"
312+
echo "$PACKAGES" | jq '.'
313+
exit 1
314+
fi
315+
316+
# Filter for tutorial-agents from this repo
317+
TUTORIAL_PACKAGES=$(echo "$PACKAGES" | \
318+
jq -r '.[] | select(.repository != null and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents"))) | .name')
319+
320+
echo "Tutorial packages in registry:"
321+
echo "$TUTORIAL_PACKAGES"
322+
323+
echo ""
324+
echo "🔍 Checking for deprecated packages..."
325+
while IFS= read -r package_name; do
326+
[ -z "$package_name" ] && continue
327+
328+
# Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp
329+
agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||')
330+
331+
if ! echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then
332+
echo "🗑️ $agent_name - NOT in repo, deleting..."
333+
# URL encode the package name (replace / with %2F)
334+
encoded_package=$(echo "$package_name" | sed 's|/|%2F|g')
335+
response=$(curl -s -w "\n%{http_code}" -X DELETE \
336+
-H "Authorization: Bearer $GITHUB_TOKEN" \
337+
-H "Accept: application/vnd.github+json" \
338+
"https://api.github.com/orgs/scaleapi/packages/container/${encoded_package}")
339+
340+
http_code=$(echo "$response" | tail -n1)
341+
body=$(echo "$response" | sed '$d')
342+
343+
if [ "$http_code" = "204" ] || [ "$http_code" = "200" ]; then
344+
echo " ✅ Deleted: $package_name"
345+
else
346+
echo " ⚠️ Failed to delete $package_name (HTTP $http_code): $body"
347+
fi
348+
fi
349+
done <<< "$TUTORIAL_PACKAGES"
350+
351+
echo ""
352+
echo "✅ Deprecation check complete"

0 commit comments

Comments
 (0)