Giter Club home page Giter Club logo

github-deployment-resource's Introduction

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: andyhume/github-deployment-resource
      tag: "v0.8.0"
      
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.

  • 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.
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.

github-deployment-resource's People

Contributors

ahume avatar kevinsnydercodes avatar mattdodge avatar mazubieta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

github-deployment-resource's Issues

Support for Github Enterprise?!

I'm trying to apply this resource to our inhouse concourse + Github Enterprise setup. Unfortunately I got an errror (see below). Interresting part here is that it tries to connect to https://api.github.com even so github_api_url parameter is set to our inhouse installation. What I could not read in code is, if it's actually used?

resource script '/opt/resource/check []' failed: exit status 1

stderr:
getting deployments list
�[31merror running command: GET https://api.github.com/repos/digital-banking/solaris-logging-ruby/deployments: 401 Bad credentials []
�[0mgoroutine 1 [running]:
runtime/debug.Stack(0x16, 0xc420045d98, 0x2)
	/usr/local/go/src/runtime/debug/stack.go:24 +0x79
runtime/debug.PrintStack()
	/usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/ahume/github-deployment-resource.Fatal(0x6c3200, 0xf, 0x7d7bc0, 0xc42019e0a0)
	/go/src/github.com/ahume/github-deployment-resource/fmt.go:13 +0x120
main.main()
	/go/src/github.com/ahume/github-deployment-resource/cmd/check/check.go:22 +0x28d

Thanks, Tobi

ahume/go-github is behind and failing

Trying to build/test from source and seeing this error:

./github.go:58:47: g.client.Repositories.GetDeployment undefined (type *github.RepositoriesService has no field or method GetDeployment)

It looks like what is committed to github.com/ahume/go-github is behind what's on your local machine maybe @ahume? At this point though google's go-github module is way far ahead and breaking way more than just this one error.

Can you confirm and push what you have or maybe provide some other guidance on how to proceed? Would like to make a PR here but am hung up on this for now.

Configurable Duration for the timeout

We are getting pretty constant timeouts from the context functions. This is making part of our deploy process really flaky, and I can try to help by adding a configuration value that would be parsed with time.ParseDuration

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.