From e7e0b03dab101466509f350792705308ac3aeb16 Mon Sep 17 00:00:00 2001 From: Glen Mailer Date: Fri, 3 May 2019 11:43:56 +0100 Subject: [PATCH 1/2] Allow choosing a different name for the rollbar token environment variable --- src/rollbar/orb.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/rollbar/orb.yml b/src/rollbar/orb.yml index 6c7d394..87dc8a2 100644 --- a/src/rollbar/orb.yml +++ b/src/rollbar/orb.yml @@ -13,6 +13,10 @@ commands: 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: + token_name: + type: env_var_name + default: ROLLBAR_ACCESS_TOKEN + description: The name of the rollbar token environment variable. Defaults to $ROLLBAR_ACCESS_TOKEN. environment: type: string default: production @@ -22,7 +26,7 @@ commands: name: Rollbar - Notify Deploy Started command: | ROLLBAR_DEPLOY_ID=`curl https://api.rollbar.com/api/1/deploy/ \ - --form access_token=$ROLLBAR_ACCESS_TOKEN \ + --form access_token=${<< parameters.token_name >>} \ --form environment=<< parameters.environment >> \ --form revision=$CIRCLE_SHA1 \ --form local_username=$CIRCLE_USERNAME \ @@ -35,6 +39,10 @@ commands: A step to notify Rollbar that the deploy of a project has finished. Should be used in conjunction with notify_deploy_started. parameters: + token_name: + type: env_var_name + default: ROLLBAR_ACCESS_TOKEN + description: The name of the rollbar token environment variable. Defaults to $ROLLBAR_ACCESS_TOKEN. deploy_id: type: string description: The deploy_id of the deploy to update @@ -46,7 +54,7 @@ commands: name: Rollbar - Notify Deploy Finished command: | curl -X PATCH \ - https://api.rollbar.com/api/1/deploy/<< parameters.deploy_id>>?access_token=$ROLLBAR_ACCESS_TOKEN \ + https://api.rollbar.com/api/1/deploy/<< parameters.deploy_id>>?access_token=${<< parameters.token_name >>} \ --data '{"status":"<< parameters.status >>"}' notify_deploy: @@ -57,6 +65,10 @@ commands: Add this as the last step of your the job that you use to deploy. parameters: + token_name: + type: env_var_name + default: ROLLBAR_ACCESS_TOKEN + description: The name of the rollbar token environment variable. Defaults to $ROLLBAR_ACCESS_TOKEN. environment: type: string default: production @@ -66,7 +78,7 @@ commands: name: Rollbar - Notify Deploy Succeeded command: | curl https://api.rollbar.com/api/1/deploy/ \ - --form access_token=$ROLLBAR_ACCESS_TOKEN \ + --form access_token=${<< parameters.token_name >>} \ --form environment=<< parameters.environment >> \ --form revision=$CIRCLE_SHA1 \ --form local_username=$CIRCLE_USERNAME @@ -74,6 +86,10 @@ commands: upload_sourcemap: description: A step to upload a sourcemap to Rollbar during a deploy. parameters: + token_name: + type: env_var_name + default: ROLLBAR_ACCESS_TOKEN + description: The name of the rollbar token environment variable. Defaults to $ROLLBAR_ACCESS_TOKEN. minified_url: type: string description: The full URL of the minified file. @@ -93,7 +109,7 @@ commands: done echo $JS_FILES curl https://api.rollbar.com/api/1/sourcemap \ - -F access_token=$ROLLBAR_ACCESS_TOKEN \ + -F access_token=${<< parameters.token_name >>} \ -F version=$CIRCLE_SHA1\ -F minified_url=<< parameters.minified_url >> \ -F source_map=@<< parameters.source_map >> \ From 56eff9f4962e98c319f47882980995abc01cbcb0 Mon Sep 17 00:00:00 2001 From: Glen Mailer Date: Fri, 3 May 2019 11:56:47 +0100 Subject: [PATCH 2/2] Include commit summary as the comment field --- src/rollbar/orb.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rollbar/orb.yml b/src/rollbar/orb.yml index 87dc8a2..79463ce 100644 --- a/src/rollbar/orb.yml +++ b/src/rollbar/orb.yml @@ -2,7 +2,7 @@ version: 2.1 description: | Commands for calling the Rollbar deploy API. - Requires `curl` and `jq` commands to be available. + Requires `curl`, `git` 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 @@ -29,6 +29,7 @@ commands: --form access_token=${<< parameters.token_name >>} \ --form environment=<< parameters.environment >> \ --form revision=$CIRCLE_SHA1 \ + --form comment="$(git show --no-patch --format=%s)" --form local_username=$CIRCLE_USERNAME \ --form status=started | jq -r '.data.deploy_id'` echo "Created deploy $ROLLBAR_DEPLOY_ID" @@ -81,6 +82,7 @@ commands: --form access_token=${<< parameters.token_name >>} \ --form environment=<< parameters.environment >> \ --form revision=$CIRCLE_SHA1 \ + --form comment="$(git show --no-patch --format=%s)" --form local_username=$CIRCLE_USERNAME upload_sourcemap: