-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsrc-org.sh
More file actions
executable file
·75 lines (62 loc) · 1.84 KB
/
Copy pathsrc-org.sh
File metadata and controls
executable file
·75 lines (62 loc) · 1.84 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
#!/bin/bash
ACTION=$1
ORG_ALIAS=$2
SOURCE_DIR="agentforce"
MANIFEST_DIR=".tmp_manifest"
API_VERSION="64.0"
# Metadata types to retrieve/delete
METADATA_TYPES=(
"GenAiFunction"
"GenAiPlugin"
"GenAiPlannerBundle"
)
if [[ -z "$ACTION" || -z "$ORG_ALIAS" ]]; then
echo "Usage: $0 [retrieve|deploy|delete] [org-alias]"
exit 1
fi
# Prepare repeated --metadata flags
METADATA_ARGS=()
for TYPE in "${METADATA_TYPES[@]}"; do
METADATA_ARGS+=(--metadata "$TYPE")
done
case "$ACTION" in
retrieve)
echo "🔄 Retrieving metadata from org '$ORG_ALIAS'...${METADATA_ARGS[@]}"
sf project retrieve start --target-org "$ORG_ALIAS" "${METADATA_ARGS[@]}"
;;
deploy)
echo "🚀 Deploying metadata to org '$ORG_ALIAS'..."
sf project deploy start --target-org "$ORG_ALIAS"
;;
delete)
echo "🛠 Generating destructive manifest from '$SOURCE_DIR'..."
rm -rf "$MANIFEST_DIR"
mkdir -p "$MANIFEST_DIR"
sf project generate manifest \
--source-dir "$SOURCE_DIR" \
--type destroy \
--output-dir "$MANIFEST_DIR"
if [[ ! -f "$MANIFEST_DIR/destructiveChanges.xml" ]]; then
echo "✅ No deletable metadata found in '$SOURCE_DIR'. Nothing to delete."
exit 0
fi
echo "📄 Creating minimal package.xml..."
cat > "$MANIFEST_DIR/package.xml" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<version>$API_VERSION</version>
</Package>
EOF
echo "🚨 Deleting GenAI metadata from org '$ORG_ALIAS'..."
sf project deploy start \
--target-org "$ORG_ALIAS" \
--manifest "$MANIFEST_DIR/package.xml" \
--pre-destructive-changes "$MANIFEST_DIR/destructiveChanges.xml"
rm -rf "$MANIFEST_DIR"
echo "✅ Deletion complete."
;;
*)
echo "❌ Invalid action: $ACTION. Use retrieve, deploy, or delete."
exit 1
;;
esac