--- /dev/null
+
+heat_template_version: 2017-09-01
+
+parameters:
+ key_name:
+ type: string
+ description: Name of keypair to assign to servers
+ default: maintenance-ci-public-key
+ constraints:
+ - custom_constraint: nova.keypair
+ description: Must name a public key (pair) known to Nova
+ image:
+ type: string
+ description: Name of image to use for servers
+ default: maintenance-ci-mos-image
+ constraints:
+ - custom_constraint: glance.image
+ description: Must identify an image known to Glance
+ flavor:
+ type: string
+ description: Flavor to use for servers
+ constraints:
+ - custom_constraint: nova.flavor
+ description: Must be a flavor known to Nova
+ public_net:
+ type: string
+ default: public
+ description: Id of the public network for the compute server
+ jenkins_labels:
+ type: string
+ default: ''
+ description: List of labels for jenkins swarm agent separated by whitespace
+ location:
+ type: string
+ default: 'EU'
+ description: Backend cluster location (available "EU" and "US")
+
+resources:
+ wait_condition:
+ type: OS::Heat::WaitCondition
+ properties:
+ handle: {get_resource: wait_handle}
+ count: 1
+ timeout: 300
+
+ wait_handle:
+ type: OS::Heat::WaitConditionHandle
+
+ private_net:
+ type: OS::Neutron::Net
+
+ private_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: private_net }
+ cidr: 10.10.0.0/24
+ dns_nameservers:
+ - 172.18.176.6
+ - 172.18.208.44
+
+ router:
+ type: OS::Neutron::Router
+ properties:
+ external_gateway_info:
+ network: { get_param: public_net }
+
+ router_interface:
+ type: OS::Neutron::RouterInterface
+ properties:
+ router_id: { get_resource: router }
+ subnet_id: { get_resource: private_subnet }
+
+ security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ rules: [
+ {direction: ingress,
+ remote_ip_prefix: 0.0.0.0/0,
+ protocol: tcp,
+ port_range_min: 1,
+ port_range_max: 65535},
+ {direction: ingress,
+ remote_ip_prefix: 0.0.0.0/0,
+ protocol: udp,
+ port_range_min: 1,
+ port_range_max: 65535},
+ {remote_ip_prefix: 0.0.0.0/0,
+ protocol: icmp,
+ direction: ingress}]
+
+ public_port:
+ type: OS::Neutron::Port
+ properties:
+ network_id: { get_resource: private_net }
+ fixed_ips:
+ - subnet_id: { get_resource: private_subnet }
+ security_groups:
+ - { get_resource: security_group }
+
+ floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: public_net }
+ port_id: { get_resource: public_port }
+
+ node:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: image }
+ availability_zone: nova
+ flavor: { get_param: flavor }
+ key_name: { get_param: key_name }
+ networks:
+ - port: { get_resource: public_port }
+ scheduler_hints:
+ query: '["in","$hypervisor_hostname",
+ "cmp015.eu.intcloud.mirantis.net",
+ "cmp016.eu.intcloud.mirantis.net",
+ "cmp017.eu.intcloud.mirantis.net",
+ "cmp018.eu.intcloud.mirantis.net",
+ "cmp019.eu.intcloud.mirantis.net",
+ "cmp020.eu.intcloud.mirantis.net",
+ "cmp021.eu.intcloud.mirantis.net",
+ "cmp022.eu.intcloud.mirantis.net",
+ "cmp023.eu.intcloud.mirantis.net",
+ "cmp024.eu.intcloud.mirantis.net",
+ "cmp025.eu.intcloud.mirantis.net",
+ "cmp026.eu.intcloud.mirantis.net",
+ "cmp027.eu.intcloud.mirantis.net",
+ "cmp028.eu.intcloud.mirantis.net",
+ "cmp029.eu.intcloud.mirantis.net",
+ "cmp030.eu.intcloud.mirantis.net"]'
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/bash
+ mkdir -p /etc/jenkins-agent/
+ echo "LABELS" > /etc/jenkins-agent/labels
+ echo "127.0.0.1 $(hostname)" >> /etc/hosts
+ echo "FLOATING" > /etc/jenkins-agent/description
+ echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location
+
+ apt update
+ sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1\"console=tty1 console=ttyS0 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg
+ apt install -y linux-generic-hwe-16.04 linux-tools-generic-hwe-16.04 linux-cloud-tools-generic-hwe-16.04 linux-tools-common
+ update-grub
+
+ systemctl enable jenkins-swarm-agent
+ wc_notify --data-binary '{"status": "SUCCESS"}'
+ reboot
+ params:
+ LABELS: {get_param: jenkins_labels}
+ wc_notify: { get_attr: [wait_handle, curl_cli] }
+ FLOATING: { get_attr: [ floating_ip, floating_ip_address ] }
+ OPENSTACK_ENVIRONMENT: {get_param: location}
+
+
+outputs:
+ floating_ip:
+ description: Floating IP
+ value: { get_attr: [ floating_ip, floating_ip_address ] }
key_name: { get_param: key_name }
networks:
- port: { get_resource: public_port }
+ scheduler_hints:
+ query: '["in","$hypervisor_hostname",
+ "cmp015.eu.intcloud.mirantis.net",
+ "cmp016.eu.intcloud.mirantis.net",
+ "cmp017.eu.intcloud.mirantis.net",
+ "cmp018.eu.intcloud.mirantis.net",
+ "cmp019.eu.intcloud.mirantis.net",
+ "cmp020.eu.intcloud.mirantis.net",
+ "cmp021.eu.intcloud.mirantis.net",
+ "cmp022.eu.intcloud.mirantis.net",
+ "cmp023.eu.intcloud.mirantis.net",
+ "cmp024.eu.intcloud.mirantis.net",
+ "cmp025.eu.intcloud.mirantis.net",
+ "cmp026.eu.intcloud.mirantis.net",
+ "cmp027.eu.intcloud.mirantis.net",
+ "cmp028.eu.intcloud.mirantis.net",
+ "cmp029.eu.intcloud.mirantis.net",
+ "cmp030.eu.intcloud.mirantis.net"]'
user_data:
str_replace:
template: |
--- /dev/null
+
+heat_template_version: 2017-09-01
+
+parameters:
+ key_name:
+ type: string
+ description: Name of keypair to assign to servers
+ default: maintenance-ci-public-key
+ constraints:
+ - custom_constraint: nova.keypair
+ description: Must name a public key (pair) known to Nova
+ image:
+ type: string
+ description: Name of image to use for servers
+ default: maintenance-ci-mos-image
+ constraints:
+ - custom_constraint: glance.image
+ description: Must identify an image known to Glance
+ flavor:
+ type: string
+ description: Flavor to use for servers
+ constraints:
+ - custom_constraint: nova.flavor
+ description: Must be a flavor known to Nova
+ public_net:
+ type: string
+ default: public
+ description: Id of the public network for the compute server
+ jenkins_labels:
+ type: string
+ default: ''
+ description: List of labels for jenkins swarm agent separated by whitespace
+ location:
+ type: string
+ default: 'EU'
+ description: Backend cluster location (available "EU" and "US")
+
+resources:
+ wait_condition:
+ type: OS::Heat::WaitCondition
+ properties:
+ handle: {get_resource: wait_handle}
+ count: 1
+ timeout: 300
+
+ wait_handle:
+ type: OS::Heat::WaitConditionHandle
+
+ private_net:
+ type: OS::Neutron::Net
+
+ private_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: private_net }
+ cidr: 10.10.0.0/24
+ dns_nameservers:
+ - 172.18.176.6
+ - 172.18.208.44
+
+ router:
+ type: OS::Neutron::Router
+ properties:
+ external_gateway_info:
+ network: { get_param: public_net }
+
+ router_interface:
+ type: OS::Neutron::RouterInterface
+ properties:
+ router_id: { get_resource: router }
+ subnet_id: { get_resource: private_subnet }
+
+ security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ rules: [
+ {direction: ingress,
+ remote_ip_prefix: 0.0.0.0/0,
+ protocol: tcp,
+ port_range_min: 1,
+ port_range_max: 65535},
+ {direction: ingress,
+ remote_ip_prefix: 0.0.0.0/0,
+ protocol: udp,
+ port_range_min: 1,
+ port_range_max: 65535},
+ {remote_ip_prefix: 0.0.0.0/0,
+ protocol: icmp,
+ direction: ingress}]
+
+ public_port:
+ type: OS::Neutron::Port
+ properties:
+ network_id: { get_resource: private_net }
+ fixed_ips:
+ - subnet_id: { get_resource: private_subnet }
+ security_groups:
+ - { get_resource: security_group }
+
+ floating_ip:
+ type: OS::Neutron::FloatingIP
+ properties:
+ floating_network_id: { get_param: public_net }
+ port_id: { get_resource: public_port }
+
+ node:
+ type: OS::Nova::Server
+ properties:
+ image: { get_param: image }
+ availability_zone: nova
+ flavor: { get_param: flavor }
+ key_name: { get_param: key_name }
+ networks:
+ - port: { get_resource: public_port }
+ scheduler_hints:
+ query: '["in","$hypervisor_hostname",
+ "cmp015.eu.intcloud.mirantis.net",
+ "cmp016.eu.intcloud.mirantis.net",
+ "cmp017.eu.intcloud.mirantis.net",
+ "cmp018.eu.intcloud.mirantis.net",
+ "cmp019.eu.intcloud.mirantis.net",
+ "cmp020.eu.intcloud.mirantis.net",
+ "cmp021.eu.intcloud.mirantis.net",
+ "cmp022.eu.intcloud.mirantis.net",
+ "cmp023.eu.intcloud.mirantis.net",
+ "cmp024.eu.intcloud.mirantis.net",
+ "cmp025.eu.intcloud.mirantis.net",
+ "cmp026.eu.intcloud.mirantis.net",
+ "cmp027.eu.intcloud.mirantis.net",
+ "cmp028.eu.intcloud.mirantis.net",
+ "cmp029.eu.intcloud.mirantis.net",
+ "cmp030.eu.intcloud.mirantis.net"]'
+ user_data:
+ str_replace:
+ template: |
+ #!/bin/bash
+ mkdir -p /etc/jenkins-agent/
+ echo "FLAVOR LABELS" > /etc/jenkins-agent/labels
+ echo "127.0.0.1 $(hostname)" >> /etc/hosts
+ echo "FLOATING" > /etc/jenkins-agent/description
+ echo "OPENSTACK_ENVIRONMENT" > /etc/jenkins-agent/location
+
+ apt update
+ sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1\"console=tty1 console=ttyS0 noibrs noibpb nopti nospectre_v2 nospectre_v1 l1tf=off nospec_store_bypass_disable no_stf_barrier\"/g' /etc/default/grub.d/50-cloudimg-settings.cfg
+ apt install -y linux-generic-hwe-16.04 linux-tools-generic-hwe-16.04 linux-cloud-tools-generic-hwe-16.04 linux-tools-common
+ update-grub
+
+ systemctl enable jenkins-swarm-agent
+ wc_notify --data-binary '{"status": "SUCCESS"}'
+ reboot
+ params:
+ FLAVOR: {get_param: flavor}
+ LABELS: {get_param: jenkins_labels}
+ wc_notify: { get_attr: [wait_handle, curl_cli] }
+ FLOATING: { get_attr: [ floating_ip, floating_ip_address ] }
+ OPENSTACK_ENVIRONMENT: {get_param: location}
+
+
+outputs:
+ floating_ip:
+ description: Floating IP
+ value: { get_attr: [ floating_ip, floating_ip_address ] }
step: 1
predefined-parameters: |
OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT}
- HEAT_STACK_YAML=${CUSTOM_HEAT_STACK_YAML}
+ CUSTOM_HEAT_STACK_YAML=${CUSTOM_HEAT_STACK_YAML}
STACK_PREFIX=${STACK_PREFIX}
FLAVOR_NAME=${CUSTOM_FLAVOR_NAME}
JENKINS_LABELS=${CUSTOM_FLAVOR_JENKINS_LABELS}
step: 1
predefined-parameters: |
OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT}
- HEAT_STACK_YAML=${HEAT_STACK_YAML}
+ HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME}
STACK_PREFIX=${STACK_PREFIX}
FLAVOR_NAME=mos.tempest
IMAGE_NAME=${IMAGE_NAME}
step: 1
predefined-parameters: |
OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT}
- HEAT_STACK_YAML=${HEAT_STACK_YAML}
+ HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME}
STACK_PREFIX=${STACK_PREFIX}
FLAVOR_NAME=mos.fuel.huge
IMAGE_NAME=${IMAGE_NAME}
step: 1
predefined-parameters: |
OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT}
- HEAT_STACK_YAML=${HEAT_STACK_YAML}
+ HEAT_STACK_TEMPLATE_NAME=${HEAT_STACK_TEMPLATE_NAME}
STACK_PREFIX=${STACK_PREFIX}
FLAVOR_NAME=mos.fuel.base
IMAGE_NAME=${IMAGE_NAME}
parameters:
- openstack-cloud-selector
- choice:
- name: HEAT_STACK_YAML
+ name: HEAT_STACK_TEMPLATE_NAME
choices:
- - "maintenance-ci/common/data/jenkins-slave.yml"
- - "maintenance-ci/common/data/mos-slave.yml"
- - "maintenance-ci/common/data/mos-dev-slave.yml"
+ - "mos-dev-slave"
+ - "jenkins-slave"
+ - "mos-slave"
+ - string:
+ name: CUSTOM_HEAT_STACK_YAML
+ description: "Overwrites HEAT_STACK_TEMPLATE_NAME with relative path to template file. Leave empty by default"
+ default: ""
- string:
name: STACK_PREFIX
description: "Stack prefix"
- project: "deploy-heat-stack"
predefined-parameters: |
OPENSTACK_ENVIRONMENT=${OPENSTACK_ENVIRONMENT}
- HEAT_STACK_YAML=maintenance-ci/common/data/jenkins-slave.yml
+ HEAT_STACK_TEMPLATE_NAME=jenkins-slave
STACK_PREFIX=image-builder
FLAVOR_NAME=dev.cmn
JENKINS_LABELS=image-builder
parameters:
- openstack-cloud-selector
- string:
- name: HEAT_STACK_YAML
- description: "Stack yaml file"
- default: "maintenance-ci/common/data/mos-slave.yml"
+ name: HEAT_STACK_TEMPLATE_NAME
+ description: "Stack yaml file name"
+ default: "mos-slave"
- string:
name: STACK_PREFIX
description: "Stack prefix"
default: ""
- string:
name: CUSTOM_FLAVOR_NODE_COUNT
- default: "0"
\ No newline at end of file
+ default: "0"
+ - string:
+ name: GERRIT_REVIEW
+ default: ""
\ No newline at end of file
set -ex
+if [ ! -z ${GERRIT_REVIEW} ] ; then
+ refspec=$(curl "https://review.fuel-infra.org/changes/?q=${GERRIT_REVIEW}&o=CURRENT_REVISION" | grep '"ref":' | awk -F ": " '{print $2}' | tr -d '"')
+ git fetch https://review.fuel-infra.org/tools/sustaining "${refspec}" && git cherry-pick -n FETCH_HEAD
+fi
+
+
OPENSTACK_CLIENTS_VENV="${OPENSTACK_CLIENTS_VENV:-/home/jenkins/venv-openstack-clients}"
if [[ ! -d "${OPENSTACK_CLIENTS_VENV}" ]] ; then
STACK_NAME="${STACK_PREFIX:-swarm_slave}-${OPENSTACK_ENVIRONMENT,,}-$(head -c 100 /dev/urandom | "${md5_cmd}" | head -c 4)"
+if [[ ! -z "${CUSTOM_HEAT_STACK_YAML}" ]] ; then
+ TEMPLATE_FILE="${CUSTOM_HEAT_STACK_YAML}"
+elif [[ -f "${HEAT_STACK_YAML}" ]] ; then
+ TEMPLATE_FILE="${HEAT_STACK_YAML}"
+elif [[ ! -z "{HEAT_STACK_TEMPLATE_NAME}" ]] ; then
+ TEMPLATE_FILE="${WORKSPACE}/maintenance-ci/common/data/${HEAT_STACK_TEMPLATE_NAME}-${OPENSTACK_ENVIRONMENT,,}.yml"
+fi
+
+if [[ ! -f "${TEMPLATE_FILE}" ]] ; then
+ echo "Can not detect TEMPLATE_FILE file, nothing at ${TEMPLATE_FILE}, aborting"
+ exit 1
+fi
+
set +x
source "${OPENSTACK_CLIENTS_VENV}"/bin/activate
set -x
echo "Using ${OS_AUTH_URL?} endpoint"
- openstack stack create --wait -t ${HEAT_STACK_YAML} --parameter "${parameter_string}" ${STACK_NAME}
+ openstack stack create --wait -t ${TEMPLATE_FILE} --parameter "${parameter_string}" ${STACK_NAME}
openstack stack output show "${STACK_NAME}" --all
cat >stack_data.sh <<EOF
STACK_NAME=${STACK_NAME}
param_order_from_yaml=true
EOF
-jenkins-jobs --conf "${CONFIG_PATH}/jenkins_jobs.ini" update -x common/data "common:mos:mcp:views"
+jenkins-jobs --conf "${CONFIG_PATH}/jenkins_jobs.ini" update --workers 0 -x common/data "common:mos:mcp:views"
popd
description: "fuel-qa commit"
default: stable/mitaka
- string:
- name: GERRIT_REVIEW
+ name: FUEL_QA_GERRIT_REVIEW
description: "gerrit review num"
default: ""
echo "======================================================"
set -x
-if [[ ! -z ${GERRIT_REVIEW} ]] ; then
-refspec=$(curl "https://review.fuel-infra.org/changes/?q=${GERRIT_REVIEW}&o=CURRENT_REVISION" | grep '"ref":' | awk -F ": " '{print $2}' | tr -d '"')
+if [[ ! -z ${FUEL_QA_GERRIT_REVIEW} ]] ; then
+refspec=$(curl "https://review.fuel-infra.org/changes/?q=${FUEL_QA_GERRIT_REVIEW}&o=CURRENT_REVISION" | grep '"ref":' | awk -F ": " '{print $2}' | tr -d '"')
git fetch https://review.fuel-infra.org/openstack/fuel-qa "${refspec}" && git cherry-pick -n FETCH_HEAD
fi