How to open jenkins file in subfolders

I have a project with two folders that are independent and need separate builds in Jenkins (running v2.74)

My structure

folder
├── project1
│   └── Jenkinsfile
└── project2
    └── Jenkinsfile

When I click "scan organization" in Jenkins, it does not detect Jenkins files in subdirectories.

Here is an example from the Organization Log Scan:

Proposing kg-pipeline
Examining my-test-project

  Checking branches...

  Getting remote branches...

    Checking branch jenkins
      ‘Jenkinsfile not found
    Does not meet criteria

    Checking branch master
      ‘Jenkinsfile not found
    Does not meet criteria

  2 branches were processed

Finished examining my-test-project

I did not touch on the job configuration, which scans the organization and finds branches with Jenkinsfiles. Here is the current setting for the project

Jenkinsfile discoverability configuration

My question is: how to configure Jenkins to view each folder individually? I am also interested in links to examples of projects created in this way.

+6
source share
4 answers

There is a simple solution.

  1. JENKINS_URL/job/JOB_NAME/configure
  2. Build Configuration by Jenkinsfile Mode
  3. " Script Path DIR_NAME/Jenkinsfile DIR_NAME/Jenkinsfile

, Jenkinsfile src, src/Jenkinsfile Jenkins Jenkinsfile

+6

- , :

this Multibranch Pipeline Projects, "Jenkinsfile".

Jeninsfile ​​ JENKINS-34561

+1

, , Jenkinsfile s.

You may be able to achieve the desired behavior by loading Jenkinsfilefrom your subdirectories in Jenkinsfilethe root of the project using the download step . This will show the assembly of both projects as a single pipeline, though .. and you may want to build these projects on parallel nodes .

+1
source

You can add more than one "Jenkins Pipeline File" to Project Recognizer with your Jenkins file paths.

0
source

Source: https://habr.com/ru/post/1687358/


All Articles