Wingman Infrastructure
...
- wingman-trigger: This is the scheduled process.
- wingman: This is the main job which call calls the Orchestrator service.
- wingman-update: This is a management process. It fetches, compiles and updates the pentaho-wingman service (see below).
...
It was designed as part of task ENGOPS-1586. Physically, it consists of a python script. The script can be seen here. It runs periodically on the Jenkins server and takes the following parameters.
Parameter | Description |
---|---|
-o | A comma separated list of the names of the organizations to scan for a list of projects. Usually something like: "pentaho,webdetails". |
-t | The |
API token from GitHub. | |
-b | A comma separated list of the names of the branches to scan. All pull requests for these branches will be considered. |
-ao | A comma separated list of organization names to which a user must belong to in order for his pull request to be built. |
A typical invocation of this script should look something like this:
Code Block |
---|
python PullRequestRecon.py -o webdetails,pentaho -t ./credentials.cred0123456789abcdef -b master,6.1,6.0 -ao webdetails,pentaho |
Anchor | ||||
---|---|---|---|---|
|
wingman
This is the main job on Jenkins which communicates with the Wingman service. It is a pretty simple job which gets invoked by the wingman-trigger job. It can also be launched manually.
This job takes a few parameters.
Parameter | Description |
---|---|
WINGMAN_ORG | The name of the organization which owns the pull request we want built. |
WINGMAN_REPO | The name of the repository which owns the pull request we want built. |
WINGMAN_PR_NUMBER | The number of the pull request to build. |
With these parameters, Jenkins simply invokes the REST endpoint of the wingman service by adding the parameters supplied. A typical invocation should look something like this:
Code Block |
---|
#!/bin/bash
JSON=`echo "{\"SourceRetriever\": { \"SourceControlType\": \"github\", \"Organization\": \"${WINGMAN_ORG}\", \"Repository\": \"${WINGMAN_REPO}\", \"PullRequest\": \"${WINGMAN_PR_NUMBER}\"}, \"StatusUpdater\": {\"WingmanUrl\": \"$BUILD_URL\"}}"`
curl -N -s -S -H "Content-Type: application/json"\
-X POST -d "$JSON"\
http://localhost:8181/cxf/orchestrator/orchestrate
|
...
This job updates the Wingman service. There are a few prerequisites before running this job.
- Disable the Jenkins jobs names wingman and wingman-trigger.
- Make sure that no wingman jobs are currently running. If they are, wait until they complete.
- You can now run the wingman-update job
The update job The update job performs a few tasks.
- Build wingman from the latest code
- Stop the wingman service.
- Wait for the service to stop.
- Pull the latest code from master
- Run the build
- Replace the current build with the new one
- Start the wingman service
This is done through the deploy.
...
Below is the code which we currently use to accomplish these tasks. (Line breaks added for readability)
Code Block |
---|
~/pentaho-wingman/assembly/build/assembly-0.0.1/bin/stop;
sleep 5;
cd ~/pentaho-wingman/
&& git pull origin master
&& cd ~/pentaho-wingman/assembly/
&& gradle clean build
&& cd ~/pentaho-wingman/assembly/build/
&& unzip ~/pentaho-wingman/assembly/build/distributions/assembly-0.0.1.zip
&& cd ~/pentaho-wingman/assembly/build/assembly-0.0.1/ && bin/start"
|
...
- Jenkins jobs general overview
...
- GitHub repo for docker-build
- General architecture overview
- Fixing build issues for specific builds
- Adding new analyzers
...
- GitHub repo
- General architecture overview
- Build detection algorithm
...
sh script present within the project.
pentaho-wingman
This system is composed of an OSGI application. The code lives here. It contains numerous modules which fall in one of those categories.
- Source control modules
- Builders
- Analyzers
- A single Orchestrator module
To get the code built and tested, please refer to the project's README file.
Once deployed, the service is invoked through a URL.
Code Block |
---|
http://localhost:8181/cxf/orchestrator/orchestrate |
This service takes a few parameters. To invoke it, do a POST operation on its endpoint and pass the following JSON message. Notice the presence of a few variables. Replace these tokens by their proper values.
No Format |
---|
{
"SourceRetriever":{
"SourceControlType":"github",
"Organization":"${WINGMAN_ORG}",
"Repository":"${WINGMAN_REPO}",
"PullRequest":"${WINGMAN_PR_NUMBER}"
},
"StatusUpdater":{
"WingmanUrl":"http://wingman.pentaho.com:8080/job/wingman/106/"
}
}
|