Deprecation Warning
As of May 2021, this project has been deprecated and is now archived in favor of using vela
jenkins-docker-api
Endpoints
A list of endpoints this API supports
GET /api/v1/health # Is the API up
GET /api/v1/jenkins # List of running Jenkins masters
PUT /api/v1/jenkins/restart/:name # Restarts a single Jenkins master
PUT /api/v1/jenkins/update/:name # Update a single Jenkins master to the latest release
PUT /api/v1/jenkins/shutdown/:name # Shutdown a single Jenkins master
PUT /api/v1/jenkins/admin/update_all # Update all Jenkins masters to the latest release (admins only)
Relevant Header
-H "Authorization: token <github token>"
Contributing / Development
Dependencies:
- Ensure that Docker is installed and running.
- Ensure that Docker swarm is initialized:
docker swarm init
. - Ensure that golang is installed.
- Ensure that govendor is installed.
Setting up project:
-
Clone down the project:
# Make sure your go paths are set if they aren't already export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin # Clone the project cd $GOPATH/src/github.com/target/ git clone git@github.com:Jenkins/jenkins-docker-api.git cd jenkins-docker-api
-
Add/update golang vendor packages:
govendor fetch +outside
-
Set environment variables:
GITHUB_API_URL
- your GitHub API URLGITHUB_ADMIN_ORG
- name of your GitHub admin organization, e.g.Jenkins
GITHUB_ADMIN_TEAM
- name of your GitHub admin team, e.g.Admins
JENKINS_ENV
- your Jenkins environment, e.g.test
,prod
, etc.JENKINS_IMAGE
- full path to your Jenkins Docker image, e.g.target/jenkins-docker-master:1.0.0
JENKINS_USER_CONFIG_PATH
- default path is/jenkins/user-configs/
JENKINS_ADMIN_CONFIG_PATH
- default path is/jenkins/secret-configs/
-
Make your code changes and ensure all tests pass
# Checkout a branch for your work git checkout -b name_of_your_branch # Code away!
-
Generate swagger spec (if necessary)
# Install Swagger 2.0 go get -u github.com/go-swagger/go-swagger/cmd/swagger # Generate swagger spec swagger generate spec -b ./cmd/jenkins-server -m -i swagger.yml -o api-spec/jenkins-api.json
-
Update the version in
version/version.go
if applicable -
Submit a PR for your changes.