Skip to content

Commit

Permalink
Merge pull request #35 from G33tha/release-3.6.0
Browse files Browse the repository at this point in the history
updated build jenkins file
  • Loading branch information
vinukumar-vs authored Feb 11, 2021
2 parents 6e59c3e + e322216 commit 4ce374b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 22 deletions.
38 changes: 23 additions & 15 deletions bot/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,34 @@ node('build-slave') {
println(ANSI_BOLD + ANSI_YELLOW + "github_release_tag specified, building from github_release_tag: " + params.github_release_tag + ANSI_NORMAL)
}
echo "public_repo_commit_hash: " + public_repo_commit_hash
bot_repo_url = params.diksha_bot_repo
dir('bot_repo') {
if (params.diksha_bot_tag == "") {
def scmVars = checkout scm
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/heads/master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
}
else {
def scmVars = checkout scm
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/tags/params.diksha_bot_tag"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = params.diksha_bot_tag
}
}
bot_repo_url = params.private_bot_repo

if (params.private_bot_repo) {
dir('bot_repo') {
if (params.private_bot_tag == "") {
def scmVars = checkout scm
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/heads/master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
}
else {
def scmVars = checkout scm
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/tags/params.private_bot_tag"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = params.private_bot_tag
}
}

}

}

stage('Build') {
env.NODE_ENV = "build"
print "Environment will be : ${env.NODE_ENV}"
build_tag = public_repo_commit_hash + "_" + private_repo_commit_hash + "_" + env.BUILD_NUMBER + "_bot"
sh('cp -r bot_repo/* .')
build_tag = public_repo_commit_hash + "_" + env.BUILD_NUMBER + "_bot"
if (params.private_bot_repo) {
sh('cp -r bot_repo/* .')
build_tag = public_repo_commit_hash + "_" + private_repo_commit_hash + "_" + env.BUILD_NUMBER + "_bot"
}
dir('bot') {
sh('chmod 777 build.sh')
sh("./build.sh ${build_tag} ${env.NODE_NAME} ${hub_org}")
Expand Down
22 changes: 15 additions & 7 deletions router/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,34 @@ node('build-slave') {
}

echo "public_repo_commit_hash: " + public_repo_commit_hash
bot_repo_url = params.diksha_bot_repo
dir('bot_repo') {
if (params.diksha_bot_tag == "") {
bot_repo_url = params.private_bot_repo

if (params.private_bot_repo) {
dir('bot_repo') {
if (params.private_bot_tag == "") {
def scmVars = checkout scm
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/heads/master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
}
else {
def scmVars = checkout scm
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/tags/params.diksha_bot_tag"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = params.diksha_bot_tag
checkout scm: ([$class: 'GitSCM', branches: [[name: "refs/tags/params.private_bot_tag"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: true]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'private_repo_credentials', url: "$bot_repo_url"]]])
private_repo_commit_hash = params.private_bot_tag
}
}

}
}

stage('Build') {
env.NODE_ENV = "build"
print "Environment will be : ${env.NODE_ENV}"
build_tag = public_repo_commit_hash + "_" + private_repo_commit_hash + "_" + env.BUILD_NUMBER + "_router"
sh('cp -r bot_repo/* .')

build_tag = public_repo_commit_hash + "_" + env.BUILD_NUMBER + "_bot"
if (params.private_bot_repo) {
sh('cp -r bot_repo/* .')
build_tag = public_repo_commit_hash + "_" + private_repo_commit_hash + "_" + env.BUILD_NUMBER + "_bot"
}
dir('router') {
sh('chmod 777 build.sh')
sh("./build.sh ${build_tag} ${env.NODE_NAME} ${hub_org}")
Expand Down

0 comments on commit 4ce374b

Please sign in to comment.