Skip to content

Commit

Permalink
docs: Fix catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
maetolay committed Dec 13, 2023
1 parent cf4f7d3 commit 74b6707
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
30 changes: 26 additions & 4 deletions catalog-info.generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if [ ! -f $META_DATA_FILE ]; then
"design_document": "https://example.com",
"runbook": "https://example.com",
"manual_dependencies": [],
"type": "application",
"lifecycle": "production",
"example-service-name": {
"tags" : [
"language:golang",
Expand Down Expand Up @@ -81,6 +83,16 @@ if [[ -z $DESIGN_DOCUMENT || -z $RUNBOOK || "$DESIGN_DOCUMENT" == "https://exam
exit 1
fi

TYPE=$(jq -r '.type' $META_DATA_FILE)
if [[ -z $TYPE ]]; then
TYPE="application"
fi

LIFECYCLE=$(jq -r '.lifecycle' $META_DATA_FILE)
if [[ -z $LIFECYCLE || "$LIFECYCLE" == "null" ]]; then
LIFECYCLE="production"
fi

# Loop through each subfolder in the charts directory
for SERVICE in $SERVICE_NAMES; do
# Default dependencies
Expand Down Expand Up @@ -114,7 +126,7 @@ apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: $SERVICE
description: The $SERVICE workload
description: The $SERVICE $TYPE
annotations:
github.com/project-slug: honestbank/$REPO_NAME
github.com/team-slug: honestbank/$GH_TEAM
Expand All @@ -131,14 +143,24 @@ done)
title: Runbook
icon: help
spec:
type: application
lifecycle: production
type: $TYPE
lifecycle: $LIFECYCLE
owner: group:$SQUAD_NAME-squad
dependsOn:
$(
if (( ${#DEPENDENCIES[@]} > 0 )); then
echo "dependsOn:"
fi
)
$(for resource in "${DEPENDENCIES[@]}"; do
echo " - $resource"
done)
EOF
done

# Fix line termination
file_content=$(<"$OUTPUT_FILE")
fixed_content="${file_content%$'\n'}"
echo "$fixed_content" > "$OUTPUT_FILE"

echo "File generated: $OUTPUT_FILE"

7 changes: 3 additions & 4 deletions catalog-info.meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
"design_document": "https://www.notion.so/honestbank/backoff-policy-4333ddff5acb4791a5697908d4ada3f2?pvs=4",
"runbook": "https://www.notion.so/honestbank/backoff-policy-4333ddff5acb4791a5697908d4ada3f2?pvs=4",
"manual_dependencies": [],
"example-service-name": {
"type": "library",
"backoff-policy": {
"tags" : [
"language:golang",
"idempotent:false",
"stateless:false"
"language:golang"
]
}
}
1 change: 0 additions & 1 deletion catalog-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ spec:
type: library
lifecycle: production
owner: group:self-service-squad

0 comments on commit 74b6707

Please sign in to comment.