Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Seipel
gitlab-runner
Commits
e357415e
Unverified
Commit
e357415e
authored
6 years ago
by
Tomasz Maczukin
Browse files
Options
Downloads
Patches
Plain Diff
Add slack notification option for 'dep status' check failures
parent
96d88322
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/dep_status_check
+24
-0
24 additions, 0 deletions
scripts/dep_status_check
with
24 additions
and
0 deletions
scripts/dep_status_check
+
24
−
0
View file @
e357415e
...
@@ -14,4 +14,28 @@ if [ "$(cat "${reportFile}")" == "[]" ] ; then
...
@@ -14,4 +14,28 @@ if [ "$(cat "${reportFile}")" == "[]" ] ; then
fi
fi
jq
-C
.
"
${
reportFile
}
"
jq
-C
.
"
${
reportFile
}
"
#
# Borrowed from https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/support/notify_slack.sh
# and adjusted for our needs:)
#
if
[[
-z
"
${
CI_DEP_STATUS_NOTIFY_CHANNEL
}
"
]]
||
[[
-z
"
${
CI_DEP_STATUS_NOTIFY_SLACK_WEBHOOK
}
"
]]
;
then
echo
"Variables CI_DEP_STATUS_NOTIFY_CHANNEL and CI_DEP_STATUS_NOTIFY_SLACK_WEBHOOK are not defined"
echo
"Will not send slack notification"
else
messageTmpFile
=
"
$(
mktemp
)
"
cat
>
"
${
messageTmpFile
}
"
<<
EOS
\`
dep status
\`
check for <
${
CI_PROJECT_URL
}
> failed. Some dependencies should be updated:
\`\`\`
$(
jq
-M
.
"
${
reportFile
}
"
)
\`\`\`
See <
${
CI_JOB_URL
}
>
EOS
message
=
$(
sed
-e
':a'
-e
'N'
-e
'$!ba'
-e
"s/
\n
/
\\\n
/g"
"
${
messageTmpFile
}
"
)
payload
=
'payload={"channel": "'
"
${
CI_DEP_STATUS_NOTIFY_CHANNEL
}
"
'", "username": "GitLab Runner Dep Status Check", "text": "'
"
${
message
//\
"/
\\\"
}"
'", "icon_emoji": ":mantelpiece_clock:"}'
curl -X POST -s -L --data-urlencode
"
${
payload
}
"
"
${
CI_DEP_STATUS_NOTIFY_SLACK_WEBHOOK
}
"
fi
exit 1
exit 1
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment