File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Script to manage Firebase Functions for a specific test run
4
+ # Usage: ./cleanup-functions.sh <test_run_id> [list|count|delete]
5
+
6
+ if [ $# -lt 1 ]; then
7
+ echo " Usage: $0 <test_run_id> [list|count|delete]"
8
+ echo " test_run_id: The test run ID (e.g., t1756484284414)"
9
+ echo " action: list (default), count, or delete"
10
+ exit 1
11
+ fi
12
+
13
+ TEST_RUN_ID=" $1 "
14
+ ACTION=" ${2:- list} "
15
+ PROJECT_ID=" functions-integration-tests"
16
+
17
+ echo " Managing functions for test run: $TEST_RUN_ID "
18
+ echo " Project: $PROJECT_ID "
19
+ echo " Action: $ACTION "
20
+ echo " ---"
21
+
22
+ # Extract function names for the test run
23
+ FUNCTIONS=$( firebase functions:list --project " $PROJECT_ID " | grep " $TEST_RUN_ID " | cut -d' │' -f2 | sed ' s/ //g' | grep -v " ^$" )
24
+
25
+ if [ -z " $FUNCTIONS " ]; then
26
+ echo " No functions found for test run ID: $TEST_RUN_ID "
27
+ exit 0
28
+ fi
29
+
30
+ # Count functions
31
+ FUNCTION_COUNT=$( echo " $FUNCTIONS " | wc -l | tr -d ' ' )
32
+
33
+ case $ACTION in
34
+ " list" )
35
+ echo " Found $FUNCTION_COUNT functions for test run $TEST_RUN_ID :"
36
+ echo " $FUNCTIONS " | nl
37
+ ;;
38
+ " count" )
39
+ echo " Found $FUNCTION_COUNT functions for test run $TEST_RUN_ID "
40
+ ;;
41
+ " delete" )
42
+ echo " Deleting $FUNCTION_COUNT functions for test run $TEST_RUN_ID ..."
43
+ echo " $FUNCTIONS " | tr ' \n' ' ' | xargs firebase functions:delete --project " $PROJECT_ID " --force
44
+ echo " Cleanup completed!"
45
+ ;;
46
+ * )
47
+ echo " Invalid action: $ACTION "
48
+ echo " Valid actions: list, count, delete"
49
+ exit 1
50
+ ;;
51
+ esac
You can’t perform that action at this time.
0 commit comments