I have a private Jenkins running on an internal private network not visible from the internet. I have also a public Jenkins instance, visible from the internet and accessible only over HTTPS.
How can I publish completed builds of a scripted pipeline job from private instance to the public one (including artifacts, logs, test results and so on)?
I know there's a Build Publisher Plugin for Jenkins, but I could not figure out how to use it from scripted pipeline.
EDIT: Build Publisher Plugin cannot be used from pipeline jobs without modifications. Is there any other way to achieve the same?
The major difference between any Jenkins job and a Jenkins Pipeline Job is that the Pipeline Scripted job runs on the Jenkins master. This uses a lightweight executor which uses only some resources to translate in the master to atomic commands that execute or send to the agents.
Step 1 − Go to Manage Jenkins → Manage Plugin's. In the available tab, search for 'Build Pipeline Plugin'. Click On Install without Restart. Once done, restart the Jenkins instance.
What does it do? This plugin allows records from one Jenkins to be published on another Jenkins. The typical use case is for you to run builds within the firewall, then send the results to another Jenkins which is facing the outside world.
Since the post section of a Pipeline is guaranteed to run at the end of a Pipeline's execution, we can add some notification or other steps to perform finalization, notification, or other end-of-Pipeline tasks. See Glossary - Build Status for the different build statuses: SUCCESS, UNSTABLE, and FAILED.
You can run multiple jobs and also we can use pipeline in the loop. Jenkins Pipeline supports nicely Big or Medium size projects. Jenkins pipeline is implemented as a code that allows multiple users to edit and execute the pipeline process. We are enough talked about Jenkins job now we see how can we define Jenkins Pipeline.
To use Pipeline as Code, projects must contain a file named Jenkinsfile in the repository root, which contains a “ Pipeline script.” We can create a simple or complex delivery Pipeline as code via Pipeline DSL (Domain-specific Language).
Trigger a new build for a given job. Use the Pipeline Snippet Generator to generate a sample pipeline script for the build step. Name of a downstream job to build. May be another Pipeline job, but more commonly a freestyle or other project.
Execute the Jenkins build pipeline and confirm that it has completed successfully, registering a new Jira ticket automatically, and attaching the Gradle build log file Use the Jira administration console to manage the ticket raised by the Jenkins pipeline build process
As stated here, you can only call plugins that have been made compatible with pipelines, which is the use of a newer API.
And since that build-publisher plugin is not listed in the [jenkinsci/pipeline-plugin COMPATIBILITY
3 list, you would need to fork jenkinsci/build-publisher-plugin
, and make it compatible with the new pipeline interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With