From 9417a9c99681260fcd71e2ed1f5f30ff1aee77af Mon Sep 17 00:00:00 2001 From: Vladimir Khlyunev Date: Mon, 18 Mar 2019 10:41:32 +0400 Subject: [PATCH] Add dev heat template and change default image Change-Id: Icfa51131f03b49fb124d0d6cfe598a537a79b5b4 --- maintenance-ci/common/data/jenkins-slave.yml | 2 +- maintenance-ci/common/data/mos-dev-slave.yml | 89 ++++++++++++++++++++ maintenance-ci/common/data/mos-slave.yml | 2 +- 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 maintenance-ci/common/data/mos-dev-slave.yml diff --git a/maintenance-ci/common/data/jenkins-slave.yml b/maintenance-ci/common/data/jenkins-slave.yml index 5896e46..4843112 100644 --- a/maintenance-ci/common/data/jenkins-slave.yml +++ b/maintenance-ci/common/data/jenkins-slave.yml @@ -9,7 +9,7 @@ parameters: image: type: string description: Name of image to use for servers - default: xenial-server-cloudimg-amd64-qcow + default: maintenance-ci-base-image flavor: type: string description: Flavor to use for servers diff --git a/maintenance-ci/common/data/mos-dev-slave.yml b/maintenance-ci/common/data/mos-dev-slave.yml new file mode 100644 index 0000000..e08c778 --- /dev/null +++ b/maintenance-ci/common/data/mos-dev-slave.yml @@ -0,0 +1,89 @@ + +heat_template_version: 2017-09-01 + +parameters: + key_name: + type: string + description: Name of keypair to assign to servers + default: maintenance-ci-public-key + image: + type: string + description: Name of image to use for servers + default: maintenance-ci-mos-image + flavor: + type: string + description: Flavor to use for servers + private_net: + type: string + description: > + ID or name of public network for which floating IP addresses will be allocated + default: maintenance-ci-network + private_subnet: + type: string + default: maintenance-ci-subnet + description: Id of the private sub network for the compute server + 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 + +resources: + + wait_condition: + type: OS::Heat::WaitCondition + properties: + handle: {get_resource: wait_handle} + count: 1 + timeout: 300 + + wait_handle: + type: OS::Heat::WaitConditionHandle + + public_port: + type: OS::Neutron::Port + properties: + network_id: { get_param: private_net } + fixed_ips: + - subnet_id: { get_param: private_subnet } + security_groups: + - dc56d304-e75e-437a-8ef5-656f9bfcd2a0 + + 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 } + 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 + service jenkins-swarm-agent restart + wc_notify --data-binary '{"status": "SUCCESS"}' + params: + LABELS: {get_param: jenkins_labels} + wc_notify: { get_attr: [wait_handle, curl_cli] } + FLOATING: { get_attr: [ floating_ip, floating_ip_address ] } + + +outputs: + floating_ip: + description: Floating IP + value: { get_attr: [ floating_ip, floating_ip_address ] } diff --git a/maintenance-ci/common/data/mos-slave.yml b/maintenance-ci/common/data/mos-slave.yml index 5896e46..4bc88f8 100644 --- a/maintenance-ci/common/data/mos-slave.yml +++ b/maintenance-ci/common/data/mos-slave.yml @@ -9,7 +9,7 @@ parameters: image: type: string description: Name of image to use for servers - default: xenial-server-cloudimg-amd64-qcow + default: maintenance-ci-mos-image flavor: type: string description: Flavor to use for servers -- 2.45.2