blob: e51dbc434828d0a1135ebdcaf19b59c590844f8d [file] [log] [blame]
Denis Egorenko7d786542018-12-25 18:15:38 +04001/**
2 Repo-resolver job which will generate current repo snapshots
3 in Reclass format for testing/nightly,proposed versions.
4
5 Output example:
6
7 parameters:
8 _param:
9 nightly:
10 linux_system_repo_mcp_salt_url: http://mirror.mirantis.com/.snapshots/nightly-salt-formulas-xenial-2018-12-21-181741
11 testing:
12 linux_system_repo_mcp_salt_url: http://mirror.mirantis.com/.snapshots/nightly-salt-formulas-xenial-2018-12-21-181741
13 proposed:
14 linux_system_repo_mcp_salt_url: http://mirror.mirantis.com/.snapshots/nightly-salt-formulas-xenial-2018-12-21-181741
15
16 * Expected parameters:
17 MIRROR_HOST - Mirror host to use to generate snapshots context
18*/
19common = new com.mirantis.mk.Common()
20mirror = new com.mirantis.mk.Mirror()
21
22mirrorHost = env.MIRROR_HOST ?: 'mirror.mirantis.com'
23slaveNode = env.SLAVE_NODE ?: 'virtual'
24
25node(slaveNode) {
26
27 def fileName = 'repo-context.yml'
28 // TODO: replace with dynamical subsetting from reclass
29 def ceph_codename = 'luminous'
30 def elasticsearch_version = '5'
31 def glusterfs_version_number = '3.8'
32 def saltstack_version_number = '2017.7'
33 def versions = ['testing', 'proposed', 'nightly']
34 def components = [
35 'repo_mcp_aptly':'aptly',
36 'repo_mcp_cassandra':'cassandra',
37 'repo_mcp_ceph': "ceph-${ceph_codename}",
38 'repo_mcp_docker_legacy': 'docker-1.x',
39 'repo_mcp_docker':'docker',
40 'repo_mcp_elasticsearch_curator': 'elasticsearch-curator-5',
41 'repo_mcp_elasticsearch': "elasticsearch-${elasticsearch_version}.x",
42 'repo_mcp_extra': 'extra',
43 'repo_mcp_glusterfs': "glusterfs-${glusterfs_version_number}",
44 'repo_mcp_influxdb': 'influxdb',
45 'repo_mcp_jenkins': 'jenkins',
46 'repo_mcp_maas': 'maas',
47 'repo_mcp_percona': 'percona',
48 'repo_mcp_saltstack': "saltstack-${saltstack_version_number}",
49 'repo_mcp_fluentd_url': 'td-agent',
50 'repo_mcp_salt_url': 'salt-formulas',
51 ]
52
53 stage('Generate context') {
54 def meta = ['_param': [:]]
55 versions.each {
56 // ubuntu has target.txt in version root
57 meta['_param'][it] = ['linux_system_repo_ubuntu_url': mirror.getLatestSnapshotMeta(mirrorHost, it, '', 'ubuntu')['repoUrl'] ]
58 }
59 components.each { componentKey, componentRepo ->
60 for(version in versions) {
61 def versionMeta = [:]
62 try {
63 versionMeta["linux_system_repo_${componentKey}_url"] = mirror.getLatestSnapshotMeta(mirrorHost, version, componentRepo)['repoUrl']
64 } catch(Exception e) {
65 common.errorMsg(e)
66 continue
67 }
68 meta['_param'][version] << versionMeta
69 }
70 }
71
72 writeYaml file: fileName, data: ['parameters': meta ]
73 archiveArtifacts artifacts: fileName
74 }
75}