engine: Abort job if dependency job did not succeed
Change-Id: I6c677f4a0f4fb4ccc3384c16e955991793bb564d
diff --git a/jjb/engine/kubernetes-periodic-jobs/kubernetes-offline-release-jobs.yaml b/jjb/engine/kubernetes-periodic-jobs/kubernetes-offline-release-jobs.yaml
index a04d718..29a3dba 100644
--- a/jjb/engine/kubernetes-periodic-jobs/kubernetes-offline-release-jobs.yaml
+++ b/jjb/engine/kubernetes-periodic-jobs/kubernetes-offline-release-jobs.yaml
@@ -99,11 +99,19 @@
description: 'CI loop type'
- label:
name: SLAVE_LABEL
- default: 'engine-build-ubuntu1804'
+ default: 'engine-package-ubuntu1804'
description: 'Slave label to schedule this job on.'
properties:
- logrotate
+ - build-blocker:
+ use-build-blocker: true
+ blocking-jobs:
+ - 'engine-verify-package-.*'
+ - 'onap-sdc-periodic-release-offline-.*'
+ - 'onap-so-periodic-release-offline-.*'
+ - 'kubernetes-periodic-release-offline-.*'
+ block-level: 'NODE'
wrappers:
- build-timeout:
diff --git a/jjb/engine/onap-periodic-jobs/onap-online-deploy-test-jobs.yaml b/jjb/engine/onap-periodic-jobs/onap-online-deploy-test-jobs.yaml
index 3ed4518..2448092 100644
--- a/jjb/engine/onap-periodic-jobs/onap-online-deploy-test-jobs.yaml
+++ b/jjb/engine/onap-periodic-jobs/onap-online-deploy-test-jobs.yaml
@@ -66,7 +66,7 @@
cloud:
- city:
- slave-label: 'city-jumphost-ubuntu1804'
+ slave-label: 'engine-jumphost-online-ubuntu1804'
openrc-credentials-file: 'est-jenkins-openrcfile-city-frankfurt-onap'
daily-trigger: '@midnight'
diff --git a/jjb/engine/onap-periodic-jobs/onap-online-release-jobs.yaml b/jjb/engine/onap-periodic-jobs/onap-online-release-jobs.yaml
index def858b..41ed401 100644
--- a/jjb/engine/onap-periodic-jobs/onap-online-release-jobs.yaml
+++ b/jjb/engine/onap-periodic-jobs/onap-online-release-jobs.yaml
@@ -113,11 +113,19 @@
description: 'CI loop type'
- label:
name: SLAVE_LABEL
- default: 'engine-build-ubuntu1804'
+ default: 'engine-package-ubuntu1804'
description: 'Slave label to schedule this job on.'
properties:
- logrotate
+ - build-blocker:
+ use-build-blocker: true
+ blocking-jobs:
+ - 'engine-verify-package-.*'
+ - 'onap-sdc-periodic-release-offline-.*'
+ - 'onap-so-periodic-release-offline-.*'
+ - 'kubernetes-periodic-release-offline-.*'
+ block-level: 'NODE'
wrappers:
- build-timeout:
diff --git a/jjb/engine/onap-periodic-jobs/onap-parameter-macros.yaml b/jjb/engine/onap-periodic-jobs/onap-parameter-macros.yaml
index 511837a..837a27a 100644
--- a/jjb/engine/onap-periodic-jobs/onap-parameter-macros.yaml
+++ b/jjb/engine/onap-periodic-jobs/onap-parameter-macros.yaml
@@ -28,7 +28,7 @@
- nordix-gerrit-parameters
- label:
name: SLAVE_LABEL
- default: 'city-jumphost-ubuntu1804'
+ default: 'engine-jumphost-online-ubuntu1804'
description: 'Slave label to schedule this job on. All slaves have Ubuntu1604 no matter what distro target nodes use'
- string:
name: PROVISIONER_TYPE
diff --git a/jjb/engine/scripts/generate-ssh-keypair.sh b/jjb/engine/scripts/generate-ssh-keypair.sh
index 04633fd..00f8336 100755
--- a/jjb/engine/scripts/generate-ssh-keypair.sh
+++ b/jjb/engine/scripts/generate-ssh-keypair.sh
@@ -22,6 +22,8 @@
set -o errexit
set -o pipefail
-echo "Info : Generating SSH keypair for the job"
-ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N '' <<< y > /dev/null 2>&1
-chmod -R go-rwx ~/.ssh
+if [[ ! -f "$HOME/.ssh/id_rsa" ]]; then
+ echo "Info : Generating SSH keypair for the job"
+ ssh-keygen -q -t rsa -f ~/.ssh/id_rsa -N '' <<< y > /dev/null 2>&1
+ chmod -R go-rwx ~/.ssh
+fi
diff --git a/jjb/engine/scripts/package.sh b/jjb/engine/scripts/package.sh
index 482b3a0..4815fd8 100755
--- a/jjb/engine/scripts/package.sh
+++ b/jjb/engine/scripts/package.sh
@@ -22,5 +22,7 @@
set -o errexit
set -o pipefail
-cd "$WORKSPACE"
+cd "$WORKSPACE/engine"
./package.sh
+
+# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/engine/scripts/upload-artifact.sh b/jjb/engine/scripts/upload-artifact.sh
index 79ba0a9..97bb136 100755
--- a/jjb/engine/scripts/upload-artifact.sh
+++ b/jjb/engine/scripts/upload-artifact.sh
@@ -22,7 +22,7 @@
set -o errexit
set -o pipefail
-if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+if [[ "$EXECUTION_MODE" == "packaging" || "$EXECUTION_MODE" == "offline-deployment" ]]; then
cd /tmp
for ARTIFACT_TO_UPLOAD in $ARTIFACTS_TO_UPLOAD; do
echo "Info : Generating checksums for $ARTIFACT_TO_UPLOAD"
diff --git a/jjb/engine/scripts/wait-for-pkg-manager.sh b/jjb/engine/scripts/wait-for-pkg-manager.sh
index 99f7544..028a4ce 100755
--- a/jjb/engine/scripts/wait-for-pkg-manager.sh
+++ b/jjb/engine/scripts/wait-for-pkg-manager.sh
@@ -34,7 +34,7 @@
# just wait few seconds before attempting to check pkg manager process
sleep 10
-echo "Info: Waiting for completion of an existing $pkg_mgr_cmd process before proceeding..."
+echo "Info : Waiting for completion of an existing $pkg_mgr_cmd process before proceeding..."
while true; do
pkg_mgr_process=$(pgrep -f $pkg_mgr_cmd | cat)
if [[ -n $pkg_mgr_process ]]; then
@@ -43,6 +43,6 @@
break
fi
done
-echo "Info: $pkg_mgr_cmd process done. Continuing..."
+echo "Info : $pkg_mgr_cmd process done. Continuing..."
# vim: set ts=2 sw=2 expandtab:
diff --git a/jjb/engine/verify-jobs/engine-verify-deploy-test.yaml b/jjb/engine/verify-jobs/engine-verify-deploy-test.yaml
index da08cf1..e24377b 100644
--- a/jjb/engine/verify-jobs/engine-verify-deploy-test.yaml
+++ b/jjb/engine/verify-jobs/engine-verify-deploy-test.yaml
@@ -67,6 +67,9 @@
- city:
openrc-credentials-file: 'est-jenkins-openrcfile-city-karlskrona-onap'
+ dependency-jobs: 'engine-verify-package-{distro}-{stream}'
+ dependency-job-var: 'TRIGGER_engine_verify_package_{distro}_{stream}_BUILD_RESULT'
+
jobs:
- 'engine-verify-{environment-type}-deploy-test-{distro}-{cloud}-{type}-{stream}'
- 'engine-verify-{environment-type}-{phase}-{distro}-{cloud}-{type}-{stream}'
@@ -83,7 +86,7 @@
parameters:
- label:
name: SLAVE_LABEL
- default: 'engine-{slave-type}-online-{distro}'
+ default: 'engine-{slave-type}-{environment-type}-{distro}'
description: 'Slave label to schedule this job on.'
- string:
name: EXECUTION_MODE
@@ -150,6 +153,10 @@
default: 'true'
description: 'Verbosity setting for the engine - true or false - default is false'
- string:
+ name: NORDIX_GERRIT_PUBLIC_IP
+ default: '91.106.198.142'
+ description: 'Public IP of Nordix Gerrit. Offline deployments can not resolve domain name'
+ - string:
name: NORDIX_ARM_PUBLIC_IP
default: '91.106.198.25'
description: 'Public IP of Nordix Artifactory. Offline deployments can not resolve domain name'
@@ -163,7 +170,11 @@
description: 'Name of the repository to upload and download artifact to/from. Depends on the stack'
- string:
name: ARTIFACT_TO_DOWNLOAD
- default: "https://artifactory.nordix.org/artifactory/nordix-kubernetes/installer/oss/gerrit/$GERRIT_CHANGE_ID/k8s-installer-ubuntu1804.bsx"
+ default: "k8s-installer-ubuntu1804.bsx"
+ description: 'Artifact to download'
+ - string:
+ name: NORDIX_ARTIFACT_URL
+ default: "$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/installer/oss/gerrit/$GERRIT_CHANGE_NUMBER"
description: 'Artifact to download'
- project-parameters:
project: $GERRIT_PROJECT
@@ -184,22 +195,6 @@
- 'engine-verify-offline-deploy-test-.*'
block-level: 'NODE'
- wrappers:
- - build-timeout:
- timeout: 180
- - credentials-binding:
- - file:
- credential-id: '{openrc-credentials-file}'
- variable: OPENRC_FILE
- - username-password-separated:
- credential-id: 'nordix-cicd-arm-credentials'
- username: NORDIX_ARM_USERNAME
- password: NORDIX_ARM_TOKEN
- - mask-passwords
- - fix-workspace-permissions
- - openstack:
- single-use: True
-
scm:
- git-scm-gerrit:
ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
@@ -238,7 +233,46 @@
notbuilt: '{obj:notbuilt}'
custom-url: '* $JOB_NAME $BUILD_URL'
readable-message: 'true'
- dependency-jobs: 'engine-verify-tox-{stream},engine-verify-package-{distro}-{stream}'
+ dependency-jobs: '{dependency-jobs}'
+
+ wrappers:
+ - build-timeout:
+ timeout: 180
+ - credentials-binding:
+ - file:
+ credential-id: '{openrc-credentials-file}'
+ variable: OPENRC_FILE
+ - username-password-separated:
+ credential-id: 'nordix-cicd-arm-credentials'
+ username: NORDIX_ARM_USERNAME
+ password: NORDIX_ARM_TOKEN
+ - mask-passwords
+ - openstack:
+ single-use: True
+ - pre-scm-buildstep:
+ failOnError: true
+ buildsteps:
+ - system-groovy:
+ command: |
+ def build = this.getProperty('binding').getVariable('build')
+ def listener = this.getProperty('binding').getVariable('listener')
+ if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
+ println "WARN : Aborting build since dependent job did not succeed!"
+ throw new InterruptedException()
+ }}
+ - shell: |
+ #!/bin/bash
+ sudo chown -R $USER:$USER $WORKSPACE || exit 1
+ # offline nodes can not resolve Nordix Gerrit
+ if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+ echo "Info : Offline deployment. Adding Nordix Gerrit Public IP to /etc/hosts"
+ sudo sed -i 's/^search/# search/' /etc/resolv.conf
+ sudo bash -c "cat << EOF >> /etc/hosts
+ # managed by engine
+ $NORDIX_GERRIT_PUBLIC_IP gerrit.nordix.org
+ # managed by engine
+ EOF"
+ fi
builders:
- multijob:
@@ -292,6 +326,14 @@
max-total: 3
option: project
+ scm:
+ - git-scm-gerrit:
+ ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
+ branch: '{branch}'
+ refspec: $GERRIT_REFSPEC
+ wipe_workspace: true
+ clean_before: false
+
wrappers:
- build-timeout:
timeout: 180
@@ -306,15 +348,13 @@
- mask-passwords
- fix-workspace-permissions
- scm:
- - git-scm-gerrit:
- ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
- branch: '{branch}'
- refspec: $GERRIT_REFSPEC
- wipe_workspace: true
- clean_before: false
-
builders:
+ - shell: |
+ #!/bin/bash
+ if [[ "$EXECUTION_MODE" == "offline-deployment" && "$PROVISIONER_TYPE" == "heat" ]]; then
+ echo "Info : Offline deployment and testing on cloud instances is not currently supported!"
+ exit 0
+ fi
- 'generate-ssh-keypair-macro'
- 'wait-pkg-mgr-macro'
- 'download-artifact-macro'
diff --git a/jjb/engine/verify-jobs/engine-verify-package.yaml b/jjb/engine/verify-jobs/engine-verify-package.yaml
index 4a44bd0..27f4b2e 100644
--- a/jjb/engine/verify-jobs/engine-verify-package.yaml
+++ b/jjb/engine/verify-jobs/engine-verify-package.yaml
@@ -36,6 +36,9 @@
distro:
- ubuntu1804
+ dependency-jobs: 'engine-verify-tox-{stream}'
+ dependency-job-var: 'TRIGGER_engine_verify_tox_{stream}_BUILD_RESULT'
+
jobs:
- 'engine-verify-package-{distro}-{stream}'
@@ -76,12 +79,16 @@
default: 'nordix-kubernetes'
description: 'Name of the repository to upload and download artifact to/from. Depends on the stack'
- string:
+ name: NORDIX_ARTIFACT_URL
+ default: "$NORDIX_ARM_HTTPS_URL/$NORDIX_ARM_REPO/installer/oss/gerrit/$GERRIT_CHANGE_NUMBER"
+ description: 'Artifact to download'
+ - string:
name: CI_LOOP
default: 'verify'
description: 'CI loop type'
- label:
name: SLAVE_LABEL
- default: 'engine-master-offline-{distro}'
+ default: 'engine-package-{distro}'
description: 'Slave label to schedule this job on.'
- project-parameters:
project: $GERRIT_PROJECT
@@ -95,14 +102,14 @@
max-per-node: 1
max-total: 3
option: project
-
- wrappers:
- - build-timeout:
- timeout: 180
- - mask-passwords
- - fix-workspace-permissions
- - openstack:
- single-use: True
+ - build-blocker:
+ use-build-blocker: true
+ blocking-jobs:
+ - 'engine-verify-package-.*'
+ - 'onap-sdc-periodic-release-offline-.*'
+ - 'onap-so-periodic-release-offline-.*'
+ - 'kubernetes-periodic-release-offline-.*'
+ block-level: 'NODE'
scm:
- git-scm-gerrit:
@@ -142,9 +149,11 @@
notbuilt: '{obj:notbuilt}'
custom-url: '* $JOB_NAME $BUILD_URL'
readable-message: 'true'
- dependency-jobs: 'engine-verify-tox-{stream}'
+ dependency-jobs: '{dependency-jobs}'
wrappers:
+ - openstack:
+ single-use: True
- build-timeout:
timeout: 70
- credentials-binding:
@@ -153,7 +162,21 @@
username: NORDIX_ARM_USERNAME
password: NORDIX_ARM_TOKEN
- mask-passwords
- - fix-workspace-permissions
+ - pre-scm-buildstep:
+ failOnError: true
+ buildsteps:
+ - system-groovy:
+ command: |
+ def build = this.getProperty('binding').getVariable('build')
+ def listener = this.getProperty('binding').getVariable('listener')
+ if (build.getEnvironment(listener).{dependency-job-var} != "SUCCESS") {{
+ println "WARN : Aborting build since dependent job did not succeed!"
+ throw new InterruptedException()
+ }}
+ - shell: |
+ #!/bin/bash
+ sudo chown -R $USER:$USER $WORKSPACE || exit 1
+
builders:
- 'generate-ssh-keypair-macro'