Open bartoszmajsak opened 6 years ago
I investigated a bit further the second option.
With not much changes in the launcher code I have both Jenkinsfile
in the folder and BuildConfig
is pointing to it. So that’s a good news.
strategy:
jenkinsPipelineStrategy:
env:
- name: FABRIC8_SPACE
value: booster-tests
jenkinsfilePath: .openshiftio/Jenkinsfile
type: JenkinsPipeline
The bad news is that the job itself still executes the one from the root folder. I can get the desired behaviour easily on Minishift with upstream Jenkins service. On OSIO, however, I cannot use Jenkinsfile
from the new location. The job simply loads the one from the root of the project. I looked at the job config and it seems that there is a Pipeline Multibranch Plugin installed which still points to the root Jenkinsfile instead.
Makes me wonder if that gets precedence. This plugin does not exist in bare-bone OpenShift Jenkins. I don’t have sufficient rights to change this configuration though. So my question is - do we need this plugin? And if we do - how we can change its config based on what we define in the BuildConfig itself.
@bartoszmajsak I assigned this to build team. If that is wrong, please correct.
@GeorgeActon this is actually work needed on Launcher side as well as build team.
We remove the old jenkinsfile here https://github.com/fabric8-launcher/launcher-backend/blob/050c9a38ecbb0951c8902c6e56f49bff9c0035a0/core/core-impl/src/main/java/io/fabric8/launcher/core/impl/preparers/RemoveOpenshiftioFolderPreparer.java#L37-L43
// Delete Jenkinsfile if exists
try {
Files.deleteIfExists(projectPath.resolve("Jenkinsfile"));
} catch (IOException e) {
logger.log(Level.WARNING, "Could not delete Jenkinsfile", e);
}
When importing the project through Launcher, if the Jenkinsfile exists, it is overwritten by the one selected by through the wizard (from https://github.com/fabric8io/fabric8-jenkinsfile-library).
We could potentially solve it be either:
Jenkinsfile
being located not in the root directory (e.g..openshiftio/Jenkinsfile
or simply different name)Latter seems to be possible - https://issues.jenkins-ci.org/browse/JENKINS-34561 @lordofthejars @sthaha did you guys checked that? What would be the effort to change build service behaviour?