Skip to content

Commit 762015a

Browse files
Match correct existing comment
1 parent 2e4c8f7 commit 762015a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

assets/helpers/bitbucket.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,25 +115,26 @@ bitbucket_pullrequest_progress_commit_match() {
115115
local comment="$1"
116116
local hash="$2"
117117
local type=${3:-(Started|Finished)}
118-
echo "$comment" | grep -Ec "^\[\*Build$type\* \*\*${BUILD_PIPELINE_NAME}\-${BUILD_JOB_NAME}\*\* for $hash" > /dev/null
118+
local build_url_job="$ATC_EXTERNAL_URL/teams/$(rawurlencode "$BUILD_TEAM_NAME")/pipelines/$(rawurlencode "$BUILD_PIPELINE_NAME")/jobs/$(rawurlencode "$BUILD_JOB_NAME")"
119+
echo "$comment" | grep -Ec "^\[\*Build$type\* at \*\*\[${BUILD_PIPELINE_NAME} \> ${BUILD_JOB_NAME}\]\($build_url_job\)\*\* for $hash" > /dev/null
119120
}
120121

121122
bitbucket_pullrequest_progress_comment() {
122123
# $1: status (success, failure or pending)
123124
# $2: hash of merge commit
124125
# $3: hash of source commit
125126
# $4: hash of target commit
126-
build_url_job="$ATC_EXTERNAL_URL/teams/$(rawurlencode "$BUILD_TEAM_NAME")/pipelines/$(rawurlencode "$BUILD_PIPELINE_NAME")/jobs/$(rawurlencode "$BUILD_JOB_NAME")"
127-
build_url="${build_url_job}/builds/$(rawurlencode "$BUILD_NAME")"
128-
build_status_pre="[*Build"
129-
build_status_post="* at **[${BUILD_PIPELINE_NAME} > ${BUILD_JOB_NAME}]($build_url_job)** for $2"
127+
local build_url_job="$ATC_EXTERNAL_URL/teams/$(rawurlencode "$BUILD_TEAM_NAME")/pipelines/$(rawurlencode "$BUILD_PIPELINE_NAME")/jobs/$(rawurlencode "$BUILD_JOB_NAME")"
128+
local build_url="${build_url_job}/builds/$(rawurlencode "$BUILD_NAME")"
129+
local build_status_pre="[*Build"
130+
local build_status_post="* at **[${BUILD_PIPELINE_NAME} > ${BUILD_JOB_NAME}]($build_url_job)** for $2"
130131
if [ "$2" == "$3" ]; then
131132
build_status_post+=" into $4]"
132133
else
133134
build_status_post="] $3 into $4"
134135
fi
135-
build_result_pre=" \n\n **["
136-
build_result_post="]($build_url)** - Build #$BUILD_NAME"
136+
local build_result_pre=" \n\n **["
137+
local build_result_post="]($build_url)** - Build #$BUILD_NAME"
137138

138139
case "$1" in
139140
success)

0 commit comments

Comments
 (0)