...
Setup Jenkins locally:
To write.
Install Jenkins using command:
Make your .netrc file exists in the root folder.
Push logs to Nexus Akraino Repository:
...
Write a script to push logs:
To write.
Create an .sh file. We named it as push-logs.sh.
Code Block | ||
---|---|---|
| ||
NEXUS_URL=https://nexus.akraino.org
SILO=<silo name provided above>
JENKINS_HOSTNAME=<hostname/IP of your Jenkins host>
# JOB_NAME and BUILD_NUMBER should be set by Jenkins
BUILD_URL="${JENKINS_HOSTNAME}/job/${JOB_NAME}/${BUILD_NUMBER}/"
NEXUS_PATH="${SILO}/job/${JOB_NAME}/${BUILD_NUMBER}"
lftools deploy logs $NEXUS_URL $NEXUS_PATH $BUILD_URL
echo "Logs uploaded to $NEXUS_URL/content/sites/logs/$NEXUS_PATH" |
Create a job on your Jenkins:
...
- Log into to Jenkins
- Through the Dashboard, go to New Item
- (in our case, we used push-logs)
- Select the Pipeline options shown
- Click OK
In the General (tab), under the Pipeline section, Pipeline script option must be selected. And paste the below provided groovy script into the Script area. The script is as follows:
Below line change-directory to where your script exists.Code Block language groovy title An example (groovy-script) to push logs to Nexus Akraino Repository linenumbers true pipeline { agent none stages { stage ("push-logs-nexus") { agent any steps { sh "echo 'Start of job (push-logs)'" sh "pwd" dir("../scripts/") { sh "pwd" sh "./push-logs.sh" } sh "pwd" sh "echo 'End of job (push-logs)'" } } } }
- Now you have to configure the job to load/run the script to push logs (wrote in the previous step). An example on how to is provided below:
...