Skip to content
Damien Coraboeuf edited this page Jun 13, 2016 · 4 revisions

HTTP connector

The HTTP connector exposes a very simple API, which allows you to pilot the Jenkins plug-in from anywhere, using simple HTTP calls. It can be use to trigger Seed jobs from other tools or SCM commit hooks (note that GitHub can benefit from specific Seed web hooks, like BitBucket).

In the samples below, the Jenkins instance is designed as http://localhost:8080/jenkins but it can be of course any other address.

The HTTP end point is available on the seed-http-api URI.

Create

Triggering the creation of a branch in a project.

  • URI: /seed-http-api/create
  • Parameters:
    • project - ID of the project
    • branch - name of the branch to create

Sample:

curl -X POST http://localhost/jenkins/seed-http-api/create?project=PROJECT&branch=BRANCH

Delete

Triggering the deletion of a branch in a project.

  • URI: /seed-http-api/delete
  • Parameters:
    • project - ID of the project
    • branch - name of the branch to delete

According to the settings of the project, the branch pipeline will be deleted entirely or only its generator (and the pipeline be kept intact).

Sample:

curl -X POST http://localhost/jenkins/seed-http-api/delete?project=PROJECT&branch=BRANCH

Seed

Triggering the regeneration of a pipeline for a branch in a project:

  • URI: seed-http-api/seed
  • Parameters:
    • project - ID of the project
    • branch - name of the branch to delete

This will (re)generate the pipeline for the given branch.

Sample:

curl -X POST http://localhost/jenkins/seed-http-api/seed?project=PROJECT&branch=BRANCH

Push

Starting a pipeline for a branch in a project:

  • URI: seed-http-api/commit
  • Parameters:
    • project - ID of the project
    • branch - name of the branch to delete
    • commit - commit or revision to build

This will start the pipeline for the given branch and commit.

Sample:

curl -X POST http://localhost/jenkins/seed-http-api/commit?project=PROJECT&branch=BRANCH&commit=aef456

Security

To enable security, generate a secure token using your favourite tool and store it in your Seed configuration. It's better to use a distinct token per project, but nothing prevents you to store it in the global configuration.

See the [Quick start](Quick start) for an example of such a parameter for the secret token.

The token must then be passed as a X-Seed-Token HTTP header. For example, using Curl:

curl -X POST \
   -H "X-Seed-Token: GHIJKL" \
   http://localhost/jenkins/seed-http-api/commit?project=test&branch=master&commit=aef456

See also

Clone this wiki locally