forked from rollbar/rollbar-orb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
622 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Orb Development Pipeline | ||
|
||
This configuration file uses [orb-tools orb]() version 10 to automatically _pack_, _test_, and _publish_ CircleCI orbs using this project structure. View the comments within the config file for a full break down | ||
|
||
## Overview: | ||
|
||
**Imported Orbs** | ||
|
||
Both orb-tools and a development version of your orb will be imported into the config. On the first run, a `dev:alpha` development tag _must_ exist on your orb, but will be handled automatically from there on. | ||
|
||
**Jobs** | ||
|
||
In the _jobs_ key, you will define _integration tests_. These jobs will utilize the functionality of your orb at run-time and attempt to validate their usage with live examples. Integration tests can be an excellent way of determining issues with parameters and run-time execution. | ||
|
||
### Workflows | ||
|
||
There are two workflows which automate the pack, test, and publishing process. | ||
|
||
**test-pack** | ||
|
||
This is the first of the two workflows run. This workflow is responsible for any testing or prepping prior to integration tests. This is where linting occurs, shellchecking, BATS tests, or anything else that can be be tested without the need for further credentials. | ||
|
||
This Workflow will be placed on _hold_ prior to publishing a new development version of the orb (based on this commit), as this step requires access to specific publishing credentials. | ||
|
||
This allows users to fork the orb repository and begin the pipeline, while the code-owners review that the code is safe to test in an environment where publishing keys will be present. | ||
|
||
Once approved, the development version of the orb will publish and the _trigger-integration-tests-workflow_ job will run, kicking off the next workflow | ||
|
||
**integration-test_deploy** | ||
|
||
The second and final workflow is manually triggered by the _trigger-integration-tests-workflow_ job. In this run, the development version of the orb that was just published will be imported, and the integration tests will run. | ||
|
||
When running on the `master` branch (after merging to `master`), the workflow will additionally publish your new production orb. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
# Replace this with your own! | ||
rollbar-orb: adlibertas/rollbar-orb@<<pipeline.parameters.dev-orb-version>> | ||
orb-tools: circleci/[email protected] | ||
bats: circleci/[email protected] | ||
shellcheck: circleci/[email protected] | ||
|
||
# Pipeline Parameters | ||
## These parameters are used internally by orb-tools. Skip to the Jobs section. | ||
parameters: | ||
run-integration-tests: | ||
description: An internal flag to prevent integration test from running before a development version has been created. | ||
type: boolean | ||
default: false | ||
dev-orb-version: | ||
description: > | ||
The development version of the orb to test. | ||
This value is automatically adjusted by the "trigger-integration-tests-workflow" job to correspond with the specific version created by the commit and should not be edited. | ||
A "dev:alpha" version must exist for the initial pipeline run. | ||
type: string | ||
default: "dev:alpha" | ||
|
||
jobs: | ||
# Define one or more jobs which will utilize your orb's commands and parameters to validate your changes. | ||
integration-test-1: | ||
docker: | ||
- image: cimg/base:stable | ||
steps: | ||
- checkout | ||
# "greet" is a sample command packaged with this orb config. | ||
# This sample integration test will run as long as the greet command exists. Once you remove the greet command you should remove this line. | ||
# Push new changes first, before adding new tests to your config. | ||
- rollbar-orb/greet | ||
|
||
workflows: | ||
# Prior to producing a development orb (which requires credentials) basic validation, linting, and even unit testing can be performed. | ||
# This workflow will run on every commit | ||
test-pack: | ||
unless: << pipeline.parameters.run-integration-tests >> | ||
jobs: | ||
- orb-tools/lint # Lint Yaml files | ||
- orb-tools/pack # Pack orb source | ||
- shellcheck/check: | ||
dir: ./src/scripts | ||
exclude: SC2148 | ||
# optional: Run BATS tests against your scripts | ||
- bats/run: | ||
path: ./src/tests | ||
# If you accept building open source forks, protect your secrects behind a restricted context. | ||
# A job containing restricted context (which holds your orb publishing credentials) may only be accessed by a user with proper permissions. | ||
# An open source user may begin a pipeline with a PR, and once the pipeline is approved by an authorized user at this point, the pipeline will continue with the proper context permissions. | ||
- hold-for-dev-publish: | ||
type: approval | ||
requires: | ||
- orb-tools/lint | ||
- orb-tools/pack | ||
- bats/run | ||
- shellcheck/check | ||
# Publish development version(s) of the orb. | ||
- orb-tools/publish-dev: | ||
orb-name: adlibertas/rollbar-orb | ||
context: orb-publishing # A restricted context containing your private publishing credentials. Will only execute if approved by an authorized user. | ||
requires: [hold-for-dev-publish] | ||
# Trigger an integration workflow to test the | ||
# dev:${CIRCLE_SHA1:0:7} version of your orb | ||
- orb-tools/trigger-integration-tests-workflow: | ||
name: trigger-integration-dev | ||
context: orb-publishing | ||
requires: | ||
- orb-tools/publish-dev | ||
|
||
# This `integration-test_deploy` workflow will only run | ||
# when the run-integration-tests pipeline parameter is set to true. | ||
# It is meant to be triggered by the "trigger-integration-tests-workflow" | ||
# job, and run tests on <your orb>@dev:${CIRCLE_SHA1:0:7}. | ||
integration-test_deploy: | ||
when: << pipeline.parameters.run-integration-tests >> | ||
jobs: | ||
# Run any integration tests defined within the `jobs` key. | ||
- integration-test-1 | ||
# Publish a semver version of the orb. relies on | ||
# the commit subject containing the text "[semver:patch|minor|major|skip]" | ||
# as that will determine whether a patch, minor or major | ||
# version will be published or if publishing should | ||
# be skipped. | ||
# e.g. [semver:patch] will cause a patch version to be published. | ||
- orb-tools/dev-promote-prod-from-commit-subject: | ||
orb-name: adlibertas/rollbar-orb | ||
context: orb-publishing | ||
add-pr-comment: false | ||
fail-if-semver-not-indicated: true | ||
publish-version-tag: false | ||
requires: | ||
- integration-test-1 | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
- main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: "\U0001F41E Bug report" | ||
about: Report any bugs encountered while using this orb. | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Orb version: | ||
|
||
<!--- | ||
e.g., 1.0.0 | ||
find this information in your config.yml file; | ||
if the version is @volatile, check the top of your CircleCI-generated, | ||
expanded configuration file, viewable from the "Configuration" tab of | ||
any job page, for the orb's specific semantic version number | ||
--> | ||
|
||
## What happened: | ||
|
||
<!--- | ||
please include any relevant links to CircleCI workflows or jobs | ||
where you saw this behavior | ||
--> | ||
|
||
## Expected behavior: | ||
|
||
<!--- what should happen, ideally? --> | ||
|
||
## Additional Information: | ||
|
||
<!--- Provide any additional context possible. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
name: "\U0001F680 Feature Request" | ||
about: Propose changes to the orb. | ||
title: '' | ||
labels: feature_request | ||
assignees: '' | ||
--- | ||
|
||
## Describe Request: | ||
|
||
## Examples: | ||
|
||
## Supporting Documentation Links: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
blank_issues_enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
**SEMVER Update Type:** | ||
- [ ] Major | ||
- [ ] Minor | ||
- [ ] Patch | ||
|
||
## Description: | ||
|
||
<!--- | ||
Describe your changes in detail, preferably in an imperative mood, | ||
i.e., "add `commandA` to `jobB`" | ||
--> | ||
|
||
## Motivation: | ||
|
||
<!--- | ||
Share any open issues this PR references or otherwise describe the motivation to submit this pull request. | ||
--> | ||
|
||
**Closes Issues:** | ||
- ISSUE URL | ||
|
||
## Checklist: | ||
|
||
<!-- | ||
Thank you for contributing to CircleCI Orbs! | ||
before submitting your a request, please go through the following | ||
items and place an x in the [ ] if they have been completed | ||
--> | ||
|
||
- [ ] All new jobs, commands, executors, parameters have descriptions. | ||
- [ ] Usage Example version numbers have been updated. | ||
- [ ] Changelog has been updated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# orb.yml is "packed" from source, and not published directly from the repository. | ||
orb.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends: relaxed | ||
|
||
rules: | ||
line-length: | ||
max: 200 | ||
allow-non-breakable-inline-mappings: true | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
- Current development changes [ to be moved to release ] | ||
|
||
## [1.0.0] - YYYY-MM-DD | ||
### Added | ||
- Initial Release | ||
### Changed | ||
- Initial Release | ||
### Removed | ||
- Initial Release | ||
|
||
|
||
[1.0.0]: GITHUB TAG URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,41 @@ | ||
# rollbar-orb | ||
[CircleCI Orb](https://github.com/CircleCI-Public/config-preview-sdk/tree/master/docs) for reporting deploys and uploading sourcemaps to Rollbar. | ||
# Orb Project Template | ||
|
||
## Requirements | ||
If you don't have them already, create accounts in [Rollbar](https://rollbar.com/signup) and [CircleCI](https://circleci.com/signup/). | ||
[![CircleCI Build Status](https://circleci.com/gh/adeubank/rollbar-orb.svg?style=shield "CircleCI Build Status")](https://circleci.com/gh/adeubank/rollbar-orb) [![CircleCI Orb Version](https://img.shields.io/badge/endpoint.svg?url=https://badges.circleci.io/orb/adeubank/rollbar-orb)](https://circleci.com/orbs/registry/orb/adeubank/rollbar-orb) [![GitHub License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://raw.githubusercontent.com/adeubank/rollbar-orb/master/LICENSE) [![CircleCI Community](https://img.shields.io/badge/community-CircleCI%20Discuss-343434.svg)](https://discuss.circleci.com/c/ecosystem/orbs) | ||
|
||
In order to use the Rollbar orb, your CircleCI builds need to run in environment where [curl](https://curl.haxx.se/) and [jq](https://stedolan.github.io/jq/) are installed. | ||
|
||
## Usage | ||
|
||
To use the Rollbar orb, reference it in your project and then use one of the included commands: | ||
* `notify_deploy` | ||
* `notify_deploy_started` | ||
* `notify_deploy_finished` | ||
* `upload_sourcemap` | ||
A starter template for orb projects. Build, test, and publish orbs automatically on CircleCI with [Orb-Tools](https://circleci.com/orbs/registry/orb/circleci/orb-tools). | ||
|
||
Documentation for each method is available inline in [orb.yml](https://github.com/rollbar/rollbar-orb/blob/master/src/rollbar/orb.yml). | ||
Additional READMEs are available in each directory. | ||
|
||
Here's a very simple example of a CircleCI config that uses the Rollbar orb to report a deploy starting and finishing as well as uploading sourcemaps: | ||
|
||
```yaml | ||
version: 2.1 | ||
orbs: | ||
rollbar: rollbar/deploy@volatile | ||
jobs: | ||
build: | ||
docker: | ||
- image: circleci/ruby:latest | ||
environment: | ||
ROLLBAR_ACCESS_TOKEN: {{ your `POST_SERVER_ITEM` access token here}} | ||
ROLLBAR_ENVIRONMENT: development | ||
steps: | ||
- checkout | ||
- rollbar/notify_deploy_started: | ||
environment: $ROLLBAR_ENVIRONMENT | ||
- rollbar/upload_sourcemap: | ||
minified_url: https://rollbar.com/rollbar.min.js | ||
source_map: static/js/rollbar.js.map | ||
js_files: static/js/rollbar.js | ||
|
||
# The rest of your build steps go here... | ||
|
||
# Notify Rollbar when your deploy has completed successfully | ||
- rollbar/notify_deploy_finished: | ||
deploy_id: $ROLLBAR_DEPLOY_ID | ||
status: succeeded | ||
``` | ||
## Resources | ||
|
||
## Help / Support | ||
[CircleCI Orb Registry Page](https://circleci.com/orbs/registry/orb/adeubank/rollbar-orb) - The official registry page of this orb for all versions, executors, commands, and jobs described. | ||
[CircleCI Orb Docs](https://circleci.com/docs/2.0/orb-intro/#section=configuration) - Docs for using and creating CircleCI Orbs. | ||
|
||
If you run into any issues, please email us at [[email protected]](mailto:[email protected]) | ||
### How to Contribute | ||
|
||
For bug reports, please [open an issue on GitHub](https://github.com/rollbar/rollbar-orb/issues/new). | ||
We welcome [issues](https://github.com/adeubank/rollbar-orb/issues) to and [pull requests](https://github.com/adeubank/rollbar-orb/pulls) against this repository! | ||
|
||
### How to Publish | ||
* Create and push a branch with your new features. | ||
* When ready to publish a new production version, create a Pull Request from _feature branch_ to `master`. | ||
* The title of the pull request must contain a special semver tag: `[semver:<segement>]` where `<segment>` is replaced by one of the following values. | ||
|
||
## Contributing | ||
| Increment | Description| | ||
| ----------| -----------| | ||
| major | Issue a 1.0.0 incremented release| | ||
| minor | Issue a x.1.0 incremented release| | ||
| patch | Issue a x.x.1 incremented release| | ||
| skip | Do not issue a release| | ||
|
||
For details on how to do development work on a CircleCI orb, check out [Circle CI's Orb docs](https://circleci.com/docs/2.0/creating-orbs/). | ||
Example: `[semver:major]` | ||
|
||
To contribute to the Rollbar orb: | ||
* Squash and merge. Ensure the semver tag is preserved and entered as a part of the commit message. | ||
* On merge, after manual approval, the orb will automatically be published to the Orb Registry. | ||
|
||
1. [Fork it](https://github.com/rollbar/rollbar-orb) | ||
2. Create your feature branch (```git checkout -b my-new-feature```). | ||
3. Commit your changes (```git commit -am 'Added some feature'```) | ||
4. Push to the branch (```git push origin my-new-feature```) | ||
5. Create a new Pull Request and submit it for review. | ||
|
||
For further questions/comments about this or other orbs, visit the Orb Category of [CircleCI Discuss](https://discuss.circleci.com/c/orbs). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: 2.1 | ||
|
||
description: > | ||
Sample orb description | ||
# What will your orb allow users to accomplish? | ||
# Descriptions should be short, simple, and informative. | ||
|
||
# This information will be displayed in the orb registry and is not mandatory. | ||
display: | ||
home_url: "https://www.website.com/docs" | ||
source_url: "https://www.github.com/EXAMPLE_ORG/EXAMPLE_PROJECT" | ||
|
||
# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza. | ||
# orbs: | ||
# hello: circleci/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Orb Source | ||
|
||
Orbs are shipped as individual `orb.yml` files, however, to make development easier, it is possible to author an orb in _unpacked_ form, which can be _packed_ with the CircleCI CLI and published. | ||
|
||
The default `.circleci/config.yml` file contains the configuration code needed to automatically pack, test, and deploy and changes made to the contents of the orb source in this directory. | ||
|
||
## @orb.yml | ||
|
||
This is the entry point for our orb "tree", which becomes our `orb.yml` file later. | ||
|
||
Within the `@orb.yml` we generally specify 4 configuration keys | ||
|
||
**Keys** | ||
|
||
1. **version** | ||
Specify version 2.1 for orb-compatible configuration `version: 2.1` | ||
2. **description** | ||
Give your orb a description. Shown within the CLI and orb registry | ||
3. **display** | ||
Specify the `home_url` referencing documentation or product URL, and `source_url` linking to the orb's source repository. | ||
4. **orbs** | ||
(optional) Some orbs may depend on other orbs. Import them here. | ||
|
||
## See: | ||
- [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) | ||
- [Reusable Configuration](https://circleci.com/docs/2.0/reusing-config) |
Oops, something went wrong.