Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
irc: circleci/irc@0.2.1
Use irc
elements in your existing workflows and jobs.
Send a notification to an IRC channel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: '2.1'
orbs:
irc: circleci/irc@x.y.z
jobs:
build:
docker:
- image: your-image
steps:
- checkout
- irc/notify:
channel: circle-notify
message: Build completed!
nick: circleci-bot
port: 6667
server: 127.0.0.1
workflows:
your-workflow:
jobs:
- build
Send a custom message to an IRC channel or user.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
channel | The IRC channel to post in. | Yes | - | string |
message | Message to send. | No | Your CircleCI job has completed. | string |
nick | IRC nick. | No | circleci-bot | string |
pass | Name of the environment variable containing the IRC server password. | No | IRC_SERVER_PASSWORD | env_var_name |
port | IRC server port. Defaults to 6667. | No | 6667 | integer |
server | The IRC server to connect to. Defaults to the environment variable 'IRC_SERVER'. | No | ${IRC_SERVER} | string |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: "This orb is no longer supported by CircleCI \nbecause of limited or no use. If you would \nlike to use this orb or create your own version \nfeel free to fork the repository and use the \nfollowing https://circleci.com/blog/building-private-orbs/ \nas a guide to making this orb into a private orb \nfor your own use. \nSend custom IRC notifications from CircleCI."
display:
source_url: https://github.com/circleci-public/irc-orb
commands:
notify:
description: Send a custom message to an IRC channel or user.
parameters:
channel:
description: The IRC channel to post in.
type: string
message:
default: Your CircleCI job has completed.
description: Message to send.
type: string
nick:
default: circleci-bot
description: IRC nick.
type: string
pass:
default: IRC_SERVER_PASSWORD
description: Name of the environment variable containing the IRC server password.
type: env_var_name
port:
default: 6667
description: IRC server port. Defaults to 6667.
type: integer
server:
default: ${IRC_SERVER}
description: The IRC server to connect to. Defaults to the environment variable 'IRC_SERVER'.
type: string
steps:
- run:
command: |
# Check Parameters
if [ -z "<< parameters.server >>" ]; then
echo "[IRC Orb]: IRC server URL not set."
exit 1
fi
if [ -z "<< parameters.channel >>" ]; then
echo "[IRC Orb]: IRC channel not set."
exit 1
fi
(
if [[ -n "${<< parameters.pass >>}" ]]; then
echo "PASS ${<< parameters.pass >>}"
fi
echo 'USER << parameters.nick >> 8 * : << parameters.nick >>'
echo 'NICK << parameters.nick >>'
echo 'JOIN #<< parameters.channel >>'
echo 'PRIVMSG #<< parameters.channel >> :<< parameters.message >>'
echo QUIT
) | nc << parameters.server >> << parameters.port >>
name: Notify IRC
examples:
notify:
description: |
Send a notification to an IRC channel
usage:
version: "2.1"
orbs:
irc: circleci/irc@x.y.z
jobs:
build:
docker:
- image: your-image
steps:
- checkout
- irc/notify:
channel: circle-notify
message: Build completed!
nick: circleci-bot
port: 6667
server: 127.0.0.1
workflows:
your-workflow:
jobs:
- build