Skip to content

PRJenkinsSetupFirewall

Josh Hursey edited this page May 6, 2016 · 11 revisions

Setting up a Jenkins Pull Request Builder from behind a firewall

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.

Requirements

  • 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

Assorted notes (work in progress - not formatted correctly)

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

  1. "This build is parameterized"
  -> "String Parameter"
     -> Name: GISTURL
     -> Default Value: https://gist.github.com
     -> Description: Initial URL for HitHub
  1. "GitHub Pull Request Builder"
  -> todo...
  -> "Trigger Setup"
     -> "Update commit status during build"
        Commit Status Context: YOUR-COMPANY-CI
        Commit Status URL: ${GISTURL}
  1. "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
  1. "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"

Clone this wiki locally