From: Fatih Degirmenci Date: Fri, 13 Mar 2020 16:24:37 +0000 (+0000) Subject: engine: Enable deployment for new engine verify jobs X-Git-Url: https://gerrit.nordix.org/gitweb?a=commitdiff_plain;h=79e736b702e73f71808b291f2354f7e81ba3063f;p=infra%2Fcicd.git engine: Enable deployment for new engine verify jobs Change-Id: Iea393e5624fdf86aeff6e75bb5df12badff59368 --- diff --git a/jjb/engine/engine-verify-deployment-parent-jobs.yaml b/jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml 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 0bfbb8955..bee203e70 100644 --- a/jjb/engine/engine-verify-deployment-parent-jobs.yaml +++ b/jjb/engine/engine-verify-jobs/engine-verify-deployment-parent-jobs.yaml @@ -64,37 +64,52 @@ 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 @@ -103,11 +118,6 @@ 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: @@ -150,10 +160,11 @@ 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: @@ -162,19 +173,51 @@ 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 @@ -187,13 +230,6 @@ 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 @@ -201,7 +237,7 @@ wrappers: - build-timeout: - timeout: 180 + timeout: 70 - credentials-binding: - username-password-separated: credential-id: 'nordix-cicd-arm-credentials' @@ -209,8 +245,6 @@ password: NORDIX_ARM_TOKEN - mask-passwords - fix-workspace-permissions - - openstack: - single-use: True scm: - git-scm-gerrit: @@ -221,5 +255,6 @@ 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 index 000000000..1bb5cb83c --- /dev/null +++ b/jjb/engine/engine-verify-jobs/engine-verify-macros.yaml @@ -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 diff --git a/jjb/engine/engine-verify-offline-deploy-test.yaml b/jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml 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 94acd7d04..ee94e3abb 100644 --- a/jjb/engine/engine-verify-offline-deploy-test.yaml +++ b/jjb/engine/engine-verify-jobs/engine-verify-offline-deploy-test.yaml @@ -102,13 +102,12 @@ 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 @@ -131,11 +130,10 @@ 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: @@ -145,7 +143,7 @@ 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: @@ -154,6 +152,18 @@ 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}' @@ -164,13 +174,6 @@ 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 @@ -189,11 +192,6 @@ 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' diff --git a/jjb/engine/engine-verify-online-deploy-test.yaml b/jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml 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 e350840c5..61d9d18bf 100644 --- a/jjb/engine/engine-verify-online-deploy-test.yaml +++ b/jjb/engine/engine-verify-jobs/engine-verify-online-deploy-test.yaml @@ -102,13 +102,12 @@ 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 @@ -139,11 +138,10 @@ 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: @@ -153,7 +151,7 @@ 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: @@ -162,6 +160,18 @@ 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}' @@ -172,13 +182,6 @@ 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 @@ -197,8 +200,6 @@ password: NORDIX_ARM_TOKEN - mask-passwords - fix-workspace-permissions - - openstack: - single-use: True scm: - git-scm-gerrit: @@ -209,7 +210,4 @@ clean_before: false builders: - - shell: | - #!/bin/bash - cp $OPENRC_FILE /tmp/openrc - env + - 'engine-{phase}-macro' diff --git a/jjb/engine/engine-verify-tox.yaml b/jjb/engine/engine-verify-jobs/engine-verify-tox.yaml similarity index 100% rename from jjb/engine/engine-verify-tox.yaml rename to jjb/engine/engine-verify-jobs/engine-verify-tox.yaml 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 index 000000000..da41d0b2b --- /dev/null +++ b/jjb/engine/engine-verify-jobs/scripts/delete-heat-stack.sh @@ -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 index 000000000..4218c5e41 --- /dev/null +++ b/jjb/engine/engine-verify-jobs/scripts/deploy.sh @@ -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 index 000000000..d67405a93 --- /dev/null +++ b/jjb/engine/engine-verify-jobs/scripts/download-artifact.sh @@ -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 diff --git a/jjb/engine/scripts/engine-verify-tox.sh b/jjb/engine/engine-verify-jobs/scripts/engine-verify-tox.sh similarity index 100% rename from jjb/engine/scripts/engine-verify-tox.sh rename to jjb/engine/engine-verify-jobs/scripts/engine-verify-tox.sh diff --git a/jjb/engine/engine-macros.yaml b/jjb/engine/engine-verify-jobs/scripts/generate-ssh-keypair.sh old mode 100644 new mode 100755 similarity index 64% rename from jjb/engine/engine-macros.yaml rename to jjb/engine/engine-verify-jobs/scripts/generate-ssh-keypair.sh index b480a6ac4..04633fd24 --- a/jjb/engine/engine-macros.yaml +++ b/jjb/engine/engine-verify-jobs/scripts/generate-ssh-keypair.sh @@ -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. @@ -17,12 +18,10 @@ # 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 index 000000000..c175f5e32 --- /dev/null +++ b/jjb/engine/engine-verify-jobs/scripts/package.sh @@ -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 index 000000000..a1c7f0e03 --- /dev/null +++ b/jjb/engine/engine-verify-jobs/scripts/test.sh @@ -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 index 000000000..37d9d80c5 --- /dev/null +++ b/jjb/engine/engine-verify-jobs/scripts/upload-artifact.sh @@ -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