diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 737a013..7e799e2 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -18,9 +18,3 @@ Please confirm that you have done the following before requesting reviews: ### Description * - -### Experiment Link - - - -GrowthBook Experiment Link: https://app.growthbook.io/features/ diff --git a/.golangci.json b/.golangci.json index 8ab2faf..c5c6d6b 100644 --- a/.golangci.json +++ b/.golangci.json @@ -12,7 +12,7 @@ }, "issues": { "exclude-rules": { - "path": "/", + "path": "_test.go", "linters": ["errcheck"] } }, diff --git a/catalog-info.generator.sh b/catalog-info.generator.sh index e917546..ccfd235 100755 --- a/catalog-info.generator.sh +++ b/catalog-info.generator.sh @@ -10,11 +10,13 @@ if [ ! -f $META_DATA_FILE ]; then cat << EOF >> $META_DATA_FILE { "squad_name": "example-squad", + "dashboard": "https://example.com", "design_document": "https://example.com", "runbook": "https://example.com", "manual_dependencies": [], "type": "application", "lifecycle": "production", + "manual_service_names": [], "example-service-name": { "tags" : [ "language:golang", @@ -30,30 +32,45 @@ fi OUTPUT_FILE="catalog-info.yaml" : > $OUTPUT_FILE # Clear the output file before appending +typeset -A SQUAD_ALIAS +SQUAD_ALIAS[acquisition]=acquisition-squad +SQUAD_ALIAS[decisioning]=mlops-squad +SQUAD_ALIAS[mlops]=mlops-squad +SQUAD_ALIAS[self-service]=self-service-squad +SQUAD_ALIAS[spend]=spend-squad + typeset -A TEAM_MAP TEAM_MAP[acquisition-squad]=backend-engineers -TEAM_MAP[acquisition]=backend-engineers TEAM_MAP[data-engineering]=data-squad -TEAM_MAP[decisioning]=backend-engineers TEAM_MAP[devops]=devops-engineers TEAM_MAP[internal-infra]=devops-engineers +TEAM_MAP[mlops-squad]=backend-engineers TEAM_MAP[self-service-squad]=backend-engineers -TEAM_MAP[self-service]=backend-engineers TEAM_MAP[spend-squad]=backend-engineers -TEAM_MAP[spend]=backend-engineers -squad_exist_in_team() { +get_squad_name() { + local raw_squad_name=$1 + squad_name=${SQUAD_ALIAS[$raw_squad_name]} + if [[ -z $squad_name ]]; then + echo $raw_squad_name + fi + echo $squad_name +} + +get_gh_team() { local pattern=$1 - for key in "${(@k)TEAM_MAP}"; do - if [[ $key == $pattern ]]; then - return 0 - fi - done - return 1 + gh_team=${TEAM_MAP[$pattern]} + if [[ -z $gh_team ]]; then + echo null + fi + echo $gh_team } REPO_NAME=$(basename "$(pwd)") SERVICE_NAMES=(${(s: :)$(yq e '.jobs.repository-release-prod.with.helm_release_names' "$RELEASE_WORKFLOW")}) +if [[ ${#SERVICE_NAMES[@]} == 0 || "$SERVICE_NAMES" == "null" ]]; then + SERVICE_NAMES=(${(s: :)$(jq -r ".manual_service_names[]" $META_DATA_FILE)}) +fi if [[ ${#SERVICE_NAMES[@]} == 0 || "$SERVICE_NAMES" == "null" ]]; then SERVICE_NAMES=($REPO_NAME) fi @@ -62,19 +79,18 @@ SQUAD_NAME=$(yq e '.jobs.repository-release-prod.with.argocd_state_repo' "$RELEA SQUAD_NAME=$(echo "$SQUAD_NAME" | cut -c 14-50) if [[ -z $SQUAD_NAME || "$SQUAD_NAME" == "null" ]]; then SQUAD_NAME=$(jq -r '.squad_name' $META_DATA_FILE) -fi -GH_TEAM="" -if squad_exist_in_team "$SQUAD_NAME"; then - GH_TEAM=${TEAM_MAP[$SQUAD_NAME]} else - GH_TEAM="devops-engineers" + SQUAD_NAME="$SQUAD_NAME-squad" fi +SQUAD_NAME=$(get_squad_name $SQUAD_NAME) +GH_TEAM=$(get_gh_team $SQUAD_NAME) -if [[ "$GH_TEAM" == "null" ]]; then +if [[ "$GH_TEAM" == null ]]; then echo "couldn't find service owner" exit 1 fi +DASHBOARD=$(jq -r '.dashboard' $META_DATA_FILE) DESIGN_DOCUMENT=$(jq -r '.design_document' $META_DATA_FILE) RUNBOOK=$(jq -r '.runbook' $META_DATA_FILE) @@ -136,19 +152,22 @@ $(for tag in "${TAGS[@]}"; do echo " - $tag" done) links: - - url: $DESIGN_DOCUMENT - title: Design Document + - title: Dashboard + url: $DASHBOARD + icon: dashboard + - title: Design Document + url: $DESIGN_DOCUMENT icon: menubook - - url: $RUNBOOK - title: Runbook + - title: Runbook + url: $RUNBOOK icon: help spec: type: $TYPE lifecycle: $LIFECYCLE - owner: group:$SQUAD_NAME-squad + owner: group:$SQUAD_NAME $( if (( ${#DEPENDENCIES[@]} > 0 )); then - echo "dependsOn:" + echo " dependsOn:" fi ) $(for resource in "${DEPENDENCIES[@]}"; do @@ -163,4 +182,3 @@ fixed_content="${file_content%$'\n'}" echo "$fixed_content" > "$OUTPUT_FILE" echo "File generated: $OUTPUT_FILE" -