From 8fe95528cf24ed07b2f5e7a1031dd54a370426da Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Tue, 7 May 2024 10:20:22 +0200 Subject: [PATCH] kie-issues#872: adjust branch seed --- dsl/seed/jenkinsfiles/Jenkinsfile.seed.branch | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dsl/seed/jenkinsfiles/Jenkinsfile.seed.branch b/dsl/seed/jenkinsfiles/Jenkinsfile.seed.branch index fed4e2811..e12f2038d 100644 --- a/dsl/seed/jenkinsfiles/Jenkinsfile.seed.branch +++ b/dsl/seed/jenkinsfiles/Jenkinsfile.seed.branch @@ -276,12 +276,21 @@ def getRepoConfig(String repository, String generationBranch = "${GENERATION_BRA String buildchainRepo = cfg.buildchain_config?.git?.repository if (buildchainRepo) { - def buildchainRepoConfig = buildchainRepo == repository ? cfg : getRepoConfig(buildchainRepo, generationBranch) - cfg.buildchain_config.git.branch = cfg.buildchain_config.git.branch ?: buildchainRepoConfig.git.branch + def buildchainRepoConfig // to hold existing config from repositories section + if (all_repos.contains(buildchainRepo)) { + if (buildchainRepo == repository) { // it's the repository currently processed + buildchainRepoConfig = cfg + } else { // it's a different repository from repositories section + buildchainRepoConfig = getRepoConfig(buildchainRepo, generationBranch) + } + } - cfg.buildchain_config.git.author = cfg.buildchain_config.git.author ?: [:] - cfg.buildchain_config.git.author.name = cfg.buildchain_config.author?.name ?: buildchainRepoConfig.git.author.name - cfg.buildchain_config.git.author.credentials_id = cfg.buildchain_config.author?.credentials_id ?: buildchainRepoConfig.git.author.credentials_id + // below check if either cfg.buildchain_config or resolved buildchainRepoConfig exists and has value, if not resort to default + cfg.buildchain_config.git.branch = cfg.buildchain_config?.git?.branch ?: (buildchainRepoConfig?.git?.branch ?: generationBranch) + cfg.buildchain_config.git.author = cfg.buildchain_config?.git?.author ?: [:] + cfg.buildchain_config.git.author.name = cfg.buildchain_config?.author?.name ?: (buildchainRepoConfig?.git?.author?.name ?: cfg.git.author.name) + cfg.buildchain_config.git.author.credentials_id = cfg.buildchain_config?.author?.credentials_id ?: (buildchainRepoConfig?.git?.author?.credentials_id ?: cfg.git.author.credentials_id) + cfg.buildchain_config.git.author.token_credentials_id = cfg.buildchain_config?.author?.token_credentials_id ?: (buildchainRepoConfig?.git?.author?.token_credentials_id ?: cfg.git.author.token_credentials_id) } if (scriptUtils.isDebug()) {