/**
 * Test salt formulas pipeline
 *  DEFAULT_GIT_REF
 *  DEFAULT_GIT_URL
 *  CREDENTIALS_ID
 */
def common = new com.mirantis.mk.Common()
def ruby = new com.mirantis.mk.Ruby()
def gerrit = new com.mirantis.mk.Gerrit()

def defaultGitRef, defaultGitUrl
try {
  defaultGitRef = DEFAULT_GIT_REF
  defaultGitUrl = DEFAULT_GIT_URL
} catch (MissingPropertyException e) {
  defaultGitRef = null
  defaultGitUrl = null
}

def openstack_credentials_id = ''
if (env.OPENSTACK_API_CREDENTIALS) {
  openstack_credentials_id = OPENSTACK_API_CREDENTIALS
}

env.GERRIT_BRANCH = 'master'
if (common.validInputParam('GERRIT_PARENT_BRANCH')) {
  env.GERRIT_BRANCH = GERRIT_PARENT_BRANCH
}

def nodeLabel = 'docker'

def checkouted = false
def openstackTest = false
def travisLess = false      /** TODO: Remove once formulas are witched to new config */
def cleanEnv = ''           /** TODO: Remove once formulas are witched to new config */
def testSuite = ''
envOverrides = []
kitchenFileName = ''

throttle(['test-formula']) {
  timeout(time: 1, unit: 'HOURS') {
    node(nodeLabel) {
      try {
        stage("checkout") {
          if (defaultGitRef && defaultGitUrl) {
            checkouted = gerrit.gerritPatchsetCheckout(defaultGitUrl, defaultGitRef, "HEAD", CREDENTIALS_ID)
          } else {
            throw new Exception("Cannot checkout gerrit patchset, DEFAULT_GIT_REF is null")
          }
        }
        stage("cleanup") {
          if (checkouted) {
            sh("make clean")
          }
        }
        stage("kitchen") {
          if (fileExists(".travis.yml")) {/** TODO: Remove this legacy block once formulas are witched to new config */
            if (checkouted) {
              if (fileExists(".kitchen.yml") || fileExists(".kitchen.openstack.yml")) {
                if (fileExists(".kitchen.openstack.yml")) {
                  common.infoMsg("Openstack Kitchen test configuration found, running Openstack kitchen tests.")
                  if (fileExists(".kitchen.yml")) {
                    common.infoMsg("Ignoring the docker Kitchen test configuration file.")
                  }
                  openstackTest = true
                } else {
                  common.infoMsg("Docker Kitchen test configuration found, running Docker kitchen tests.")
                }
                ruby.ensureRubyEnv('2.6.6', "${env.NODE_NAME}")
                if (fileExists(".travis.yml")) {
                  common.infoMsg(".travis.yml found, running custom kitchen init")
                  def kitchenConfigYML = readYaml(file: ".travis.yml")
                  def kitchenInit = kitchenConfigYML["install"]
                  def kitchenInstalled = false
                  if (kitchenInit && !kitchenInit.isEmpty()) {
                    for (int i = 0; i < kitchenInit.size(); i++) {
                      if (kitchenInit[i].trim().startsWith("if [ ! -e Gemfile ]")) { //found Gemfile config
                        common.infoMsg("Custom Gemfile configuration found, using them")
                        if (openstackTest) {
                          withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: openstack_credentials_id,
                          usernameVariable: 'OS_USERNAME', passwordVariable: 'OS_PASSWORD'], ]) {
                            env.OS_USERNAME = OS_USERNAME
                            env.OS_PASSWORD = OS_PASSWORD
                            env.OS_AUTH_URL = OS_AUTH_URL
                            env.OS_PROJECT_NAME = OS_PROJECT_NAME
                            env.OS_DOMAIN_NAME = OS_DOMAIN_NAME
                            env.OS_AZ = OS_AZ
                          }
                        }
                        ruby.installKitchen(kitchenInit[i].trim())
                        kitchenInstalled = true
                      }
                    }
                  }
                  if (!kitchenInstalled) {
                    ruby.installKitchen()
                  }
                } else {
                  common.infoMsg(".travis.yml not found, running default kitchen init")
                  ruby.installKitchen()
                }
                common.infoMsg("Running part of kitchen test")
                if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
                  cleanEnv = KITCHEN_ENV.replaceAll("\\s?SUITE=[^\\s]*", "")
                  if (openstackTest) { cleanEnv = "KITCHEN_YAML=.kitchen.openstack.yml " + cleanEnv }
                  sh("grep apt.mirantis.com -Ril | xargs -I{} bash -c \"echo {}; sed -i 's/apt.mirantis.com/apt.mcp.mirantis.net/g' {}\"")
                  sh("grep apt-mk.mirantis.com -Ril | xargs -I{} bash -c \"echo {}; sed -i 's/apt-mk.mirantis.com/apt.mcp.mirantis.net/g' {}\"")
                  def suite = ruby.getSuiteName(KITCHEN_ENV)
                  if (suite && suite != "") {
                    common.infoMsg("Running kitchen test with environment:" + KITCHEN_ENV.trim())
                    ruby.runKitchenTests(cleanEnv, suite)
                  } else {
                    common.warningMsg("No SUITE was found. Running with all suites.")
                    ruby.runKitchenTests(cleanEnv, "")
                  }
                } else {
                  throw new Exception("KITCHEN_ENV parameter is empty or invalid. This may indicate wrong env settings of initial test job or .travis.yml file.")
                }
              } else {
                throw new Exception(".kitchen.yml file not found, no kitchen tests triggered.")
              }
            }/** TODO: End of block for removal */
          } else {
            if (checkouted) {
              travisLess = true
              if (fileExists(".kitchen.openstack.yml")) {
                common.infoMsg("Openstack Kitchen test configuration found, running Openstack kitchen tests.")
                kitchenFileName = ".kitchen.openstack.yml"
                envOverrides.add("KITCHEN_YAML=${kitchenFileName}")
                withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: openstack_credentials_id,
                usernameVariable: 'OS_USERNAME', passwordVariable: 'OS_PASSWORD'], ]) {
                  env.OS_USERNAME = OS_USERNAME
                  env.OS_PASSWORD = OS_PASSWORD
                  env.OS_AUTH_URL = OS_AUTH_URL
                  env.OS_PROJECT_NAME = OS_PROJECT_NAME
                  env.OS_DOMAIN_NAME = OS_DOMAIN_NAME
                  env.OS_AZ = OS_AZ
                }
              } else if (fileExists(".kitchen.yml")) {
                common.infoMsg("Docker Kitchen test configuration found, running Docker kitchen tests.")
                kitchenFileName = ".kitchen.yml"
              }
              if (kitchenFileName) {
                ruby.ensureRubyEnv('2.6.6', "${env.NODE_NAME}")
                if (!fileExists("Gemfile")) {
                  sh("curl -s 'https://gerrit.mcp.mirantis.com/projects/salt-formulas%2Fsalt-formulas-scripts/branches/master/files/Gemfile/content' | base64 -d > ./Gemfile")
                  ruby.installKitchen()
                } else {
                  common.infoMsg("Override Gemfile found in the kitchen directory, using it.")
                  ruby.installKitchen()
                }
                common.infoMsg("Running part of kitchen test")
                if (KITCHEN_ENV != null && !KITCHEN_ENV.isEmpty() && KITCHEN_ENV != "") {
                  testSuite = KITCHEN_ENV.replaceAll("_", "-").trim()
                  sh("grep apt.mirantis.com -Ril | xargs -I{} bash -c \"echo {}; sed -i 's/apt.mirantis.com/apt.mcp.mirantis.net/g' {}\"")
                  sh("grep apt-mk.mirantis.com -Ril | xargs -I{} bash -c \"echo {}; sed -i 's/apt-mk.mirantis.com/apt.mcp.mirantis.net/g' {}\"")
                  common.infoMsg("Running kitchen test with environment:" + testSuite)
                  ruby.runKitchenTests(envOverrides.join(' '), testSuite)
                } else {
                  throw new Exception("KITCHEN_ENV parameter is empty or invalid. This may indicate wrong env settings of initial test job or .travis.yml file.")
                }
              } else {
                throw new Exception(".kitchen.yml nor .kitchen.openstack.yml file not found, no kitchen tests triggered.")
              }
            }
          }
        }
      } catch (Throwable e) {
        // If there was an error or exception thrown, the build failed
        currentBuild.result = "FAILURE"
        sh(script: 'find .kitchen/logs/ -type f -iname "*.log" | xargs -I{} bash -c "echo {}; cat {}"')
        if (travisLess) {
          ruby.runKitchenCommand("destroy", testSuite)
        } else {
          ruby.runKitchenCommand("destroy", cleanEnv)  /** TODO: Remove once formulas are witched to new config */
        }
        throw e
      } finally {
        if (currentBuild.result == "FAILURE" && fileExists(".kitchen/logs/kitchen.log")) {
          common.errorMsg("----------------KITCHEN LOG:---------------")
          println readFile(".kitchen/logs/kitchen.log")
        }
      }
    }
  }
}
