From: Mike Marchetti Date: Wed, 31 May 2017 20:33:02 +0000 (-0400) Subject: systest jenkins pipeline X-Git-Tag: v2.0.2~4 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F1999%2F1;p=osm%2Fdevops.git systest jenkins pipeline Change-Id: I496980ad1dcad1be691587caec41d7d86259a55f Signed-off-by: Mike Marchetti --- diff --git a/jenkins/system/Jenkinsfile b/jenkins/system/Jenkinsfile deleted file mode 100644 index 8a04f236..00000000 --- a/jenkins/system/Jenkinsfile +++ /dev/null @@ -1,85 +0,0 @@ -// input parameters: -// boolean: BUILD_FROM_SOURCE -// boolean: REPO_DISTRO -// boolean: COMMIT_ID -// boolean: UPSTREAM_SUFFIX -// string: NODE -// string: RSYNC_DESTINATION -// string: REPO_BASE_URL -// string: REPO_KEY_NAME -// string: RELEASE - -node("${params.NODE}") { - - stage("Setup") { - tag_or_branch = params.COMMIT_ID.replaceAll(/\./,"") - container_name_prefix = "osm-${tag_or_branch}" - container_name = "${container_name_prefix}-${BUILD_NUMBER}" - } - - stage("Checkout") { - checkout scm - } - - // Copy the artifacts from the upstream jobs - stage("Copy Artifacts") { - // cleanup any previous repo - sh 'rm -rf repo' - - dir('repo') { - // grab all stable upstream builds based on the - // given target UPSTREAM_SUFFIX - - def list = ["SO", "UI", "RO", "openvim", "osmclient"] - for (component in list) { - step ([$class: 'CopyArtifact', - projectName: "${component}_${params.UPSTREAM_SUFFIX}"]) - sh "dpkg-sig --sign builder -k dpkg1 pool/${component}/*" - // cleanup any prevously defined dists - sh "rm -rf dists" - } - - // now create the distro - for (component in list) { - sh "mkdir -p dists/${params.REPO_DISTRO}/${component}/binary-amd64/" - sh "apt-ftparchive packages pool/${component} > dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages" - sh "gzip -9fk dists/${params.REPO_DISTRO}/${component}/binary-amd64/Packages" - } - - // create and sign the release file - sh "apt-ftparchive release dists/${params.REPO_DISTRO} > dists/${params.REPO_DISTRO}/Release" - sh "gpg --yes -abs -u dpkg1 -o dists/${params.REPO_DISTRO}/Release.gpg dists/${params.REPO_DISTRO}/Release" - sh "rsync -avz . ${params.RSYNC_DESTINATION}/${params.RELEASE}" - } - } - - stage("Cleanup") { - // check for previous containers and clean them up - sh "jenkins/system/delete_old_containers.sh ${container_name_prefix}" - } - - stage("Build") { - from_source = '' - if ( params.BUILD_FROM_SOURCE ) - { - from_source = '--source' - } - - sh """ - export OSM_USE_LOCAL_DEVOPS=true - jenkins/host/start_build system --build-container ${container_name} \ - -b ${params.COMMIT_ID} \ - -r ${params.REPO_DISTRO} \ - -u ${params.REPO_BASE_URL} \ - -k ${params.REPO_KEY_NAME} \ - -R ${params.RELEASE} \ - ${from_source} - """ - } - - stage("Archive Artifacts") { - sh "echo ${container_name} > build_version.txt" - sh "tar -zcvf repo.tar.gz repo" - archiveArtifacts artifacts: "build_version.txt, repo.tar.gz", fingerprint: true - } -} diff --git a/jenkins/system/delete_old_containers.sh b/jenkins/system/delete_old_containers.sh index 13c6df42..b8d1934b 100755 --- a/jenkins/system/delete_old_containers.sh +++ b/jenkins/system/delete_old_containers.sh @@ -17,6 +17,7 @@ # on an input prefix to check. Jenkins builds will add an incrementing # build suffix (build number) to the prefix # +# #$1 container prefix name keep_number=1 diff --git a/systest/Jenkinsfile b/systest/Jenkinsfile index 8e290e8a..31372bce 100644 --- a/systest/Jenkinsfile +++ b/systest/Jenkinsfile @@ -20,7 +20,6 @@ node("${params.NODE}") { // get the IP of the osm container OSM_IP = sh(returnStdout: true, script: "lxc list ${container_name} -c 4|grep eth0 |awk '{print \$2}'").trim() } - stage("checkout") { checkout scm }