Added pipelines previously defined in mk-ci-salt-model
Change-Id: Id759cf59d029b3d7d9e1fbd13abf875b6737ebc4
diff --git a/build-debian-packages.groovy b/build-debian-packages.groovy
new file mode 100644
index 0000000..58dfe57
--- /dev/null
+++ b/build-debian-packages.groovy
@@ -0,0 +1,95 @@
+def common = new com.mirantis.mk.Common()
+def aptly = new com.mirantis.mk.Aptly()
+def debian = new com.mirantis.mk.Debian()
+
+def snapshot
+try {
+ snapshot = DEBIAN_SNAPSHOT
+} catch (MissingPropertyException e) {
+ snapshot = false
+}
+def debian_branch
+try {
+ debian_branch = DEBIAN_BRANCH
+} catch (MissingPropertyException e) {
+ debian_branch = null
+}
+def revisionPostfix
+try {
+ revisionPostfix = REVISION_POSTFIX
+} catch (MissingPropertyException e) {
+ revisionPostfix = null
+}
+def timestamp = common.getDatetime()
+node("docker") {
+ try{
+ stage("checkout") {
+ sh("rm -rf src || true")
+ dir("src") {
+ def pollBranches = [[name:SOURCE_BRANCH]]
+ if (debian_branch) {
+ pollBranches.add([name:DEBIAN_BRANCH])
+ }
+ checkout changelog: true, poll: false,
+ scm: [$class: 'GitSCM', branches: pollBranches, doGenerateSubmoduleConfigurations: false,
+ extensions: [[$class: 'CleanCheckout']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: SOURCE_CREDENTIALS, url: SOURCE_URL]]]
+ if (debian_branch){
+ sh("git checkout "+DEBIAN_BRANCH)
+ }
+ }
+ debian.cleanup(OS+":"+DIST)
+ }
+ stage("build-source") {
+ debian.buildSource("src", OS+":"+DIST, snapshot, 'Jenkins', 'autobuild@mirantis.com', revisionPostfix)
+ archiveArtifacts artifacts: "build-area/*.dsc"
+ archiveArtifacts artifacts: "build-area/*_source.changes"
+ archiveArtifacts artifacts: "build-area/*.tar.*"
+ }
+ stage("build-binary") {
+ dsc = sh script: "ls build-area/*.dsc", returnStdout: true
+ debian.buildBinary(
+ dsc.trim(),
+ OS+":"+DIST,
+ EXTRA_REPO_URL,
+ EXTRA_REPO_KEY_URL
+ )
+ archiveArtifacts artifacts: "build-area/*.deb"
+ }
+ stage("lintian") {
+ changes = sh script: "ls build-area/*_"+ARCH+".changes", returnStdout: true
+ try {
+ debian.runLintian(changes.trim(), OS, OS+":"+DIST)
+ } catch (Exception e) {
+ println "[WARN] Lintian returned non-zero exit status"
+ currentBuild.result = 'UNSTABLE'
+ }
+ }
+ lock("aptly-api") {
+ stage("upload") {
+ buildSteps = [:]
+ debFiles = sh script: "ls build-area/*.deb", returnStdout: true
+ for (file in debFiles.tokenize()) {
+ workspace = common.getWorkspace()
+ def fh = new File((workspace+"/"+file).trim())
+ buildSteps[fh.name.split('_')[0]] = aptly.uploadPackageStep(
+ "build-area/"+fh.name,
+ APTLY_URL,
+ APTLY_REPO,
+ true
+ )
+ }
+ parallel buildSteps
+ }
+ stage("publish") {
+ aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
+ aptly.publish(APTLY_URL)
+ }
+ }
+ } catch (Throwable e) {
+ // If there was an error or exception thrown, the build failed
+ currentBuild.result = "FAILURE"
+ throw e
+ } finally {
+ common.sendNotification(currentBuild.result,"",["slack"])
+ }
+}
\ No newline at end of file