Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 4.17 KB

DEVELOPMENT.md

File metadata and controls

53 lines (39 loc) · 4.17 KB

Terminus Build Tools Plugin Development

CircleCI Terminus v1.x Compatible

Terminus Build Tools Plugin development is done through a fork/PR workflow for any outside contributors. There is an automatic test suite which must pass before pull requests are merged. However, the test suite does require some setup for each fork to work. Due to privacy/security considerations, each fork must use its own circle-ci instance as it requires access to GitHub, Pantheon etc.

Setup

  • Fork this repository (Github account required)
  • Login/register with CircleCI.
  • In CircleCI UI:
    • Create a CI instance for your fork.
    • Add environment variables. By default, this would be at: https://circleci.com/gh/YOURUSERNAME/terminus-build-tools-plugin/edit#env-vars
      • BITBUCKET_PASS Bitbucket app password.
      • BITBUCKET_USER Your Bitbucket username.
      • CIRCLE_TOKEN A generated CircleCI token.
      • GITHUB_TOKEN A generated GitHub token - needs at least create/edit/delete repo permissions
      • GITHUB_USER Your GitHub username.
      • GIT_EMAIL The email to use for commits.
      • TERMINUS_ORG The agency account to use for creating Pantheon sites.
      • TERMINUS_TOKEN A generated Pantheon/Terminus access token.
      • GITLAB_TOKEN A generated GitLab token - needs at least api and read_user scopes.

Adding a new Provider

It is possible to add other providers. There is no plugin mechanism for providers; additional implementations must be added to the Terminus Build Tools plugin. Pull requests are welcome.

Declare the Provider Class

In the ProviderManager class, add the classname to the list in the findProvider method.

Impementing a New CI Provider

Follow the example provided by the CircleCIProvider class. A number of interfaces should be implemented:

  • CredentialClientInterface: declare the credentials (e.g. OAuth tokens) the CredentialManager shoud look up or prompt for on behalf of your CI Provider.
  • CIProvider: set environment variables and configure the CI service to begin running tests.
  • PrivateKeyReceiver: receive the private key that will be generated for your CI Provider. The corresponding public key is added to Pantheon.
  • LoggerAwareInterface: A logger will be injected into your class.

Implement a New Git Repository Provider

Follow the example provided by the GithubProvider class. A number of interfaces should be implemented:

  • CredentialClientInterface: declare the credentials (e.g. OAuth tokens) the CredentialManager shoud look up or prompt for on behalf of your CI Provider.
  • GitProvider: create a repository on the remote Git service, and push a local repository to the remote service.
  • LoggerAwareInterface: A logger will be injected into your class.