Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b9155646
Commit
b9155646
authored
Sep 29, 2021
by
Sanad Liaquat
Committed by
Alex Pooley
Sep 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send chat user id to ChatOps jobs
parent
b3be4dfb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
1 deletion
+6
-1
doc/ci/chatops/index.md
doc/ci/chatops/index.md
+2
-0
doc/ci/variables/predefined_variables.md
doc/ci/variables/predefined_variables.md
+1
-0
lib/gitlab/chat/command.rb
lib/gitlab/chat/command.rb
+2
-1
spec/lib/gitlab/chat/command_spec.rb
spec/lib/gitlab/chat/command_spec.rb
+1
-0
No files found.
doc/ci/chatops/index.md
View file @
b9155646
...
...
@@ -9,6 +9,7 @@ type: index, concepts, howto
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/4466) in GitLab Ultimate 10.6.
> - [Moved](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/24780) to GitLab Free in 11.9.
> - `CHAT_USER_ID` was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/341798) in GitLab 14.4.
GitLab ChatOps provides a method to interact with CI/CD jobs through chat services
like Slack. Many organizations' discussion, collaboration, and troubleshooting takes
...
...
@@ -30,6 +31,7 @@ to the job:
-
`CHAT_INPUT`
contains any additional arguments.
-
`CHAT_CHANNEL`
is set to the name of channel the action was triggered in.
-
`CHAT_USER_ID`
is set to the chat service's user ID of the user who triggered the slash command.
When executed, ChatOps looks up the specified job name and attempts to match it
to a corresponding job in
[
`.gitlab-ci.yml`
](
../yaml/index.md
)
. If a matching job
...
...
doc/ci/variables/predefined_variables.md
View file @
b9155646
...
...
@@ -20,6 +20,7 @@ There are also [Kubernetes-specific deployment variables](../../user/project/clu
|------------------------------------------|--------|--------|-------------|
|
`CHAT_CHANNEL`
| 10.6 | all | The Source chat channel that triggered the
[
ChatOps
](
../chatops/index.md
)
command. |
|
`CHAT_INPUT`
| 10.6 | all | The additional arguments passed with the
[
ChatOps
](
../chatops/index.md
)
command. |
|
`CHAT_USER_ID`
| 14.4 | all | The chat service's user ID of the user who triggered the
[
ChatOps
](
../chatops/index.md
)
command. |
|
`CI`
| all | 0.4 | Available for all jobs executed in CI/CD.
`true`
when available. |
|
`CI_API_V4_URL`
| 11.7 | all | The GitLab API v4 root URL. |
|
`CI_BUILDS_DIR`
| all | 11.10 | The top-level directory where builds are executed. |
...
...
lib/gitlab/chat/command.rb
View file @
b9155646
...
...
@@ -66,7 +66,8 @@ module Gitlab
def
build_environment_variables
(
pipeline
)
pipeline
.
variables
.
build
(
[{
key:
'CHAT_INPUT'
,
value:
arguments
},
{
key:
'CHAT_CHANNEL'
,
value:
channel
}]
{
key:
'CHAT_CHANNEL'
,
value:
channel
},
{
key:
'CHAT_USER_ID'
,
value:
chat_name
.
chat_id
}]
)
end
...
...
spec/lib/gitlab/chat/command_spec.rb
View file @
b9155646
...
...
@@ -72,6 +72,7 @@ RSpec.describe Gitlab::Chat::Command do
expect
(
vars
[
'CHAT_INPUT'
]).
to
eq
(
'foo'
)
expect
(
vars
[
'CHAT_CHANNEL'
]).
to
eq
(
'123'
)
expect
(
vars
[
'CHAT_USER_ID'
]).
to
eq
(
chat_name
.
chat_id
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment