Skip to content

Commit 5571084

Browse files
Update circleci_pipeline_metadata.sh
1 parent 9d744ac commit 5571084

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

.circleci/scripts/circleci_pipeline_metadata.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ set -euo pipefail
22
sudo apt-get update -y && sudo apt-get install -y jq
33

44
VCS="github"
5-
65
PIPE_NUM="$(curl -sS -H "Circle-Token: ${CIRCLE_TOKEN}" "https://circleci.com/api/v2/pipeline/${CIRCLE_PIPELINE_ID}" | jq -r '.number')"
76
PIPELINE_NAME="$(curl -sS -H "Circle-Token: ${CIRCLE_TOKEN}" "https://circleci.com/api/v2/pipeline/${CIRCLE_PIPELINE_ID}/workflow" | jq -r '.items[0].name')"
87
PIPELINE_URL="https://app.circleci.com/pipelines/${VCS}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${PIPE_NUM}"
98
WORKFLOW_URL="${PIPELINE_URL}/workflows/${CIRCLE_WORKFLOW_ID}"
109
JOB_URL="https://app.circleci.com/pipelines/${VCS}/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/${PIPE_NUM}/workflows/${CIRCLE_WORKFLOW_ID}/jobs/${CIRCLE_BUILD_NUM}"
1110

1211
MSG="$(cat <<EOF
13-
----------- Circle-Ci Error: -------------
12+
----------- Circle-Ci Error -------------
1413
1514
project_name=${CIRCLE_PROJECT_REPONAME}
1615
org=${CIRCLE_PROJECT_USERNAME}
@@ -28,13 +27,13 @@ job_url=${JOB_URL}
2827
------------------------------------------
2928
EOF
3029
)"
31-
# Sustituye los placeholders por sus valores
30+
#Replace the placeholders with their values
3231
MSG="${MSG//%PIPELINE_URL%/${PIPELINE_URL}}"
3332
MSG="${MSG//%WORKFLOW_URL%/${WORKFLOW_URL}}"
3433

3534

36-
# Construye JSON con jq; preserva saltos de línea como \n
35+
#Build JSON with jq; preserve line breaks as \n
3736
PAYLOAD="$(jq -n --arg t "$MSG" '{text:$t}')"
3837

39-
# Exporta para el orb de Slack
38+
# Export for the Slack orb
4039
printf 'export SLACK_PARAM_CUSTOM=%q\n' "$PAYLOAD" >> "$BASH_ENV"

0 commit comments

Comments
 (0)