From 21eb20e892d26936ae6ab03b68104da622f9aba1 Mon Sep 17 00:00:00 2001 From: Vladimir Khlyunev Date: Mon, 6 May 2019 16:24:35 +0400 Subject: [PATCH] Add location self-awareness to nodes Knowledge about "where this node is" required for mirror selection Change-Id: I677f87dc52342deab1545f79f07e7f51bb612e4f --- maintenance-ci/common/data/jenkins-slave.yml | 6 ++++++ maintenance-ci/common/data/mos-dev-slave.yml | 6 ++++++ maintenance-ci/common/data/mos-slave.yml | 6 ++++++ maintenance-ci/common/scripts/deploy_heat_stack.sh | 2 +- maintenance-ci/mos/scripts/guess-mirror.sh | 3 ++- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/maintenance-ci/common/data/jenkins-slave.yml b/maintenance-ci/common/data/jenkins-slave.yml index 61c80cb..c549726 100644 --- a/maintenance-ci/common/data/jenkins-slave.yml +++ b/maintenance-ci/common/data/jenkins-slave.yml @@ -30,6 +30,10 @@ parameters: 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: @@ -116,6 +120,7 @@ resources: 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 systemctl enable jenkins-swarm-agent #service jenkins-swarm-agent start apt update @@ -130,6 +135,7 @@ resources: 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: diff --git a/maintenance-ci/common/data/mos-dev-slave.yml b/maintenance-ci/common/data/mos-dev-slave.yml index ce0fb7d..36fdb73 100644 --- a/maintenance-ci/common/data/mos-dev-slave.yml +++ b/maintenance-ci/common/data/mos-dev-slave.yml @@ -30,6 +30,10 @@ parameters: 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: @@ -116,6 +120,7 @@ resources: 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 @@ -129,6 +134,7 @@ resources: 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: diff --git a/maintenance-ci/common/data/mos-slave.yml b/maintenance-ci/common/data/mos-slave.yml index 91e6621..852a53e 100644 --- a/maintenance-ci/common/data/mos-slave.yml +++ b/maintenance-ci/common/data/mos-slave.yml @@ -30,6 +30,10 @@ parameters: 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: @@ -116,6 +120,7 @@ resources: 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 @@ -130,6 +135,7 @@ resources: 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: diff --git a/maintenance-ci/common/scripts/deploy_heat_stack.sh b/maintenance-ci/common/scripts/deploy_heat_stack.sh index 950ce95..ec3e126 100755 --- a/maintenance-ci/common/scripts/deploy_heat_stack.sh +++ b/maintenance-ci/common/scripts/deploy_heat_stack.sh @@ -11,7 +11,7 @@ if [[ ! -d "${OPENSTACK_CLIENTS_VENV}" ]] ; then deactivate fi -parameter_string="" +parameter_string="location=${OPENSTACK_ENVIRONMENT}" if [[ ! -z "${FLAVOR_NAME}" ]] ; then parameter_string="flavor=${FLAVOR_NAME};$parameter_string" fi diff --git a/maintenance-ci/mos/scripts/guess-mirror.sh b/maintenance-ci/mos/scripts/guess-mirror.sh index 609a280..f6d2381 100644 --- a/maintenance-ci/mos/scripts/guess-mirror.sh +++ b/maintenance-ci/mos/scripts/guess-mirror.sh @@ -16,7 +16,8 @@ fi if [[ ! -z "${MIRROR_HOST}" ]] ; then MIRROR_HOST="${MIRROR_HOST}" else - MIRROR_HOST="${OPENSTACK_ENVIRONMENT,,}.mirror.fuel-infra.org" + location="$(cat /etc/jenkins-agent/location)" + MIRROR_HOST="${location,,}.mirror.fuel-infra.org" fi ###################### Get MIRROR_UBUNTU ############### -- 2.45.2