engine: Enable deployment for new engine verify jobs 33/4033/15
authorFatih Degirmenci <fdegir@gmail.com>
Fri, 13 Mar 2020 16:24:37 +0000 (16:24 +0000)
committerFatih Degirmenci <fdegir@gmail.com>
Sun, 15 Mar 2020 17:06:31 +0000 (17:06 +0000)
Change-Id: Iea393e5624fdf86aeff6e75bb5df12badff59368

13 files changed:
jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml [moved from jjb/engine/engine-verify-deployment-parent-jobs.yaml with 67% similarity]
jjb/engine/engine-verify-jobs/engine-verify-macros.yaml [new file with mode: 0644]
jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml [moved from jjb/engine/engine-verify-offline-deploy-test.yaml with 85% similarity]
jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml [moved from jjb/engine/engine-verify-online-deploy-test.yaml with 86% similarity]
jjb/engine/engine-verify-jobs/engine-verify-tox.yaml [moved from jjb/engine/engine-verify-tox.yaml with 100% similarity]
jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh [new file with mode: 0755]
jjb/engine/engine-verify-jobs/scripts/deploy.sh [new file with mode: 0755]
jjb/engine/engine-verify-jobs/scripts/download-artifact.sh [new file with mode: 0755]
jjb/engine/engine-verify-jobs/scripts/engine-verify-tox.sh [moved from jjb/engine/scripts/engine-verify-tox.sh with 100% similarity]
jjb/engine/engine-verify-jobs/scripts/generate-ssh-keypair.sh [moved from jjb/engine/engine-macros.yaml with 64% similarity, mode: 0755]
jjb/engine/engine-verify-jobs/scripts/package.sh [new file with mode: 0755]
jjb/engine/engine-verify-jobs/scripts/test.sh [new file with mode: 0755]
jjb/engine/engine-verify-jobs/scripts/upload-artifact.sh [new file with mode: 0755]

similarity index 67%
rename from jjb/engine/engine-verify-deployment-parent-jobs.yaml
rename to jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml
index 0bfbb8955b3b78cce436b4433874eb6cc7ca780f..bee203e70947da9ff45fc220a393cfb54d63702e 100644 (file)
     concurrent: true
 
     parameters:
-      - project-parameters:
-          project: $GERRIT_PROJECT
-          branch: '{branch}'
-          description: 'The project and branch which the change is proposed for'
       - string:
           name: EXECUTION_MODE
           default: '{execution-mode}'
           description: 'Engine execution mode - online-deployment or offline-deployment - default is online-deployment'
+      - string:
+          name: DISTRO
+          default: '{distro}'
+          description: 'Distribution to use for configuring target nodes (networking etc.)'
       - string:
           name: VERBOSITY
           default: 'false'
           description: 'Verbosity setting for the engine - true or false - default is false'
-      - nordix-gerrit-parameters
+      - string:
+          name: NORDIX_ARM_PUBLIC_IP
+          default: '91.106.198.25'
+          description: 'Public IP of Nordix Artifactory. Offline deployments can not resolve domain name'
+      - string:
+          name: NORDIX_ARM_HTTPS_URL
+          default: 'https://artifactory.nordix.org/artifactory'
+          description: 'URL to Nordix Artifactory'
+      - string:
+          name: NORDIX_ARM_REPO
+          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/change/$GERRIT_CHANGE_NUMBER/k8s-installer-ubuntu1804.bsx"
+          description: 'Name of the repository to upload and download artifact to/from. Depends on the stack'
       - label:
           name: SLAVE_LABEL
           default: 'engine-master-{environment-type}-{distro}'
           description: 'Slave label to schedule this job on.'
-      - string:
-          name: DISTRO
-          default: '{distro}'
-          description: 'Distribution to use for configuring target nodes (networking etc.)'
+      - project-parameters:
+          project: $GERRIT_PROJECT
+          branch: '{branch}'
+          description: 'The project and branch which the change is proposed for'
+      - nordix-gerrit-parameters
 
     properties:
       - logrotate
-      - build-blocker:
-          use-build-blocker: true
-          blocking-jobs:
-            - 'engine-verify-packaging-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-            - 'engine-verify-offline-ubuntu1804.*'
-          block-level: 'NODE'
+#      - build-blocker:
+#          use-build-blocker: true
+#          blocking-jobs:
+#            - 'engine-verify-online-ubuntu1804.*'
+#            - 'engine-verify-offline-ubuntu1804.*'
+#          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
     wrappers:
       - build-timeout:
           timeout: 180
-      - credentials-binding:
-          - username-password-separated:
-              credential-id: 'nordix-cicd-arm-credentials'
-              username: NORDIX_ARM_USERNAME
-              password: NORDIX_ARM_TOKEN
       - mask-passwords
       - fix-workspace-permissions
       - openstack:
             unstable: '{obj:unstable}'
             notbuilt: '{obj:notbuilt}'
           custom-url: '* $JOB_NAME $BUILD_URL'
+          readable-message: 'true'
 
     builders:
       - multijob:
-          name: Packaging
+          name: packaging
           condition: SUCCESSFUL
           execution-type: PARALLEL
           projects:
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: true
+#             enable-condition: "\"$EXECUTION_MODE\" == \"offline-deployment\""
       - multijob:
-          name: Deployment and Testing
+          name: "{environment-type} deployment and testing"
           condition: SUCCESSFUL
           execution-type: PARALLEL
           projects:
             - name: 'engine-verify-{environment-type}-deploy-test-{distro}-city-virtual-master'
-              current-parameters: true
+              current-parameters: false
               node-parameters: false
+              predefined-parameters: |
+                GIT_BASE_SSH=$GIT_BASE_SSH
+                GERRIT_PROJECT=$GERRIT_PROJECT
+                GERRIT_BRANCH=$GERRIT_BRANCH
+                GERRIT_REFSPEC=$GERRIT_REFSPEC
+                GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+                GERRIT_CHANGE_ID=$GERRIT_CHANGE_ID
+                GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+                PROJECT=$GERRIT_PROJECT
+                BRANCH=$BRANCH
+                NORDIX_ARM_PUBLIC_IP=$NORDIX_ARM_PUBLIC_IP
+                NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL
+                EXECUTION_MODE=$EXECUTION_MODE
+                VERBOSITY=$VERBOSITY
+                DISTRO=$DISTRO
+              property-file: "$WORKSPACE/change.properties"
               kill-phase-on: FAILURE
               abort-all-job: true
             - name: 'engine-verify-{environment-type}-deploy-test-{distro}-city-cloud-master'
-              current-parameters: true
+              current-parameters: false
               node-parameters: false
+              predefined-parameters: |
+                GIT_BASE_SSH=$GIT_BASE_SSH
+                GERRIT_PROJECT=$GERRIT_PROJECT
+                GERRIT_BRANCH=$GERRIT_BRANCH
+                GERRIT_REFSPEC=$GERRIT_REFSPEC
+                GERRIT_CHANGE_COMMIT_MESSAGE=$GERRIT_CHANGE_COMMIT_MESSAGE
+                GERRIT_CHANGE_ID=$GERRIT_CHANGE_ID
+                GERRIT_CHANGE_NUMBER=$GERRIT_CHANGE_NUMBER
+                PROJECT=$GERRIT_PROJECT
+                BRANCH=$BRANCH
+                NORDIX_ARM_PUBLIC_IP=$NORDIX_ARM_PUBLIC_IP
+                NORDIX_ARTIFACT_URL=$NORDIX_ARTIFACT_URL
+                EXECUTION_MODE=$EXECUTION_MODE
+                VERBOSITY=$VERBOSITY
+                DISTRO=$DISTRO
               kill-phase-on: FAILURE
               abort-all-job: true
 
 
     properties:
       - logrotate
-      - build-blocker:
-          use-build-blocker: true
-          blocking-jobs:
-            - 'engine-verify-packaging-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-            - 'engine-verify-offline-ubuntu1804.*'
-          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
 
     wrappers:
       - build-timeout:
-          timeout: 180
+          timeout: 70
       - credentials-binding:
           - username-password-separated:
               credential-id: 'nordix-cicd-arm-credentials'
               password: NORDIX_ARM_TOKEN
       - mask-passwords
       - fix-workspace-permissions
-      - openstack:
-          single-use: True
 
     scm:
       - git-scm-gerrit:
           clean_before: false
 
     builders:
-      - shell: |
-          env
+      - 'engine-generate-ssh-keypair-macro'
+      - 'engine-packaging-macro'
+      - 'engine-upload-artifact-macro'
diff --git a/jjb/engine/engine-verify-jobs/engine-verify-macros.yaml b/jjb/engine/engine-verify-jobs/engine-verify-macros.yaml
new file mode 100644 (file)
index 0000000..1bb5cb8
--- /dev/null
@@ -0,0 +1,71 @@
+---
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+#-------------------------------------------------------------------------------
+# Macros are used to avoid hitting parameter expansion of curly brackets and
+# the need to using include-raw-escape
+#-------------------------------------------------------------------------------
+- builder:
+    name: 'engine-verify-tox-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/engine-verify-tox.sh
+
+
+- builder:
+    name: 'engine-generate-ssh-keypair-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/generate-ssh-keypair.sh
+
+- builder:
+    name: 'engine-packaging-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/package.sh
+
+- builder:
+    name: 'engine-upload-artifact-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/upload-artifact.sh
+
+- builder:
+    name: 'engine-download-artifact-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/download-artifact.sh
+
+- builder:
+    name: 'engine-deploy-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/deploy.sh
+
+- builder:
+    name: 'engine-test-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/test.sh
+
+- builder:
+    name: 'engine-delete-stack-macro'
+    builders:
+      - shell:
+          !include-raw: ./scripts/delete-heat-stack.sh
similarity index 85%
rename from jjb/engine/engine-verify-offline-deploy-test.yaml
rename to jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml
index 94acd7d04d0e2fde035bdd359f87234077e374b9..ee94e3abb3c6ab68e0d60417ddf9525bf9559c2d 100644 (file)
 
     properties:
       - logrotate
-      - build-blocker:
-          use-build-blocker: true
-          blocking-jobs:
-            - 'engine-verify-packaging-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-            - 'engine-verify-offline-ubuntu1804.*'
-          block-level: 'NODE'
+#      - build-blocker:
+#          use-build-blocker: true
+#          blocking-jobs:
+#            - 'engine-verify-online-deploy-test-.*'
+#            - 'engine-verify-offline-deploy-test-.*'
+#          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
           single-use: True
 
     builders:
-      - shell: |
-          #!/bin/bash
-          cp $OPENRC_FILE /tmp/openrc
+      - 'engine-generate-ssh-keypair-macro'
+      - 'engine-download-artifact-macro'
       - multijob:
-          name: Offline Deployment on {type} instances
+          name: "Offline Deployment on {type} instances"
           condition: SUCCESSFUL
           execution-type: PARALLEL
           projects:
               kill-phase-on: FAILURE
               abort-all-job: true
       - multijob:
-          name: Offline Testing on {type} instances
+          name: "Offline Testing on {type} instances"
           condition: SUCCESSFUL
           execution-type: PARALLEL
           projects:
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: true
+      - conditional-step:
+          condition-kind: and
+          condition-operands:
+            - condition-kind: strings-match
+              condition-string1: $DELETE_STACK
+              condition-string2: true
+            - condition-kind: strings-match
+              condition-string1: $PROVISIONER_TYPE
+              condition-string2: heat
+          on-evaluation-failure: dont-run
+          steps:
+            - 'engine-delete-stack-macro'
 
 - job-template:
     name: 'engine-verify-offline-{phase}-{distro}-{cloud}-{type}-{stream}'
 
     properties:
       - logrotate
-      - build-blocker:
-          use-build-blocker: true
-          blocking-jobs:
-            - 'engine-verify-packaging-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-            - 'engine-verify-offline-ubuntu1804.*'
-          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
               password: NORDIX_ARM_TOKEN
       - mask-passwords
       - fix-workspace-permissions
-      - openstack:
-          single-use: True
 
     builders:
-      - shell: |
-          #!/bin/bash
-          cp $OPENRC_FILE /tmp/openrc
-          env
+      - 'engine-{phase}-macro'
similarity index 86%
rename from jjb/engine/engine-verify-online-deploy-test.yaml
rename to jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml
index e350840c5920b90cc8ebb5bbe8fbfa47ced31c24..61d9d18bf233f658adac52f251cbfc9cd0d2a3e1 100644 (file)
 
     properties:
       - logrotate
-      - build-blocker:
-          use-build-blocker: true
-          blocking-jobs:
-            - 'engine-verify-packaging-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-          block-level: 'NODE'
+#      - build-blocker:
+#          use-build-blocker: true
+#          blocking-jobs:
+#            - 'engine-verify-online-deploy-test-.*'
+#            - 'engine-verify-offline-deploy-test-.*'
+#          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
           clean_before: false
 
     builders:
-      - shell: |
-          #!/bin/bash
-          cp $OPENRC_FILE /tmp/openrc
+      - 'engine-generate-ssh-keypair-macro'
+      - 'engine-download-artifact-macro'
       - multijob:
-          name: Offline Deployment on {type} instances
+          name: "Online Deployment on {type} instances"
           condition: SUCCESSFUL
           execution-type: PARALLEL
           projects:
               kill-phase-on: FAILURE
               abort-all-job: true
       - multijob:
-          name: Offline Testing on {type} instances
+          name: "Online Testing on {type} instances"
           condition: SUCCESSFUL
           execution-type: PARALLEL
           projects:
               node-parameters: true
               kill-phase-on: FAILURE
               abort-all-job: true
+      - conditional-step:
+          condition-kind: and
+          condition-operands:
+            - condition-kind: strings-match
+              condition-string1: $DELETE_STACK
+              condition-string2: true
+            - condition-kind: strings-match
+              condition-string1: $PROVISIONER_TYPE
+              condition-string2: heat
+          on-evaluation-failure: dont-run
+          steps:
+            - 'engine-delete-stack-macro'
 
 - job-template:
     name: 'engine-verify-online-{phase}-{distro}-{cloud}-{type}-{stream}'
 
     properties:
       - logrotate
-      - build-blocker:
-          use-build-blocker: true
-          blocking-jobs:
-            - 'engine-verify-packaging-ubuntu1804.*'
-            - 'engine-verify-online-ubuntu1804.*'
-            - 'engine-verify-offline-ubuntu1804.*'
-          block-level: 'NODE'
       - throttle:
           max-per-node: 1
           max-total: 3
               password: NORDIX_ARM_TOKEN
       - mask-passwords
       - fix-workspace-permissions
-      - openstack:
-          single-use: True
 
     scm:
       - git-scm-gerrit:
           clean_before: false
 
     builders:
-      - shell: |
-          #!/bin/bash
-          cp $OPENRC_FILE /tmp/openrc
-          env
+      - 'engine-{phase}-macro'
diff --git a/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh b/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh
new file mode 100755 (executable)
index 0000000..da41d0b
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+if [[ "$EXECUTION_MODE" == "offline-deployment" && "$PROVISIONER_TYPE" == "heat" ]]; then
+  echo "Info  : Offline deployments on cloud instances is not currently supported!"
+  exit 0
+fi
+
+set +u
+source /opt/engine/.venv/bin/activate
+set -u
+
+echo "Info: Deleting stack $STACK_NAME and keypair $KEYPAIR_NAME"
+echo "-------------------------------------------------------------------------"
+source /tmp/openrc && /bin/rm -f /tmp/openrc
+openstack stack delete $STACK_NAME --wait --yes
+openstack keypair delete $KEYPAIR_NAME
+echo "-------------------------------------------------------------------------"
+echo "Info: Stack $STACK_NAME and keypair $KEYPAIR_NAME have been deleted!"
diff --git a/jjb/engine/engine-verify-jobs/scripts/deploy.sh b/jjb/engine/engine-verify-jobs/scripts/deploy.sh
new file mode 100755 (executable)
index 0000000..4218c5e
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+if [[ "$EXECUTION_MODE" == "offline-deployment" && "$PROVISIONER_TYPE" == "heat" ]]; then
+  echo "Info  : Offline deployments on cloud instances is not currently supported!"
+  exit 0
+fi
+
+if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+  ENGINE_ROOT_DIR="/opt/engine/offline/git/engine"
+  PDF="file:///opt/engine/offline/git/hwconfig/pods/nordix-vpod1-pdf.yml"
+  IDF="file:///opt/engine/offline/git/hwconfig/pods/nordix-vpod1-idf.yml"
+else
+  ENGINE_ROOT_DIR="$WORKSPACE"
+  PDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-pdf.yml"
+  IDF="https://gerrit.nordix.org/gitweb?p=infra/hwconfig.git;a=blob_plain;f=pods/nordix-vpod1-idf.yml"
+fi
+
+/bin/cp -f $OPENRC_FILE /tmp/openrc
+cd "$ENGINE_ROOT_DIR/engine"
+./deploy.sh -d kubespray -s k8-calico-nofeature -b "file://$ENGINE_ROOT_DIR/engine/inventory/group_vars/all/sdf.yaml" \
+    -r $PROVISIONER_TYPE -p $PDF -i $IDF -u /tmp/openrc \
+    -e "file://$ENGINE_ROOT_DIR/engine/provisioner/heat/playbooks/roles/bootstrap-hwconfig/files/$HEAT_ENVIRONMENT_FILENAME"
diff --git a/jjb/engine/engine-verify-jobs/scripts/download-artifact.sh b/jjb/engine/engine-verify-jobs/scripts/download-artifact.sh
new file mode 100755 (executable)
index 0000000..d67405a
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+  echo "Info  : Offline deployment. Adding Nordix ARM Public IP to /etc/hosts"
+  sudo bash -c "cat << EOF >> /etc/hosts
+# managed by engine
+$NORDIX_ARM_PUBLIC_IP artifactory.nordix.org
+# managed by engine
+EOF"
+  echo "Info  : Downloading artifact from Nordix ARM."
+  cd /tmp
+  curl -s -O $NORDIX_ARTIFACT_URL
+  echo "Info  : Downloaded the artifact for offline deployment. Extracting."
+  chmod +x /tmp/k8s-installer-ubuntu1804.bsx
+  /tmp/k8s-installer-ubuntu1804.bsx
+else
+  echo "Info  : Online deployment. Skipping artifact download."
+fi
old mode 100644 (file)
new mode 100755 (executable)
similarity index 64%
rename from jjb/engine/engine-macros.yaml
rename to jjb/engine/engine-verify-jobs/scripts/generate-ssh-keypair.sh
index b480a6a..04633fd
@@ -1,6 +1,7 @@
----
+#!/bin/bash
+
 # ============LICENSE_START=======================================================
-#  Copyright (C) 2019 Nordix Foundation.
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # SPDX-License-Identifier: Apache-2.0
 # ============LICENSE_END=========================================================
 
-#-------------------------------------------------------------------------------
-# Macros are used to avoid hitting parameter expansion of curly brackets and
-# the need to using include-raw-escape
-#-------------------------------------------------------------------------------
-- builder:
-    name: 'engine-verify-tox-macro'
-    builders:
-      - shell:
-          !include-raw: ./scripts/engine-verify-tox.sh
+set -o nounset
+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
diff --git a/jjb/engine/engine-verify-jobs/scripts/package.sh b/jjb/engine/engine-verify-jobs/scripts/package.sh
new file mode 100755 (executable)
index 0000000..c175f5e
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+  echo "Info  : Offline deployment. Proceeding with packaging."
+  cd $WORKSPACE/engine
+  ./package.sh
+else
+  echo "Info  : Online deployment. Skipping packaging."
+fi
diff --git a/jjb/engine/engine-verify-jobs/scripts/test.sh b/jjb/engine/engine-verify-jobs/scripts/test.sh
new file mode 100755 (executable)
index 0000000..a1c7f0e
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+echo "Info  : Not implemented!"
diff --git a/jjb/engine/engine-verify-jobs/scripts/upload-artifact.sh b/jjb/engine/engine-verify-jobs/scripts/upload-artifact.sh
new file mode 100755 (executable)
index 0000000..37d9d80
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+set -o nounset
+set -o errexit
+set -o pipefail
+
+if [[ "$EXECUTION_MODE" == "offline-deployment" ]]; then
+  echo "Info  : Generating artifact checksums"
+  cd /tmp
+  ARTIFACT_MD5SUM=$(md5sum k8s-installer-ubuntu1804.bsx | cut -d' ' -f1)
+  ARTIFACT_SHASUM=$(shasum k8s-installer-ubuntu1804.bsx | cut -d' ' -f1)
+  ARTIFACT_SHA256SUM=$(sha256sum k8s-installer-ubuntu1804.bsx | cut -d' ' -f1)
+
+  echo "Info  : Uploading artifact to Nordix Artifactory"
+  curl -s \
+      -H "X-JFrog-Art-Api:$NORDIX_ARM_TOKEN" \
+      -H "X-Checksum-MD5:$ARTIFACT_MD5SUM" \
+      -H "X-Checksum-Sha1:$ARTIFACT_SHASUM" \
+      -H "X-Checksum-Sha256:$ARTIFACT_SHA256SUM" \
+      -T k8s-installer-ubuntu1804.bsx \
+      "$NORDIX_ARTIFACT_URL"
+  echo "Info  : Artifact is available on $NORDIX_ARTIFACT_URL"
+else
+  echo "Info  : Online deployment. No artifact to upload."
+fi