Skip to content

linkyard/github-deployment-resource

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Deployment Resource

Fetches and creates GitHub Deployments and Deployment Statuses. For more about Github Deployments see the API documentation.

Source Configuration

  • user: Required. The GitHub username or organization name for the repository that you are deploying.

  • repository: Required. The repository name that you are deploying.

  • access_token: Required. Used for accessing deployment data and creating deployments and deployment statuses.

  • github_api_url: Optional. If you use a non-public GitHub deployment then you can set your API URL here.

  • environments: Optional. A list of environments to get versions for.

Example

resource_types:
  - name: github-deployment
    type: docker-image
    source:
      repository: linkyard/github-deployment-resource
      tag: "v0.3.1"
      
resources:
  - name: deployment
    type: github-deployment
    source:
      user: BrandwatchLtd
      repository: analytics
      access_token: abcdef1234567890
- get: deployment
- put: deployment
  params:
    id:
      file: deployment/id # path to a file containing the deployment ID
    state: success

Behavior

check: Check for Deployments

/check always returns the single latest deployment. It assumes that any preceding deployments are invalidated by the existence of a later deployment.

in: Fetch Deployment

Fetches the latest deployment and creates the following files:

  • id containing the id of the deployment being fetched.
  • ref containting the name of the ref the deployment is relating to. A branch, tag, or SHA.
  • sha containg the SHA that was recorded at deployment creation time.
  • task containing the name of the task for the deployment.
  • environment containing the name of the environment that is being deployed to.
  • description containing the description of the deployment
  • deploymentJSON containing the full JSON of the deployment as received from the API.

out: Create a Deployment or DeploymentStatus

Create a new Deployment, or update a given Deployment with a new DeploymentStatus

Parameters

  • type: Optional. Either deployment or status. Defaults to status.
If type=status
  • id: Required. The ID of the deployment to update with the new status. NB: You'll most likely want to reference a file with this ID stored in (see below).

  • state: Required. The state of the new deployment status. Must be one of pending, success, error, inactive, or failure.

If type=deployment
  • ref: Optional. The ref of the deployment. A branch name, a tag, or SHA.

  • environment: Optional. The name of the environment that is being deployed to.

  • description: Optional. The description of the deployment.

  • environment_url: Optional. URL of the deployment

  • auto_merge: Optional. Whether to auto-merge the repository's default branch into the deployment ref. Defaults to true.

  • payload: Optional. Additional data about the deployment.

  • payload_path: Optional. Path to a file containing additional JSON data to add to the payload.

NB: If there are duplicate keys in data from payload and payload_path, then the data from payload_path takes precedence.

  • task: Optional. The name of the task for the deployment.

The log url is automatically set to the url of the concourse build.

Reading values from files

All of the above parameters can be used to pass the name of a file to read the applicable value from. For example...

- put: deployment
  params:
    id:
      file: path/to/the/id/file
    state: success
    description:
      file: path/to/the/description

The above configuration, would read in the id and description values from files, but use the state value which has been passed in directly as a string.

About

A concourse resource for github deployments

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.9%
  • Shell 1.4%
  • Other 0.7%