--- /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=========================================================
+
+# NOTE (fdegir): we do not need to do anything for the changes coming to infra/engine repo
+if [[ "$GERRIT_PROJECT" == "infra/engine" ]]; then
+ exit 0
+fi
+
+echo "Info : Cloning infra/engine repository"
+cd "$HOME" && /bin/rm -rf "$WORKSPACE"
+git clone -q "$ENGINE_REPO_URL" "$WORKSPACE"
+
+export SDF_ORIGINAL="$WORKSPACE/engine/inventory/group_vars/all/sdf.yaml"
+export SDF_PATCHSET="/tmp/sdf.yaml.$GERRIT_CHANGE_NUMBER"
+
+/bin/rm -rf "$SDF_PATCHSET"
+
+export TOOL_TYPE="${GERRIT_PROJECT//*\//}"
+export TOOL_MATCH="false"
+echo "Info : Tool type is $TOOL_TYPE"
+echo "Info : Updating SDF with change SHA and refspec"
+while IFS= read -r line; do
+ if [[ "$TOOL_MATCH" == "true" && "$line" =~ "version" ]]; then
+ echo "$line" | sed "s#version:.*#version: $GERRIT_PATCHSET_REVISION\n refspec: $GERRIT_REFSPEC#g" >> "$SDF_PATCHSET"
+ export TOOL_MATCH="false"
+ continue
+ fi
+ if [[ "$line" =~ "$TOOL_TYPE:" && "$TOOL_MATCH" == "false" ]]; then
+ export TOOL_MATCH="true"
+ fi
+ echo "$line" >> "$SDF_PATCHSET"
+done < "$SDF_ORIGINAL"
+# NOTE (fdegir): log the diff for possible troubleshooting
+echo
+echo "Info : Diff between original SDF and SDF generated for the change"
+echo "-------------------------------------------------------------------------"
+diff "$SDF_ORIGINAL" "$SDF_PATCHSET"
+echo "-------------------------------------------------------------------------"
+echo
+
+# NOTE (fdegir): move SDF generated for the change into the original SDF
+/bin/mv -f "$SDF_PATCHSET" "$SDF_ORIGINAL"
+
+# NOTE (fdegir): log the final SDF
+echo
+echo "Info : Generated SDF content"
+echo "-------------------------------------------------------------------------"
+cat "$SDF_ORIGINAL"
+echo "-------------------------------------------------------------------------"
+echo
- virtual:
provisioner-type: 'bifrost'
slave-type: 'vpod'
- gated-projects: 'infra\/engine|infra\/provisioner\/bifrost\/|infra\/installer\/kolla\/|infra\/installer\/kubespray\/'
+ gated-projects: 'infra/engine|infra/provisioner/bifrost|infra/installer/kolla|infra/installer/kubespray'
- cloud:
provisioner-type: 'heat'
slave-type: 'jumphost'
- gated-projects: 'infra\/engine|infra\/provisioner\/heat\/|infra\/installer\/kolla\/|infra\/installer\/kubespray\/'
+ gated-projects: 'infra/engine|infra/provisioner/heat|infra/installer/kubespray'
distro:
- ubuntu1804
name: SLAVE_LABEL
default: 'engine-{slave-type}-{environment-type}-{distro}'
description: 'Slave label to schedule this job on.'
+ - string:
+ name: ENGINE_REPO_URL
+ default: 'https://gerrit.nordix.org/infra/engine.git'
+ description: 'URL to Nordix Cloud Infra engine repository'
- string:
name: EXECUTION_MODE
default: '{execution-mode}'
scm:
- git-scm-gerrit:
ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
- branch: '{branch}'
+ branch: refs/heads/$GERRIT_BRANCH
refspec: $GERRIT_REFSPEC
wipe_workspace: true
clean_before: false
scm:
- git-scm-gerrit:
ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
- branch: '{branch}'
+ branch: refs/heads/$GERRIT_BRANCH
refspec: $GERRIT_REFSPEC
wipe_workspace: true
clean_before: false
echo "Info : Offline deployment and testing on cloud instances is not currently supported!"
exit 0
fi
+ - 'generate-sdf-for-change-macro'
- 'generate-ssh-keypair-macro'
- 'wait-pkg-mgr-macro'
- 'download-artifact-macro'
branch: '{stream}'
openrc-credentials-file: 'est-jenkins-openrcfile-city-karlskrona-onap'
execution-mode: 'packaging'
- gated-projects: 'infra\/engine'
+ gated-projects: 'infra/engine|infra/provisioner/bifrost|infra/provisioner/heat|infra/installer/kolla|infra/installer/kubespray'
successful: false
failed: false
unstable: false
name: VERBOSITY
default: 'true'
description: 'Verbosity setting for the engine - true or false - default is false'
+ - string:
+ name: ENGINE_REPO_URL
+ default: 'https://gerrit.nordix.org/infra/engine.git'
+ description: 'URL to Nordix Cloud Infra engine repository'
- string:
name: ARTIFACTS_TO_UPLOAD
default: "k8s-installer-ubuntu1804.bsx"
scm:
- git-scm-gerrit:
ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
- branch: '{branch}'
+ branch: refs/heads/$GERRIT_BRANCH
refspec: $GERRIT_REFSPEC
wipe_workspace: true
clean_before: false
builders:
+ - 'generate-sdf-for-change-macro'
- 'generate-ssh-keypair-macro'
- 'wait-pkg-mgr-macro'
- 'package-macro'
stream:
- 'master':
branch: '{stream}'
+ gated-projects: 'infra/engine|infra/hwconfig|infra/swconfig|infra/test|infra/provisioner/bifrost|infra/provisioner/heat|infra/installer/kolla|infra/installer/kubespray'
lint-type:
- ansible-lint:
repos-to-ignore: 'infra/hwconfig'
- docs:
disabled: false
- repos-to-ignore: 'infra/hwconfig|infra/swconfig|infra/test'
+ repos-to-ignore: 'infra/hwconfig|infra/swconfig|infra/test|infra/provisioner/bifrost|infra/provisioner/heat|infra/installer/kolla|infra/installer/kubespray'
- shellcheck:
disabled: false
repos-to-ignore: 'infra/hwconfig'
scm:
- git-scm-gerrit:
ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
- branch: '{branch}'
+ branch: refs/heads/$GERRIT_BRANCH
refspec: $GERRIT_REFSPEC
wipe_workspace: true
clean_before: false
comment-contains-value: 'reverify'
projects:
- project-compare-type: 'REG_EXP'
- project-pattern: 'infra\/engine|infra\/test|infra\/swconfig|infra\/hwconfig'
+ project-pattern: '{gated-projects}'
branches:
- branch-compare-type: 'ANT'
branch-pattern: '**/{branch}'
scm:
- git-scm-gerrit:
ssh-credentials-id: nordixinfra-nordix-gerrit-ssh
- branch: '{branch}'
+ branch: refs/heads/$GERRIT_BRANCH
refspec: $GERRIT_REFSPEC
wipe_workspace: true
clean_before: false