replace teleport labels
Build and Push Docker Images / build-and-push (push) Successful in 22s

This commit is contained in:
2025-10-22 21:52:28 +02:00
parent 5b9ff2dc1d
commit 99de6de842
@@ -103,15 +103,14 @@ add_teleport_labels() {
return 1
fi
# Check if labels section already exists under ssh_service
if grep -q " labels:" "$CONFIG_FILE"; then
echo "Labels section already exists, updating..."
# Remove existing labels section
sed -i '/^ labels:/,/^[^ ]/ { /^ labels:/d; /^[^ ]/!d; }' "$CONFIG_FILE"
fi
# Remove any existing labels section
sed -i '/^ labels:/,/^[^[:space:]]/ { /^ labels:/d; /^[^[:space:]]/!d; }' "$CONFIG_FILE"
# Find the line number of ssh_service and add labels after it
ssh_line=$(grep -n "^ssh_service:" "$CONFIG_FILE" | cut -d: -f1)
# Add labels section after ssh_service
sed -i '/^ssh_service:/a\ labels:' "$CONFIG_FILE"
sed -i "${ssh_line}a\\ labels:" "$CONFIG_FILE"
# Parse TELEPORT_LABELS and add each label
IFS=',' read -ra LABELS <<< "$TELEPORT_LABELS"