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?
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.yamlfile.Here is what I tried.
Bellow is one "template" of a minimal
jenkins.yamlwhere I tried adding the build-everything-strategyIn
<code goes here>I tried:I also tried the same in a different location:
Or also here:
Looking directly on the jenkins pod (I'm running it inside Openshift) I can find a
config.xmlfile inside/var/lib/jenkins/jobs/pipename/, after I added the build-everything-strategy through the GUI, that looks like this:So it seems it should be located at the same level as git in the
sourcetag under thebranchSourcetag. Like this:But that also doesn't work. Any pointers?