From f4e0aacd80f8d5d3ca72933c68bbd762bfcceecb Mon Sep 17 00:00:00 2001 From: Russ Cam Date: Thu, 15 Nov 2018 12:49:06 +1000 Subject: [PATCH] Add support for Elastic Stack 6.5.0 (#248) This commit adds 6.5.0 and 6.4.3 versions to the template, with 6.5.0 the default version. * Don't write apt-update to /dev/null * Capture when apt-update in VM script extension logs * Colourize Kibana status in task output --- build/allowedValues.json | 4 +++- build/tasks/arm-validator.js | 18 ++++++++++-------- src/createUiDefinition.json | 10 +++++++++- src/mainTemplate.json | 6 ++++-- src/scripts/kibana-install.sh | 29 +++++++++++++++++------------ 5 files changed, 43 insertions(+), 24 deletions(-) diff --git a/build/allowedValues.json b/build/allowedValues.json index a13cb45a..b2f34048 100644 --- a/build/allowedValues.json +++ b/build/allowedValues.json @@ -7,7 +7,9 @@ "6.2.4", "6.3.2", "6.4.1", - "6.4.2" + "6.4.2", + "6.4.3", + "6.5.0" ], "numberOfDataNodes" : 50, "numberOfClientNodes" : 20, diff --git a/build/tasks/arm-validator.js b/build/tasks/arm-validator.js index c97bc235..e9b03f39 100644 --- a/build/tasks/arm-validator.js +++ b/build/tasks/arm-validator.js @@ -78,11 +78,13 @@ var bootstrapTest = (t, defaultVersion) => // Some parameters are longer than the max allowed characters for cmd on Windows. // Persist to file and pass the file path for parameters - var resourceGroup = "test-" + hostname + "-" + t.replace(".json", "") + dateFormat(new Date(), "-yyyymmdd-HHMMssl").replace("+","-") + var name = t.replace(".json", ""); + var resourceGroup = "test-" + hostname + "-" + name + dateFormat(new Date(), "-yyyymmdd-HHMMssl").replace("+","-") var testParametersFile = path.resolve(logDistTmp + "/" + resourceGroup + ".json"); fs.writeFileSync(testParametersFile, JSON.stringify(testParameters, null, 2)); return { + name: name, resourceGroup: resourceGroup, location: test.location, isValid: test.isValid, @@ -270,12 +272,12 @@ var validateTemplate = (test, cb) => { '--parameters', '@' + t.paramsFile, '--out', 'json' ]; - log(`validating ${test} in resource group: ${rg}`); + log(`validating ${t.name} in resource group: ${rg}`); az(validateGroup, (error, stdout, stderr) => { log(test, `Expected result: ${t.isValid} because ${t.why}`); log(test, `validateResult:${stdout || stderr}`); if (t.isValid && (error || stderr)) return bailOut(error || new Error(stderr), rg); - else if (!t.isValid && !(error || stderr)) return bailOut(new Error(`expected ${test} to result in an error because ${t.why}`), rg); + else if (!t.isValid && !(error || stderr)) return bailOut(new Error(`expected ${t.name} to result in an error because ${t.why}`), rg); cb(); }); }) @@ -314,7 +316,7 @@ var showOperationList = (test, cb) => { .map(f=>f.properties.statusMessage) .value(); errors.forEach(e => { - log(`${test} resulted in error: ${JSON.stringify(e, null, 2)}`); + log(`${t.name} resulted in error: ${JSON.stringify(e, null, 2)}`); }) cb(); }); @@ -363,7 +365,7 @@ var sanityCheckApplicationGateway = (test, cb) => { az(operationList, (error, stdout, stderr) => { log(test, `operationPublicIpShowResult: ${stdout || stderr}`); if (error || stderr) { - log(`getting public ip for ${appGateway} in ${test} resulted in error: ${JSON.stringify(e, null, 2)}`); + log(`getting public ip for ${appGateway} in ${t.name} resulted in error: ${JSON.stringify(e, null, 2)}`); cb(); } @@ -487,11 +489,11 @@ var sanityCheckKibana = (test, url, cb) => { : "unknown" : "unknown"; - log(`kibana is running in resource group: ${rg} with state: ${state}`); + log(`kibana is running in resource group: ${rg} with state: ${state[state.toLowerCase()]}`); log(test, `kibanaResponse: ${JSON.stringify((body && body.status) ? body.status : {}, null, 2)}`); + //no validation just yet, kibana is most likely red straight after deployment while it retries the cluster //There is no guarantee kibana is not provisioned before the cluster is up - if (state == "green") { log(`checking kibana monitoring endpoint for rg: ${rg}`); @@ -580,7 +582,7 @@ var deployTemplate = (test, cb) => { '--parameters', '@' + t.paramsFile, '--out', 'json' ]; - log(`deploying ${test} in resource group: ${rg}`); + log(`deploying ${t.name} in resource group: ${rg}`); az(deployGroup, (error, stdout, stderr) => { log(test, `deployResult: ${stdout || stderr}`); if (error || stderr) { diff --git a/src/createUiDefinition.json b/src/createUiDefinition.json index 9bf8e54f..198c5067 100644 --- a/src/createUiDefinition.json +++ b/src/createUiDefinition.json @@ -54,7 +54,7 @@ "name": "esVersion", "type": "Microsoft.Common.DropDown", "label": "Elasticsearch version", - "defaultValue": "v6.4.2", + "defaultValue": "v6.5.0", "toolTip": "Choose a version of Elasticsearch.", "constraints": { "allowedValues": [ @@ -89,6 +89,14 @@ { "label": "v6.4.2", "value": "6.4.2" + }, + { + "label": "v6.4.3", + "value": "6.4.3" + }, + { + "label": "v6.5.0", + "value": "6.5.0" } ] } diff --git a/src/mainTemplate.json b/src/mainTemplate.json index e33962a5..9cc6768f 100644 --- a/src/mainTemplate.json +++ b/src/mainTemplate.json @@ -21,7 +21,7 @@ }, "esVersion": { "type": "string", - "defaultValue": "6.4.2", + "defaultValue": "6.5.0", "allowedValues": [ "5.5.3", "5.6.12", @@ -30,7 +30,9 @@ "6.2.4", "6.3.2", "6.4.1", - "6.4.2" + "6.4.2", + "6.4.3", + "6.5.0" ], "metadata": { "description": "Elasticsearch version to install" diff --git a/src/scripts/kibana-install.sh b/src/scripts/kibana-install.sh index 966b2fbb..0338e718 100644 --- a/src/scripts/kibana-install.sh +++ b/src/scripts/kibana-install.sh @@ -194,14 +194,6 @@ install_kibana() ## Security ##---------------------------------- -install_pwgen() -{ - log "[install_pwgen] Installing pwgen tool if needed" - if [ $(dpkg-query -W -f='${Status}' pwgen 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - (apt-get -yq install pwgen || (sleep 15; apt-get -yq install pwgen)) - fi -} - configure_kibana_yaml() { local KIBANA_CONF=/etc/kibana/kibana.yml @@ -370,11 +362,24 @@ configure_kibana_yaml() fi } +install_apt_package() +{ + local PACKAGE=$1 + if [ $(dpkg-query -W -f='${Status}' $PACKAGE 2>/dev/null | grep -c "ok installed") -eq 0 ]; then + log "[install_$PACKAGE] installing $PACKAGE" + (apt-get -yq install $PACKAGE || (sleep 15; apt-get -yq install $PACKAGE)) + log "[install_$PACKAGE] installed $PACKAGE" + fi +} + +install_pwgen() +{ + install_apt_package pwgen +} + install_yamllint() { - log "[install_yamllint] installing yamllint" - (apt-get -yq install yamllint || (sleep 15; apt-get -yq install yamllint)) - log "[install_yamllint] installed yamllint" + install_apt_package yamllint } configure_systemd() @@ -409,7 +414,7 @@ if systemctl -q is-active kibana.service; then fi log "[apt-get] updating apt-get" -(apt-get -y update || (sleep 15; apt-get -y update)) > /dev/null +(apt-get -y update || (sleep 15; apt-get -y update)) log "[apt-get] updated apt-get" install_kibana