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'
--- /dev/null
+---
+# ============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
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'
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'
--- /dev/null
+#!/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!"
--- /dev/null
+#!/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"
--- /dev/null
+#!/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
----
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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!"
--- /dev/null
+#!/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