
/**
 * 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()

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
    }
}
