-
Notifications
You must be signed in to change notification settings - Fork 14
78 lines (66 loc) · 2.19 KB
/
cleanup-test-resources.yml
File metadata and controls
78 lines (66 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Cleanup Test Resources
permissions:
contents: read
on:
# Scheduled execution - daily at 2 AM UTC
schedule:
- cron: '0 2 * * *'
# Manual trigger with optional inputs
workflow_dispatch:
inputs:
age_threshold_days:
description: 'Minimum age in days for resources to be deleted'
required: false
default: 1
type: number
dry_run:
description: 'Preview deletions without executing (dry-run mode)'
required: false
default: false
type: boolean
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'gradle'
- name: Build project
run: ./gradlew build -x test
- name: Run cleanup utility
env:
PINECONE_API_KEY: ${{ secrets.PINECONE_API_KEY }}
run: |
# Determine parameters based on trigger type
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
AGE_THRESHOLD=${{ inputs.age_threshold_days }}
DRY_RUN=${{ inputs.dry_run }}
else
# Scheduled run uses default values
AGE_THRESHOLD=1
DRY_RUN=false
fi
# Build command with arguments
ARGS="--age-threshold-days $AGE_THRESHOLD"
if [ "$DRY_RUN" = "true" ]; then
ARGS="$ARGS --dry-run"
fi
echo "Running cleanup with: $ARGS"
# Run the cleanup utility
# Use only the shadow JAR (-all.jar) which contains all dependencies
# This avoids classpath conflicts from mixing regular JAR, shadow JAR, and other artifacts
java -cp build/libs/*-all.jar \
io.pinecone.helpers.IndexCleanupUtility $ARGS
- name: Summary
if: always()
run: |
if [ "${{ job.status }}" = "success" ]; then
echo "✅ Cleanup completed successfully"
else
echo "❌ Cleanup failed - check logs for details"
fi