Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 1.93 KB

jenkins-summary.md

File metadata and controls

27 lines (16 loc) · 1.93 KB

Jenkins Summary

A Jenkins build server is hosted on AWS at https://jenkins2.cppalliance.org:8443

The server is building and publishing previews of the documentation for a number of github repositories when pull requests are submitted.

Jenkins will poll each configured repository at a 5 minute interval, to see if a new pull request has been added. Alternatively, instead of polling, you may add a webhook in Github. In the "Settings" of any individual repo, create a webhook which notifies https://jenkins2.cppalliance.org:8443/github-webhook/

Each repo has it's own Jenkins "project" on the server. A job checks out a copy of the submitted code, runs the specific steps necessary for that codebase, and uploads the resulting website to the AWS S3 bucket "cppalliance-previews".

The configuration leverages a few Jenkins plugins:
The "GitHub Branch Source Plugin" allows you to create a new project based on the repository structure from one or more GitHub users or organizations.
The "Pipeline Step Plugin for AWS" allows uploading to S3.
The "Docker Pipeline Plugin" and "Docker plugin" allow running the build inside an isolated docker container.

The file path in the S3 bucket is formatted to be "repository"/"PR #". For example, the filepath of pull request #60 for the main website is s3://cppalliance-previews/cppalliance/60

The web URL is generated by inverting this path, so "cppalliance/60" becomes "60.cppalliance". The full URL has the format "60.cppalliance.prtest.cppalliance.org". This translation is accomplished with an nginx reverse proxy, hosted on the same Jenkins server.

nginx rule:
rewrite ^(.*)$ $backendserver/$repo/$pullrequest$1 break;

A wildcard DNS entry in Cloudflare sends the preview visitors to nginx:
*.prtest.cppalliance.org -> jenkins.cppalliance.org

For even more detailed information about the configuration, see Jenkins System Information