Skip to content

Instantly share code, notes, and snippets.

@carmark
Last active August 10, 2018 18:44
Show Gist options
  • Save carmark/2f0c3f79ec78b460f8224287ddc8df99 to your computer and use it in GitHub Desktop.
Save carmark/2f0c3f79ec78b460f8224287ddc8df99 to your computer and use it in GitHub Desktop.

Install the follow plugins

  • GIT plugin
  • Git client plugin
  • Git Parameter Plug-In
  • Git server plugin
  • Github Authentication plugin
  • GitHub Pull Request Plugin
  • GitHub pull requests builder
  • SCM Sync Configuration Plugin

Create a new project

2

Config the project

Add github project url

3

Source Code Management

4

Set Build Triggers

5

Set Build Action

6

Save the project

Manage Jenkins

Click Manage Jenkins -> Config System to set the global configuration.

Set GitHub Server

7

Set GitHub Pull Request Builder

  • If you are using Enterprise GitHub set the server api URL in GitHub server api URL. Otherwise leave there https://api.github.com
  • A GitHub API token or username password can be used for access to the GitHub API
  • To setup credentials for a given GitHub Server API URL:
    • Click Add next to the Credentials drop down
      • For a token select Kind -> Secret text
        • If you haven't generated an access token you can generate one in Test Credentials...
          • Set your 'bot' user's GitHub username and password.
          • Press the Create Access Token button
          • Jenkins will create a token credential, and give you the id of the newly created credentials. The default description is: serverAPIUrl + " GitHub auto generated token credentials".
      • For username/password us Kind -> Username with password
    • Credentials will automatically be created in the domain given by the GitHub Server API URL field.
    • Select the credentials you just created in the drop down.
    • The first fifty characters in the Description are used to differentiate credentials per job, so again use something semi-descriptive
  • Add as many GitHub auth sections as you need, even duplicate server URLs

Set WebHook for github project

make sure the follow web hooks in your github project

Test with a new PR

Running

8

Finished

9

10

When a new pull request is opened in the project and the author of the pull request isn't white-listed, builder will ask "Can one of the admins verify this patch?".

  • ok to test to accept this pull request for testing
  • test this please for a one time test run
  • add to whitelist to add the author to the whitelist

If the build fails for other various reasons you can rebuild.

  • retest this please to start a new build

About Hyper_

Hyper_ uses a technology called HyperContainer to apply hardware-enforced isolation to containers, while keeping the sub-second startup performance. Instead of running Cgroup and Namespace, HyperContainer launches the Docker images w ith plain hypervisor. HyperContainer provides the best of both worlds giving you the security of virtual machines with the speed of containers.

About Jenkins

The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project.

Reference

  1. Hyper_ https://hyper.sh
  2. Jenkins https://jenkins.io
  3. Jenkins wiki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment