-
Notifications
You must be signed in to change notification settings - Fork 888
PRJenkinsSetupFirewall
Josh Hursey edited this page May 6, 2016
·
11 revisions
If you have testing equipment behind a firewall then it can be difficult to use the Open MPI Community Jenkins server since it will not be able to reach your machines from the open internet.
- You will need to setup a Jenkins master internally to your site. We will call this (Internal)Jenkins.
- Must be able to test internally without any external entity having access and visibility on the test environment or (Internal)Jenkins.
- (Internal)Jenkins must be able to connect to the GitHub API.
- (Internal)Jenkins must be able to report build result to the open internet so other developers can view details of build failures.
- Setup your (Internal)Jenkins
- Install the following packages on (Internal)Jenkins
-
GitHub Pull Request Builder
- This plugin monitors GitHub for pull requests, and updates the status/comments as approprate.
- [EnvInject] (https://github.com/jenkinsci/envinject-plugin
https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin)
- This plugin will allow us to inject variables from one part of the build into another. Necessary to pass around the gist ID and URL along with a few other context variables.
- [PostBuildScript](https://github.com/jenkinsci/postbuildscript-plugin
https://wiki.jenkins-ci.org/display/JENKINS/PostBuildScript+Plugin)
- This will allow us to push the output even if the build fails, and before GitHub is updated.
-
GitHub Pull Request Builder
- You will want setup a GitHub user with a personal access token that allows
-
repo
access (for the pull request builder) -
gist
access (to manage the gists) - Save this token in a TOKENFILE somewhere in your environment (plain text file with restricted permissions)
-
- You will need a local copy the scripts to seed the environment with variables, and interact with the GitHub Gist API. These are in ompi-tests repository.
Setting up the environment
shell$ touch $PATH_TO_OMPI_TESTS/log/your-log.md
shell$ $PATH_TO_OMPI_TESTS/jenkins/bin/gist.pl --tokenfile $TOKENFILE -cmd create $PATH_TO_OMPI_TESTS/log/your-log.md
shell$ echo "Make note of the URL returned from the above command, as you will need it for the next step"
shell$ cp $PATH_TO_OMPI_TESTS/jenkins/bin/config.inc.sample $PATH_TO_OMPI_TESTS/jenkins/bin/config.inc
shell$ $EDITOR $PATH_TO_OMPI_TESTS/jenkins/bin/config.inc
Setting up a Jenkins Job
- "This build is parameterized"
-> "String Parameter"
-> Name: GISTURL
-> Default Value: https://gist.github.com
-> Description: Initial URL for HitHub
- "GitHub Pull Request Builder"
-> todo...
-> "Trigger Setup"
-> "Update commit status during build"
Commit Status Context: YOUR-COMPANY-CI
Commit Status URL: ${GISTURL}
- "Build" (in this order) a. "Set build status to pending on GitHub commit" b. "Execute shell"
#!/bin/bash -xe
source $PATH_TO_OMPI_TESTS/jenkins/bin/pre-build.sh
c. "Inject environment variables"
- Set "Properties File Path" to .properties.txt
d. "Execute shell"
#!/bin/bash -xe
source $WORKSPACE/.env.sh
#-----------------------
# Redirect output to the file
exec > >(tee -i output.txt)
exec 2>&1
touch $WORKSPACE/.in-progress.txt
# Run your CI script here...
rm $WORKSPACE/.in-progress.txt
- "Post-build Actions"
a. "Execute a set of scripts"
- "Build Steps" -> "Execute shell"
#!/bin/bash -x
source $PATH_TO_OMPI_TESTS/jenkins/bin/post-build.sh
b. "Set build status on GitHub commit"