Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Activate build everything strategy with configuration-as-code plugin #2

Description

@mparada

I'm having trouble activating the build-everything-strategy using the configuration-as-code plugin. Through the GUI I can do it without any problem but I can't find the format and/or the location to add this to the jenkins.yaml file.

Here is what I tried.

Bellow is one "template" of a minimal jenkins.yaml where I tried adding the build-everything-strategy

jenkins:
    systemMessage: "Jenkins configured automatically by Jenkins Configuration as Code plugin.\n\n"

jobs:
  - script: |-
      multibranchPipelineJob('pipename') {
          branchSources {
              git { ... }
              <code goes here>
          }
      }

In <code goes here> I tried:

--> buildStrategies { buildEverythingStrategy() } 
--> buildStrategies = buildEverythingStrategy()
--> buildStrategies = buildEverythingStrategy
--> buildStrategies = 'buildEverythingStrategy'

I also tried the same in a different location:

jobs:
  - script: |
      multibranchPipelineJob('pipename') {
          branchSources {
              branchSource {
                  source {
                      git { ... }
                  }
                  <code goes here>
                  }
              }
          }
      }

Or also here:

jobs:
  - script: |
      multibranchPipelineJob('pipe-name') {
          branchSources {
              git { ... }
              branchSource { <code goes here> }
              }
          }
      }

Looking directly on the jenkins pod (I'm running it inside Openshift) I can find a config.xml file inside /var/lib/jenkins/jobs/pipename/, after I added the build-everything-strategy through the GUI, that looks like this:

...
  <sources class="jenkins.branch.MultiBranchProject$BranchSourceList" plugin="branch-api@2.5.5">
    <data>
      <jenkins.branch.BranchSource>
        <source class="jenkins.plugins.git.GitSCMSource" plugin="git@3.9.3">
          <id>pipename</id>
          <remote>path to remote</remote>
          <credentialsId>bitbucket-ssh</credentialsId>
          <traits>
            <jenkins.plugins.git.traits.BranchDiscoveryTrait/>
          </traits>
        </source>
        <strategy class="jenkins.branch.DefaultBranchPropertyStrategy">
          <properties class="empty-list"/>
        </strategy>
        <buildStrategies>
          <com.angrybytes.jenkinsplugins.buildeverythingstrategy.BuildEverythingStrategy plugin="build-everything-strategy@1.0-SNAPSHOT"/>
        </buildStrategies>
      </jenkins.branch.BranchSource>
    </data>
    <owner class="org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject" reference="../.."/>
  </sources>
...

So it seems it should be located at the same level as git in the source tag under the branchSource tag. Like this:

jobs:
  - script: |
      multibranchPipelineJob('pipename') {
          branchSources {
              git { ... }
              buildStrategies {
                  buildEverythingStrategy()
              }
          }
      }

But that also doesn't work. Any pointers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions