Skip to content
This repository has been archived by the owner on Mar 30, 2023. It is now read-only.

Commit

Permalink
Add support for Elastic Stack 6.5.0 (#248)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
russcam authored Nov 15, 2018
1 parent bf7e607 commit f4e0aac
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 24 deletions.
4 changes: 3 additions & 1 deletion build/allowedValues.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
18 changes: 10 additions & 8 deletions build/tasks/arm-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
});
})
Expand Down Expand Up @@ -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();
});
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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}`);

Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 9 additions & 1 deletion src/createUiDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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"
}
]
}
Expand Down
6 changes: 4 additions & 2 deletions src/mainTemplate.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"esVersion": {
"type": "string",
"defaultValue": "6.4.2",
"defaultValue": "6.5.0",
"allowedValues": [
"5.5.3",
"5.6.12",
Expand All @@ -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"
Expand Down
29 changes: 17 additions & 12 deletions src/scripts/kibana-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f4e0aac

Please sign in to comment.