Merge "Fixed groovy testing pipeline"
diff --git a/aptly-promote-pipeline.groovy b/aptly-promote-pipeline.groovy
index 6c84606..7c1cd42 100644
--- a/aptly-promote-pipeline.groovy
+++ b/aptly-promote-pipeline.groovy
@@ -1,11 +1,27 @@
def common = new com.mirantis.mk.Common()
def aptly = new com.mirantis.mk.Aptly()
+
+
+def packages
+try {
+ packages = PACKAGES
+} catch (MissingPropertyException e) {
+ packages = ""
+}
+
+def components
+try {
+ components = COMPONENTS
+} catch (MissingPropertyException e) {
+ components = ""
+}
+
node() {
try{
stage("promote") {
lock("aptly-api") {
wrap([$class: 'AnsiColorBuildWrapper']) {
- aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, null, null, DIFF_ONLY)
+ aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, components, packages, DIFF_ONLY)
}
}
}
diff --git a/build-debian-packages-pipeline.groovy b/build-debian-packages-pipeline.groovy
index 58dfe57..83a23fe 100644
--- a/build-debian-packages-pipeline.groovy
+++ b/build-debian-packages-pipeline.groovy
@@ -20,6 +20,21 @@
} catch (MissingPropertyException e) {
revisionPostfix = null
}
+
+def uploadPpa
+try {
+ uploadPpa = UPLOAD_PPA
+} catch (MissingPropertyException e) {
+ uploadPpa = null
+}
+
+def uploadAptly
+try {
+ uploadAptly = UPLOAD_APTLY
+} catch (MissingPropertyException e) {
+ uploadAptly = true
+}
+
def timestamp = common.getDatetime()
node("docker") {
try{
@@ -64,25 +79,35 @@
currentBuild.result = 'UNSTABLE'
}
}
- lock("aptly-api") {
- stage("upload") {
- buildSteps = [:]
- debFiles = sh script: "ls build-area/*.deb", returnStdout: true
- for (file in debFiles.tokenize()) {
+
+ if (uploadAptly) {
+ 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
- )
+ "build-area/"+fh.name,
+ APTLY_URL,
+ APTLY_REPO,
+ true
+ )
+ }
+ parallel buildSteps
}
- parallel buildSteps
- }
- stage("publish") {
+
+ stage("publish") {
aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
aptly.publish(APTLY_URL)
+ }
+ }
+ }
+ if (uploadPpa) {
+ stage("upload launchpad") {
+ debian.importGpgKey("launchpad-private")
+ debian.uploadPpa(PPA, "build-area", "launchpad-private")
}
}
} catch (Throwable e) {
diff --git a/cicd-lab-pipeline.groovy b/cicd-lab-pipeline.groovy
index b742e04..08b7527 100644
--- a/cicd-lab-pipeline.groovy
+++ b/cicd-lab-pipeline.groovy
@@ -244,6 +244,12 @@
}
salt.enforceState(saltMaster, 'I@nginx:server', 'nginx')
+ def failedSvc = salt.cmdRun(saltMaster, '*', """systemctl --failed | grep -E 'loaded[ \t]+failed' && echo 'Command execution failed'""")
+ print failedSvc
+ if (failedSvc =~ /Command execution failed/) {
+ common.errorMsg("Some services are not running. Environment may not be fully functional!")
+ }
+
common.successMsg("""
============================================================
Your CI/CD lab has been deployed and you can enjoy it:
diff --git a/lab-pipeline.groovy b/lab-pipeline.groovy
index c391e16..d57221f 100644
--- a/lab-pipeline.groovy
+++ b/lab-pipeline.groovy
@@ -292,6 +292,10 @@
stage('Install OpenStack control') {
//orchestrate.installOpenstackMkControl(saltMaster)
+ // Install horizon dashboard
+ salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true)
+ salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true)
+
// setup keystone service
//runSaltProcessStep(saltMaster, 'I@keystone:server', 'state.sls', ['keystone.server'], 1)
salt.enforceState(saltMaster, 'I@keystone:server and *01*', 'keystone.server', true)
@@ -316,8 +320,8 @@
// Install and check nova service
//runSaltProcessStep(saltMaster, 'I@nova:controller', 'state.sls', ['nova'], 1)
- salt.enforceState(saltMaster, 'I@nova:controller and *01*', 'nova', true)
- salt.enforceState(saltMaster, 'I@nova:controller', 'nova', true)
+ salt.enforceState(saltMaster, 'I@nova:controller and *01*', 'nova.controller', true)
+ salt.enforceState(saltMaster, 'I@nova:controller', 'nova.controller', true)
salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; nova service-list'], null, true)
// Install and check cinder service
@@ -329,8 +333,8 @@
// Install neutron service
//runSaltProcessStep(saltMaster, 'I@neutron:server', 'state.sls', ['neutron'], 1)
- salt.enforceState(saltMaster, 'I@neutron:server and *01*', 'neutron', true)
- salt.enforceState(saltMaster, 'I@neutron:server', 'neutron', true)
+ salt.enforceState(saltMaster, 'I@neutron:server and *01*', 'neutron.server', true)
+ salt.enforceState(saltMaster, 'I@neutron:server', 'neutron.server', true)
salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; neutron agent-list'], null, true)
// Install heat service
@@ -339,9 +343,8 @@
salt.enforceState(saltMaster, 'I@heat:server', 'heat', true)
salt.runSaltProcessStep(saltMaster, 'I@keystone:server', 'cmd.run', ['. /root/keystonerc; heat resource-type-list'], null, true)
- // Install horizon dashboard
- salt.enforceState(saltMaster, 'I@horizon:server', 'horizon', true)
- salt.enforceState(saltMaster, 'I@nginx:server', 'nginx', true)
+ // Restart nova api
+ salt.runSaltProcessStep(saltMaster, 'I@nova:controller', 'service.restart', ['nova-api'])
}
@@ -487,17 +490,17 @@
//vip=${vip:=172.16.10.253}
def pillar = salt.getPillar(saltMaster, 'ctl01*', '_param:stacklight_monitor_address')
print(pillar)
- def stacklight_vip = pillar['return'][0]['ctl01.nfv-lab.local']
- common.infoMsg("restart services on node with IP: ${stacklight_vip}")
+ def stacklight_vip = pillar['return'][0].values()[0]
- if (stacklight_vip == "") {
- throw new Exception("Missing stacklight_vip")
- } else {
+ if (stacklight_vip) {
// (re)Start manually the services that are bound to the monitoring VIP
+ common.infoMsg("restart services on node with IP: ${stacklight_vip}")
salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collectd'], null, true)
salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['remote_collector'], null, true)
salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['aggregator'], null, true)
salt.runSaltProcessStep(saltMaster, "G@ipv4:${stacklight_vip}", 'service.restart', ['nagios3'], null, true)
+ } else {
+ throw new Exception("Missing stacklight_vip")
}
}
}
@@ -526,6 +529,13 @@
}
}
+ stage('Finalize') {
+ try {
+ salt.runSaltProcessStep(saltMaster, '*', 'state.apply', [], null, true)
+ } catch (Exception e) {
+ common.warningMsg('State apply failed but we should continue to run')
+ }
+ }
} catch (Throwable e) {
currentBuild.result = 'FAILURE'