pontusarfwedson / concourse-bitbucket-pullrequest-resource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This repo has been forked from pickledrick/concourse-bitbucket-pullrequest-resource

A Concourse resource to interact with the build status API of Atlassian BitBucket.

This repo is tied to the associated Docker image on quay.io, built from the master branch.

Resource Configuration

These items go in the source fields of the resource type. Bold items are required:

  • repo - repository name to track
  • key - OAuth key for Consumer
  • secret - OAuth Secret for Consumer
  • team - Team name repository belongs to
  • url - bitbucket cloud api path (example: https://api.bitbucket.org) Currently only supported
  • version - bitbucket API Version (example: 2.0) Currently only supported
  • concourse_url - concourse url for setting build link in bitbucket (example: http://ci.example.com)

Behavior

check

Checks for a Pull request with a head commit in an untested state.

in

Retrieves a copy of the tracking branch, sets pull request state to IN_PROGRESS.

out

Update the status of a commit.

Parameters:

  • commit - File containing commit SHA to be updated.
  • state - the state of the status. Must be one of success, failed or inprogress. By using inprogress we can use this resource purely as an put in order to update status of a bitbucket commit. Make sure to, if you put inprogress for a task, then also do success with the same task. Otherwise, bitbucket will consider them two different builds (so the inprogress one will never succeed).

Reading logs

The logs can be found by running fly -t <target-name> intercept -c <pipeline-name>/<resource-name> and then looking for check_logfile.txt, in_logfile.txt and out_logfile.txt in the ~/root/ directory.

Example

A typical use case is to watch for Pull Requests on a Repository, Run Tests and update the status of a commit.

An example of this is shown in ci/pipeline.yaml

Installation

This resource is not included with the standard Concourse release. Use one of the following methods to make this resource available to your pipelines.

Deployment-wide

To install on all Concourse workers, update your deployment manifest properties to include a new groundcrew.resource_types entry...

properties:
  groundcrew:
    additional_resource_types:
      - image: "docker:///quay.io/pontusarfwedson/concourse-bitbucket-pullrequest-resource#latest"
        type: "pull-request"                   

Pipeline-specific

To use on a single pipeline, update your pipeline to include a new resource_types entry...

resource_types:
  - name: "pull-request"
    type: "docker-image"
    source:
      repository: "quay.io/pontusarfwedson/concourse-bitbucket-pullrequest-resource"
      tag: "latest"

References

License

Apache License v2.0

About


Languages

Language:Go 99.2%Language:Makefile 0.8%