Merge "Fix for failing pipeline due to disabled log hosts"
diff --git a/src/com/mirantis/mk/SaltModelTesting.groovy b/src/com/mirantis/mk/SaltModelTesting.groovy
index 3178ec6..239ba69 100644
--- a/src/com/mirantis/mk/SaltModelTesting.groovy
+++ b/src/com/mirantis/mk/SaltModelTesting.groovy
@@ -43,63 +43,73 @@
}
try {
img.inside("-u root:root --hostname=${masterName} --ulimit nofile=4096:8192 ${dockerMaxCpusOpt} --name=${dockerContainerName}") {
- withEnv(["FORMULAS_SOURCE=${formulasSource}", "EXTRA_FORMULAS=${extraFormulas}", "DISTRIB_REVISION=${formulasRevision}",
- "DEBUG=1", "MASTER_HOSTNAME=${masterName}", "CLUSTER_NAME=${clusterName}", "MINION_ID=${masterName}",
- "RECLASS_VERSION=${reclassVersion}", "RECLASS_IGNORE_CLASS_NOTFOUND=${ignoreClassNotfound}", "APT_REPOSITORY=${aptRepoUrl}",
- "APT_REPOSITORY_GPG=${aptRepoGPG}", "SALT_STOPSTART_WAIT=5"]) {
- // Currently, we don't have any other point to install
- // runtime dependencies for tests.
- sh('''#!/bin/bash -xe
- echo "APT::Get::AllowUnauthenticated 'true';" > /etc/apt/apt.conf.d/99setupAndTestNode
- echo "APT::Get::Install-Suggests 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
- echo "APT::Get::Install-Recommends 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
- echo 'deb [arch=amd64] http://mirror.mirantis.com/nightly/ubuntu xenial main restricted universe' > /etc/apt/sources.list
- echo 'deb [arch=amd64] http://mirror.mirantis.com/nightly/ubuntu xenial-updates main restricted universe' >> /etc/apt/sources.list
- echo "Installing extra-deb dependencies inside docker:"
- apt-get update
- apt-get install -y python-netaddr
- ''')
- sh(script: "git clone https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts", returnStdout: true)
- sh("""rsync -ah ${testDir}/* /srv/salt/reclass && echo '127.0.1.2 salt' >> /etc/hosts
- cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt-mk.mirantis.com/apt.mirantis.net:8085/g' {} \\;
- cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt.mirantis.com/apt.mirantis.net:8085/g' {} \\;""")
- // FIXME: should be changed to use reclass from mcp_extra_nigtly?
- sh("""for s in \$(python -c \"import site; print(' '.join(site.getsitepackages()))\"); do
- sudo -H pip install --install-option=\"--prefix=\" --upgrade --force-reinstall -I \
- -t \"\$s\" git+https://github.com/salt-formulas/reclass.git@${reclassVersion};
- done""")
- timeout(time: testTimeout, unit: 'SECONDS') {
- sh('''#!/bin/bash
- source /srv/salt/scripts/bootstrap.sh
- cd /srv/salt/scripts
- source_local_envs
- configure_salt_master
- configure_salt_minion
- install_salt_formula_pkg
- source /srv/salt/scripts/bootstrap.sh
- cd /srv/salt/scripts
- saltservice_restart''')
- sh('''#!/bin/bash
- source /srv/salt/scripts/bootstrap.sh
- cd /srv/salt/scripts
- source_local_envs
- saltmaster_init''')
-
- if (!legacyTestingMode.toBoolean()) {
+ withEnv(["FORMULAS_SOURCE=${formulasSource}", "EXTRA_FORMULAS=${extraFormulas}",
+ "DISTRIB_REVISION=${formulasRevision}",
+ "DEBUG=1", "MASTER_HOSTNAME=${masterName}",
+ "CLUSTER_NAME=${clusterName}", "MINION_ID=${masterName}",
+ "RECLASS_VERSION=${reclassVersion}", "RECLASS_IGNORE_CLASS_NOTFOUND=${ignoreClassNotfound}",
+ "APT_REPOSITORY=${aptRepoUrl}", "SALT_STOPSTART_WAIT=5",
+ "APT_REPOSITORY_GPG=${aptRepoGPG}"]) {
+ try {
+ // Currently, we don't have any other point to install
+ // runtime dependencies for tests.
+ sh("""#!/bin/bash -xe
+ echo "Installing extra-deb dependencies inside docker:"
+ echo "APT::Get::AllowUnauthenticated 'true';" > /etc/apt/apt.conf.d/99setupAndTestNode
+ echo "APT::Get::Install-Suggests 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
+ echo "APT::Get::Install-Recommends 'false';" >> /etc/apt/apt.conf.d/99setupAndTestNode
+ rm -vf /etc/apt/sources.list.d/* || true
+ echo 'deb [arch=amd64] http://mirror.mirantis.com/$DISTRIB_REVISION/ubuntu xenial main restricted universe' > /etc/apt/sources.list
+ echo 'deb [arch=amd64] http://mirror.mirantis.com/$DISTRIB_REVISION/ubuntu xenial-updates main restricted universe' >> /etc/apt/sources.list
+ apt-get update
+ apt-get install -y python-netaddr
+ """)
+ sh(script: "git clone https://github.com/salt-formulas/salt-formulas-scripts /srv/salt/scripts", returnStdout: true)
+ sh("""rsync -ah ${testDir}/* /srv/salt/reclass && echo '127.0.1.2 salt' >> /etc/hosts
+ cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt-mk.mirantis.com/apt.mirantis.net:8085/g' {} \\;
+ cd /srv/salt && find . -type f \\( -name '*.yml' -or -name '*.sh' \\) -exec sed -i 's/apt.mirantis.com/apt.mirantis.net:8085/g' {} \\;
+ """)
+ // FIXME: should be changed to use reclass from mcp_extra_nigtly?
+ sh("""for s in \$(python -c \"import site; print(' '.join(site.getsitepackages()))\"); do
+ sudo -H pip install --install-option=\"--prefix=\" --upgrade --force-reinstall -I \
+ -t \"\$s\" git+https://github.com/salt-formulas/reclass.git@${reclassVersion};
+ done""")
+ timeout(time: testTimeout, unit: 'SECONDS') {
sh('''#!/bin/bash
- source /srv/salt/scripts/bootstrap.sh
- cd /srv/salt/scripts
- verify_salt_minions
- ''')
+ source /srv/salt/scripts/bootstrap.sh
+ cd /srv/salt/scripts
+ source_local_envs
+ configure_salt_master
+ configure_salt_minion
+ install_salt_formula_pkg
+ source /srv/salt/scripts/bootstrap.sh
+ cd /srv/salt/scripts
+ saltservice_restart''')
+ sh('''#!/bin/bash
+ source /srv/salt/scripts/bootstrap.sh
+ cd /srv/salt/scripts
+ source_local_envs
+ saltmaster_init''')
+
+ if (!legacyTestingMode.toBoolean()) {
+ sh('''#!/bin/bash
+ source /srv/salt/scripts/bootstrap.sh
+ cd /srv/salt/scripts
+ verify_salt_minions
+ ''')
+ }
+ }
+ // If we didn't dropped for now - test has been passed.
+ TestMarkerResult = true
}
- }
- // If we didn't dropped for now - test has been passed.
- TestMarkerResult = true
+
+ finally {
// Collect rendered per-node data.Those info could be simply used
// for diff processing. Data was generated via reclass.cli --nodeinfo,
/// during verify_salt_minions.
sh(script: "cd /tmp; tar -czf ${env.WORKSPACE}/nodesinfo.tar.gz *reclass*", returnStatus: true)
archiveArtifacts artifacts: "nodesinfo.tar.gz"
+ }
}
}
}