| Denis Egorenko | 70baa0f | 2018-09-14 15:47:51 +0400 | [diff] [blame] | 1 | /** | 
|  | 2 | * Check new Reclass version against current model. | 
|  | 3 | * | 
|  | 4 | * Expected parameters: | 
|  | 5 | *   SALT_MASTER_CREDENTIALS            Credentials to the Salt API. | 
|  | 6 | *   SALT_MASTER_URL                    Full Salt API address [http://10.10.10.1:8000]. | 
|  | 7 | *   DISTRIB_REVISION                   Mirror version to use | 
|  | 8 | *   EXTRA_REPO_PREDEFINED              Use mcp extra repo defined on host | 
|  | 9 | *   EXTRA_REPO                         Extra repo to use in format (for example, deb [arch=amd64] http://apt.mirantis.com/xenial/ nightly extra) | 
|  | 10 | *   EXTRA_REPO_GPG_KEY_URL             GPG key URL for extra repo | 
|  | 11 | *   TARGET_NODES                       Target specification, e.g. 'I@openssh:server' | 
|  | 12 | **/ | 
|  | 13 |  | 
|  | 14 | def common = new com.mirantis.mk.Common() | 
|  | 15 | def salt = new com.mirantis.mk.Salt() | 
|  | 16 | def saltModel = new com.mirantis.mk.SaltModelTesting() | 
|  | 17 | def python = new com.mirantis.mk.Python() | 
|  | 18 |  | 
|  | 19 | def env = "env" | 
|  | 20 | def extraRepo = env.EXTRA_REPO | 
|  | 21 | def extraRepoKey = env.EXTRA_REPO_GPG_KEY_URL | 
|  | 22 | def targetNodes = env.TARGET_NODES | 
|  | 23 | def distribRevision = env.DISTRIB_REVISION | 
|  | 24 | def usePredefinedExtra = env.EXTRA_REPO_PREDEFINED | 
|  | 25 | node('cfg') { | 
|  | 26 |  | 
|  | 27 | stage('Setup virtualenv for Pepper') { | 
|  | 28 | python.setupPepperVirtualenv(env, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS) | 
|  | 29 | } | 
|  | 30 |  | 
|  | 31 | def minions = salt.getMinionsSorted(env, targetNodes) | 
|  | 32 | if (usePredefinedExtra) { | 
|  | 33 | def mcp_extra = salt.getPillar(env, 'I@salt:master', "linux:system:repo:mcp_extra").get("return")[0].values()[0] | 
|  | 34 | extraRepoKey = mcp_extra['key_url'] | 
|  | 35 | extraRepo = mcp_extra['source'] | 
|  | 36 | } | 
|  | 37 | def config = [ | 
|  | 38 | 'distribRevision': distribRevision, | 
|  | 39 | 'targetNodes': minions, | 
|  | 40 | 'extraRepo': extraRepo, | 
|  | 41 | 'extraRepoKey': extraRepoKey, | 
|  | 42 | 'venv': env | 
|  | 43 | ] | 
|  | 44 | saltModel.compareReclassVersions(config) | 
|  | 45 | } |