More Docker. Easy Access. New Streamlined Plans. Learn more.

jenkinsci/pipeline-as-code-github-demo

By jenkinsci

Updated about 7 years ago

Demonstration of Jenkins 2.0 “Pipeline-as-Code” using GitHub.

Image
14

1.7K

Demo of GitHub Organization, multibranch projects, and pull requests.

To run the demo:

  1. Start the image: WORKSPACE=/tmp/demows docker run --rm -p 8080:8080 -p 4040:4040 -v /var/run/docker.sock:/var/run/docker.sock -v $WORKSPACE:$WORKSPACE -e WORKSPACE=$WORKSPACE -ti jenkinsci/pipeline-as-code-github-demo
  2. Visit localhost:8080.
  3. Prepare your environment in GitHub:
  4. Create an organization or user account (or use an existing one)
  5. Fork multibranch-demo to your own account or organization
  6. Log in with the random administrative password printed to the Docker log. Skip the rest of the setup wizard (close the dialog).
  7. Go to Credentials » GitHub and add a username/password pair using an access token generated here:
  8. Configure a personal access token with these scopes: repo:status and public_repo
  9. Create a new item, selecting GitHub Organization as the type, and setting the name to your account or organization name (for example, cloudbeers).
  10. Select your credentials token under Scan Credentials
  11. Optionally set the repository pattern to multibranch.*
  12. Save; you will see repositories being scanned.
  13. Go back to the organization index page. You should see multibranch-demo, under that one or more branches including master, and under each a successful build #1
  14. Add a new webhook, ask to Send me everything, and specify a URL like http://SOMETHING.ngrok.io/github-webhook/ (look at the Docker log for the specific hostname). Remember to clean up your webhook when the demo is done
  15. File pull requests and see them being built (only if your repository is private)

The image needs to run Docker commands, so it assumes that your Docker daemon is listening to /var/run/docker.sock (discussion). This is not “Docker-in-Docker”; the container only runs the CLI and connects back to the host to start sister containers. The run target also makes reference to file paths on the Docker host, assuming they are where you are running that command, so this target cannot work on boot2docker. There may be some way to run this demo using boot2docker; if so, please contribute it.

Docker Pull Command

docker pull jenkinsci/pipeline-as-code-github-demo