jenkins-docker-api

module
v0.0.0-...-0794014 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2021 License: Apache-2.0

README

Deprecation Warning

As of May 2021, this project has been deprecated and is now archived in favor of using vela

jenkins-docker-api

docker

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:

  1. Ensure that Docker is installed and running.
  2. Ensure that Docker swarm is initialized: docker swarm init.
  3. Ensure that golang is installed.
  4. Ensure that govendor is installed.

Setting up project:

  1. 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
    
  2. Add/update golang vendor packages:

    govendor fetch +outside
    
  3. Set environment variables:

    • GITHUB_API_URL - your GitHub API URL
    • GITHUB_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/
  4. Make your code changes and ensure all tests pass

    # Checkout a branch for your work
    git checkout -b name_of_your_branch
    
    # Code away!
    
  5. 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
    
  6. Update the version in version/version.go if applicable

  7. Submit a PR for your changes.

Directories

Path Synopsis
cmd
jenkins-server
Package classification Jenkins API Self Service API built by Target to manage Jenkins master Terms Of Service: http://swagger.io/terms/ Version: 1.0.0 Host: yourhost.com Schemes: https Consumes: - application/json Produces: - application/json swagger:meta
Package classification Jenkins API Self Service API built by Target to manage Jenkins master Terms Of Service: http://swagger.io/terms/ Version: 1.0.0 Host: yourhost.com Schemes: https Consumes: - application/json Produces: - application/json swagger:meta
middleware/logger
Package logger provides log handling using logrus package.
Package logger provides log handling using logrus package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL