This page describes the steps required to integrate your own Lab Jenkins system with the Linux Foundation's hosted Jenkins for ONAP ("LF Jenkins") at https://jenkins.onap.org/view/External%20Labs/. The end result is to allow the job results executed on your lab Jenkins server to be pushed out to LF Jenkins for archival and analysis.
High Level Flow
The Lab Jenkins (i.e. your own) will schedule the jobs, collect the logs locally, and push them out to your own log server website that's publicly readable. As an example, see http://12.234.32.117/logs/job/windriver-beijing-oom-deploy/79/.
When a job is done, the Lab Jenkins will issue a REST call to LF Jenkins to trigger the "External Lab" job, passing it the URL to the log directory to archive. The LF Jenkins "External Lab" jobs are set up to retrieve and archive the job log files from this website directory.
Currently there should be at least the following files:
- console.log (the console log output from the Jenkins job)
log.html (from Robot)
report.html (from Robot)
- output.xml (from Robot)
Additional files can be placed in the same directory and they will be fetched and archived by LF Jenkins.
Integration Steps
- Determine what your lab name should be. Example: "windriver".
- Create a LF ID for your lab Jenkins user. As a convention, the LF ID should be onap-ci-{lab-name}. Example: "onap-ci-windriver".
- Send email to LF helpdesk@onap.org to inform them of this account and request them to grant this account the right permissions for External Lab integration.
- Set up your Lab Jenkins jobs to deploy its log files to a publicly readable log server website as specified in the previous section.
- Define the External Lab jobs to which you want to post results in LF Jenkins. This is done by submitting changes to ONAP ci-management repo. Example: "lab-windriver-beijing-heat-deploy".
- Add a post-build step to your Lab Jenkins job to trigger the External Lab job on LF Jenkins.
Triggering the LF Jenkins External Lab Job
Here is an example script to put in your post-build step.
CRUMB=$(curl -s -u "${username}:${password}" 'https://jenkins.onap.org/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)') curl -u "${username}:${password}" -H "$CRUMB" -X POST "https://jenkins.onap.org/job/$EXT_JOB_NAME/buildWithParameters?SRC_BUILD_URL=${BUILD_URL}&LOG_DIR_URL=http://12.234.32.117/logs/job/$JOB_NAME/$BUILD_NUMBER/"
Use the username and password for the lab Jenkins user LF ID you created earlier.
The HTTP POST should be made to the endpoint corresponding to your External Lab job name. Example: https://jenkins.onap.org/job/lab-windriver-beijing-oom-deploy/buildWithParameters
The External Lab job expects two parameters:
SRC_BUILD_URL:
The full Lab Jenkins $BUILD_URL that actually ran the job. This will be shown in the LF Jenkins log so that people can click back to the source (if visible from the public internet, or via VPN otherwise). Example: http://12.234.32.117/jenkins/job/windriver-beijing-oom-deploy/79/
LOG_DIR_URL:
The URL to the log server website directory. Example: http://12.234.32.117/logs/job/windriver-beijing-oom-deploy/79/
Any questions? Contact Gary Wu or post to comments here.