Jenkins Archive Downstream Multibranch Pipeline - jenkins

I have a multibranch pipeline in Jenkins and need to pass the archive from the pipeline to a job it builds. The copy artifact plugin doesnt seem to support multibranch pipelines. It deletes my source project every time I save. Is there another plugin I can use to get the archive to get passed to the job? Or is there something I need to do to get this plugin working with multibranch pipeline?

The copy artifact plugin doesnt seem to support multibranch pipelines.
Copy Artifact does not care about multibranch. From its perspective, a branch project is simply a job that is in some folder. And it does support folders. You just need to use the correct syntax for the source job. Last I remember, it supports either relative (e.g., ../multibranch/master) or absolute (e.g., /organization/repo/master).

Related

Jenkins / Poll SCM : How to retrieve which SVN repository change triggered build job in declarative pipeline

I'm currently trying to set up a build job connected to multiple (3) svn repositories with single pipeline, with Poll SCM scheme. All the contents from the repositories build into a single artifact. Repositories are, e.g., say:
https://myrepo.com/mainSrc/main
https://myrepo.com/libs/library1
https://myrepo.com/libs/library2
When I set all this repos inside Pipeline configuration, the build job successfully checkouts all the paths to the workspace.
However, the point is, I need to track which repository started the build job, to write some conditional steps. Is there a solution for this? I googled for it, there are some ways to obtain svn revision for a path, however it's not what I'm looking for.

How to edit / define Jenkinsfile text within Jenkins job?

Sometimes it is not possible (yet) to put Jenkinsfile into git repository.
I think it was possible to edit/define Jenkinsfile content just within job,
but with latest Jenkins, I cannot find such support.
Now I see only filename configuration.
OK, just be sure to select usual Pipeline project and not Multibranch pipeline

Multibranch pipeline with jenkinsfile in svn:external

I have set up a multibranch pipeline job for a repository in SVN. Since I want to keep the jenkinsfiles the same in all branches, they are not really located in the branches, but in a different location and only referenced via svn:externals.
Unfortunately the multibranch pipeline does not seem to follow these references and doesn't find the jenkinsfiles (the paths are correctly set):
Checking candidate branch /branches/aaa/bbb/ccc#HEAD
‘ddd\eee\fff\jenkinsfile' not found
Does not meet criteria
Is there any way to tell Jenkins and the multibranch-pipeline plugin setup to also follow svn:externals when looking for the jenkinsfiles?
By default, Jenkins is trying to get the Jenkinsfile with a lightweight checkout which does not consider svn:externals.
This behavior can be (only generally) deactivated, see https://wiki.jenkins.io/display/JENKINS/Subversion+Plugin, chapter "lightweight checkout capability for Subversion on Multibranch Pipeline projects and Externals support"

Jenkins BlueOcean only to build using a single branch for build?

When I build a multibranch pipeline job using BlueOcean it looks into my repository and reads all of my Jenkinsfile for each branch. to initiates multiple build, but I only want to be able to build a job based on a certain branch. Is there a way to only build blueocean?
Thanks
I sounds like your job is a Multibranch Pipeline.
If you create a job that is just a Pipeline (rather than Multibranch Pipeline), you can specify a single specific branch to build.

Polling ignores commits in certain paths in multibranch pipeline

I have a multibranch pipeline with a project that I want to build only if there are changes in a specific directory.
I know that the Polling ignores commits in certain paths option can do exactly that but I can't find this option in the multibranch configuration.
Is this even possible for multibranch pipeline?
Theoretically, you can call the GitSCM class with an includedRegions path restriction in the checkout step (e.g. see here for the syntax).
However, this is not working with pipelines, as I just checked it last week. So unfortunately, Jenkins is really not well-suited for monorepos.

Resources