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:
deploy: rollbar/deploy@1.0.1
Use deploy
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
A step to notify Rollbar that the deploy of a project has started. Should be used in conjunction with notify_deploy_finished. Command will set a BASH ENV variable ROLLBAR_DEPLOY_ID with the ID of the deploy.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
environment | The Rollbar environment. Defaults to production. | No | production | string |
A step to notify Rollbar that the deploy of a project has finished. Should be used in conjunction with notify_deploy_started.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
deploy_id | The deploy_id of the deploy to update | Yes | - | string |
status | - | Yes | - | enum |
A step to notify Rollbar that the project has been successfully deployed. A Rollbar access token is required to be set in the environment with the name `ROLLBAR_ACCESS_TOKEN`. Add this as the last step of your the job that you use to deploy.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
environment | The Rollbar environment. Defaults to production. | No | production | string |
A step to upload a sourcemap to Rollbar during a deploy.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
minified_url | The full URL of the minified file. | Yes | - | string |
source_map | The path to the local copy of the source map | Yes | - | string |
js_files | An array of local paths to unminified javascript files. | Yes | - | 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# 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: |
Commands for calling the Rollbar deploy API.
Requires `curl` and `jq` commands to be available.
The source for the Orb can be found here:
https://github.com/rollbar/rollbar-orb/tree/master/src/rollbar
commands:
notify_deploy_started:
description: |
A step to notify Rollbar that the deploy of a project has started.
Should be used in conjunction with notify_deploy_finished.
Command will set a BASH ENV variable ROLLBAR_DEPLOY_ID with the ID of the deploy.
parameters:
environment:
type: string
default: production
description: The Rollbar environment. Defaults to production.
steps:
- run:
name: Rollbar - Notify Deploy Started
command: |
ROLLBAR_DEPLOY_ID=`curl https://api.rollbar.com/api/1/deploy/ \
--form access_token=$ROLLBAR_ACCESS_TOKEN \
--form environment=<< parameters.environment >> \
--form revision=$CIRCLE_SHA1 \
--form local_username=$CIRCLE_USERNAME \
--form status=started | jq -r '.data.deploy_id'`
echo "Created deploy $ROLLBAR_DEPLOY_ID"
echo "export ROLLBAR_DEPLOY_ID=$ROLLBAR_DEPLOY_ID" >> $BASH_ENV
notify_deploy_finished:
description: |
A step to notify Rollbar that the deploy of a project has finished.
Should be used in conjunction with notify_deploy_started.
parameters:
deploy_id:
type: string
description: The deploy_id of the deploy to update
status:
type: enum
enum: ["succeeded","failed","timed_out"]
steps:
- run:
name: Rollbar - Notify Deploy Finished
command: |
curl -X PATCH \
https://api.rollbar.com/api/1/deploy/<< parameters.deploy_id>>?access_token=$ROLLBAR_ACCESS_TOKEN \
--data '{"status":"<< parameters.status >>"}'
notify_deploy:
description: |
A step to notify Rollbar that the project has been successfully deployed.
A Rollbar access token is required to be set in the
environment with the name `ROLLBAR_ACCESS_TOKEN`.
Add this as the last step of your the job that you
use to deploy.
parameters:
environment:
type: string
default: production
description: The Rollbar environment. Defaults to production.
steps:
- run:
name: Rollbar - Notify Deploy Succeeded
command: |
curl https://api.rollbar.com/api/1/deploy/ \
--form access_token=$ROLLBAR_ACCESS_TOKEN \
--form environment=<< parameters.environment >> \
--form revision=$CIRCLE_SHA1 \
--form local_username=$CIRCLE_USERNAME
upload_sourcemap:
description: A step to upload a sourcemap to Rollbar during a deploy.
parameters:
minified_url:
type: string
description: The full URL of the minified file.
source_map:
type: string
description: The path to the local copy of the source map
js_files:
type: string
description: An array of local paths to unminified javascript files.
steps:
- run:
name: Rollbar - Upload Sourcemap
command: |
for i in << parameters.js_files >>;
do
JS_FILES="$JS_FILES -F $i=@$i"
done
echo $JS_FILES
curl https://api.rollbar.com/api/1/sourcemap \
-F access_token=$ROLLBAR_ACCESS_TOKEN \
-F version=$CIRCLE_SHA1\
-F minified_url=<< parameters.minified_url >> \
-F source_map=@<< parameters.source_map >> \
$JS_FILES