r-bar / concourse-github-status

A concourse resource type for checking and setting build statuses on github
MIT License
0 stars 4 forks source link

Concourse Github Status

A simple Concourse resource-type to interact with GitHub build statuses.

Configuration

Behavior

check

Triggers when the status of the branch for the configured context has been updated.

in

Lookup the state of a status.

Parameters:

out

Update the status of a commit. Optionally include a description and target URL which will be referenced from GitHub.

Parameters:

Example

A typical use case is to update the status of a commit as it traverses your pipeline. The following example marks the commit as pending before unit tests start. Once unit tests finish, the status is updated to either success or failure depending on how the task completes.

---
jobs:
  - name: "unit-tests"
    plan:
      - get: "repo"
        trigger: true
      - put: "build-status"
        params: { state: pending, commit: repo }
      - task: "unit-tests"
        file: "repo/ci/unit-tests/task.yml"
        on_failure:
          - put: "build-status"
            params: { state: failure, commit: repo }
      - put: "build-status"
        params: { state: success, commit: repo }

resources:
  - name: "repo"
    type: "git"
    source:
      uri: https://github.com/r-bar/concourse-github-status.git
      branch: master
  - name: "build-status"
    type: "github-status"
    source:
      owner: r-bar
      repository: concourse-github-status
      access_token: {{github_access_token}}

resource_types:
  - name: "github-status"
    type: "docker-image"
    source:
      repository: "registry.barth.tech/library/github-status-resource" # +
      tag: "latest"

Note: If you have several jobs in the pipeline that can fail you can wrap them in a do step to catch errors or failures from all of them.

References

License

MIT License