diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-06-06 12:23:43 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-06-06 12:27:02 +0200 |
commit | 57ccf2a4c61754967ba0937158ccd6a4a1f16076 (patch) | |
tree | 17795a3a2b23df13403e943df3f67c96ca90f50a /vars/buildPackage.groovy | |
parent | 59fc362770b6541653abb921d5e679ae099f9d9f (diff) | |
download | vyos-build-57ccf2a4c61754967ba0937158ccd6a4a1f16076.tar.gz vyos-build-57ccf2a4c61754967ba0937158ccd6a4a1f16076.zip |
Jenkins: lib: only start SSH agend when *.deb files exist
Diffstat (limited to 'vars/buildPackage.groovy')
-rw-r--r-- | vars/buildPackage.groovy | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/vars/buildPackage.groovy b/vars/buildPackage.groovy index 11c9da38..89f605ff 100644 --- a/vars/buildPackage.groovy +++ b/vars/buildPackage.groovy @@ -137,27 +137,28 @@ def call(description=null, pkgList=null, buildCmd=null, buildArm=false) { echo "Build not started from official Git repository! Artifacts are not uploaded to external repository" return } - echo "Uploading Artifacts to external repository" - copyArtifacts fingerprintArtifacts: true, projectName: '${JOB_NAME}', selector: specific('${BUILD_NUMBER}') - // build up some fancy groovy variables so we do not need to write/copy - // every option over and over again! - def RELEASE = getGitBranchName() - if (getGitBranchName() == "master") - RELEASE = 'current' + files = findFiles(glob: '**/*.deb') + if (files) { + echo "Uploading Artifacts to external repository" + copyArtifacts fingerprintArtifacts: true, projectName: '${JOB_NAME}', selector: specific('${BUILD_NUMBER}') - def VYOS_REPO_PATH = '/home/sentrium/web/dev.packages.vyos.net/public_html/repositories/' + RELEASE - if (getGitBranchName() == "crux") - VYOS_REPO_PATH += '/vyos' + // build up some fancy groovy variables so we do not need to write/copy + // every option over and over again! + def RELEASE = getGitBranchName() + if (getGitBranchName() == "master") + RELEASE = 'current' - def SSH_OPTS = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR' - def SSH_REMOTE = env.DEV_PACKAGES_VYOS_NET_HOST // defined as global variable - def SSH_DIR = '~/VyOS/' + RELEASE + def VYOS_REPO_PATH = '/home/sentrium/web/dev.packages.vyos.net/public_html/repositories/' + RELEASE + if (getGitBranchName() == "crux") + VYOS_REPO_PATH += '/vyos' - // publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials - sshagent(['SSH-dev.packages.vyos.net']) { - files = findFiles(glob: '**/*.deb') - if (files) { + def SSH_OPTS = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=ERROR' + def SSH_REMOTE = env.DEV_PACKAGES_VYOS_NET_HOST // defined as global variable + def SSH_DIR = '~/VyOS/' + RELEASE + + // publish build result, using SSH-dev.packages.vyos.net Jenkins Credentials + sshagent(['SSH-dev.packages.vyos.net']) { sh(script: "ssh ${SSH_OPTS} ${SSH_REMOTE} -t \"bash --login -c 'mkdir -p ${SSH_DIR}'\"") echo "Uploading package(s) and updating package(s) in the repository ..." files.each { FILE -> |