
/**
 * Rollout changes to the node(s) configuration
 *
 * Expected parameters:
 *   TST_SALT_MASTER_CREDENTIALS  Credentials to the Salt API (QA environment).
 *   TST_SALT_MASTER_URL          Full Salt API address [https://10.10.10.1:8000].
 *   PRD_SALT_MASTER_CREDENTIALS  Credentials to the Salt API (PRD environment).
 *   PRD_SALT_MASTER_URL          Full Salt API address [https://10.10.10.1:8000].
 * Model parameters:
 *   MODEL_REPO_CREDENTIALS       Credentials to the Model.
 *   MODEL_REPO_URL               Full model repo address.
 *   MODEL_REPO_SOURCE_BRANCH     Source branch to merge from.
 *   MODEL_REPO_TARGET_BRANCH     Target branch to merge fo.
 * Change settings:
 *   TARGET_SERVERS               Salt compound target to match nodes to be updated [*, G@osfamily:debian].
 *   TARGET_STATES                States to be applied, empty string means running highstate [linux, linux,openssh, salt.minion.grains].
 *   TARGET_SUBSET_TEST           Number of nodes to test config changes, empty string means all targetted nodes.
 *   TARGET_SUBSET_LIVE           Number of selected noded to live apply selected config changes.
 *   TARGET_BATCH_LIVE            Batch size for the complete live config changes on all nodes, empty string means apply to all targetted nodes.
 * Test settings:
 *   TEST_SERVICE                 Comma separated list of services to test
 *   TEST_K8S_API_SERVER          Kubernetes API address
 *   TEST_K8S_CONFORMANCE_IMAGE   Path to docker image with conformance e2e tests
 *   TEST_DOCKER_INSTALL          Install docker on the target if true
 *   TEST_TEMPEST_IMAGE           Tempest image link
 *   TEST_TEMPEST_PATTERN         If not false, run tests matched to pattern only
 *   TEST_TEMPEST_TARGET          Salt target for tempest node
 *
**/

def common = new com.mirantis.mk.Common()
def salt = new com.mirantis.mk.Salt()
timeout(time: 12, unit: 'HOURS') {
  node() {
      try {

          stage('Run config change on test env') {
              build job: "deploy-update-service-config", parameters: [
                [$class: 'StringParameterValue', name: 'SALT_MASTER_URL', value: TST_SALT_MASTER_URL],
                [$class: 'StringParameterValue', name: 'SALT_MASTER_CREDENTIALS', value: TST_SALT_MASTER_CREDENTIALS],
                [$class: 'StringParameterValue', name: 'TARGET_BATCH_LIVE', value: TARGET_BATCH_LIVE],
                [$class: 'StringParameterValue', name: 'TARGET_SERVERS', value: TARGET_SERVERS],
                [$class: 'StringParameterValue', name: 'TARGET_STATES', value: TARGET_STATES],
                [$class: 'StringParameterValue', name: 'TARGET_SUBSET_LIVE', value: TARGET_SUBSET_LIVE],
                [$class: 'StringParameterValue', name: 'TARGET_SUBSET_TEST', value: TARGET_SUBSET_TEST],
              ]
          }

          stage('Test config change on test env') {
              build job: "deploy-test-service", parameters: [
                [$class: 'StringParameterValue', name: 'SALT_MASTER_URL', value: TST_SALT_MASTER_URL],
                [$class: 'StringParameterValue', name: 'SALT_MASTER_CREDENTIALS', value: TST_SALT_MASTER_CREDENTIALS],
                [$class: 'StringParameterValue', name: 'TEST_SERVICE', value: TEST_SERVICE],
                [$class: 'StringParameterValue', name: 'TEST_K8S_API_SERVER', value: TEST_K8S_API_SERVER],
                [$class: 'StringParameterValue', name: 'TEST_K8S_CONFORMANCE_IMAGE', value: TEST_K8S_CONFORMANCE_IMAGE],
              ]
          }

          stage('Promote config change in repo') {
              build job: "git-merge-branches", parameters: [
                [$class: 'StringParameterValue', name: 'REPO_URL', value: MODEL_REPO_URL],
                [$class: 'StringParameterValue', name: 'CREDENTIALS_ID', value: MODEL_REPO_CREDENTIALS],
                [$class: 'StringParameterValue', name: 'SOURCE_BRANCH', value: MODEL_REPO_SOURCE_BRANCH],
                [$class: 'StringParameterValue', name: 'TARGET_BRANCH', value: MODEL_REPO_TARGET_BRANCH],
              ]
          }

          stage('Run config change on production env') {
              build job: "deploy-update-service-config", parameters: [
                [$class: 'StringParameterValue', name: 'SALT_MASTER_URL', value: PRD_SALT_MASTER_URL],
                [$class: 'StringParameterValue', name: 'SALT_MASTER_CREDENTIALS', value: PRD_SALT_MASTER_CREDENTIALS],
                [$class: 'StringParameterValue', name: 'TARGET_BATCH_LIVE', value: TARGET_BATCH_LIVE],
                [$class: 'StringParameterValue', name: 'TARGET_SERVERS', value: TARGET_SERVERS],
                [$class: 'StringParameterValue', name: 'TARGET_STATES', value: TARGET_STATES],
                [$class: 'StringParameterValue', name: 'TARGET_SUBSET_LIVE', value: TARGET_SUBSET_LIVE],
                [$class: 'StringParameterValue', name: 'TARGET_SUBSET_TEST', value: TARGET_SUBSET_TEST],
              ]
          }

          stage('Test config change on prod env') {
              def result = build job: "deploy-test-service", parameters: [
                [$class: 'StringParameterValue', name: 'SALT_MASTER_URL', value: PRD_SALT_MASTER_URL],
                [$class: 'StringParameterValue', name: 'SALT_MASTER_CREDENTIALS', value: PRD_SALT_MASTER_CREDENTIALS],
                [$class: 'StringParameterValue', name: 'TEST_SERVICE', value: TEST_SERVICE],
                [$class: 'StringParameterValue', name: 'TEST_K8S_API_SERVER', value: TEST_K8S_API_SERVER],
                [$class: 'StringParameterValue', name: 'TEST_K8S_CONFORMANCE_IMAGE', value: TEST_K8S_CONFORMANCE_IMAGE],
              ]
          }

      } catch (Throwable e) {
          currentBuild.result = 'FAILURE'
          throw e
      }
  }
}
