engine: Abort job if dependency job did not succeed

Change-Id: I6c677f4a0f4fb4ccc3384c16e955991793bb564d
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: