Fix using distribRevision parameter in extraRepo config Yaml
DistribReviosion was hardcoded by mistake, however it was parametrized
in function.
Also add ability to operate with repo_key gpg
Change-Id: I700628393be698711d8f83fa959dd897d4528e3d
diff --git a/src/com/mirantis/mk/Common.groovy b/src/com/mirantis/mk/Common.groovy
index 3af2a92..54eb85a 100644
--- a/src/com/mirantis/mk/Common.groovy
+++ b/src/com/mirantis/mk/Common.groovy
@@ -892,28 +892,31 @@
* Example :
configYaml = '''
---
- distrib_revision: 'nightly'
aprConfD: |-
APT::Get::AllowUnauthenticated 'true';
repo:
mcp_saltstack:
- source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/saltstack-2017.7/xenial xenial main"
+ source: "deb [arch=amd64] http://mirror.mirantis.com/nightly/saltstack-2017.7/xenial xenial main"
pinning: |-
Package: libsodium18
Pin: release o=SaltStack
Pin-Priority: 50
+ repo_key: "http://mirror.mirantis.com/public.gpg"
'''
*
*/
def debianExtraRepos(configYaml) {
def config = readYaml text: configYaml
- def distribRevision = config.get('distribRevision', 'nightly')
if (config.get('repo', false)) {
for (String repo in config['repo'].keySet()) {
- source = config['repo'][repo]['source'].replace('SUB_DISTRIB_REVISION', distribRevision)
+ source = config['repo'][repo]['source']
warningMsg("Write ${source} > /etc/apt/sources.list.d/${repo}.list")
sh("echo '${source}' > /etc/apt/sources.list.d/${repo}.list")
+ if (config['repo'][repo].containsKey('repo_key')) {
+ key = config['repo'][repo]['repo_key']
+ sh("wget -O - '${key}' | apt-key add -")
+ }
// TODO implement pining
}
}
diff --git a/src/com/mirantis/mk/SaltModelTesting.groovy b/src/com/mirantis/mk/SaltModelTesting.groovy
index 226ec61..aeb7874 100644
--- a/src/com/mirantis/mk/SaltModelTesting.groovy
+++ b/src/com/mirantis/mk/SaltModelTesting.groovy
@@ -45,16 +45,15 @@
]
def dockerOptsFinal = (dockerBaseOpts + dockerExtraOpts).join(' ')
- def defaultExtraReposYaml = '''
+ def defaultExtraReposYaml = """
---
-distribRevision: 'nightly'
aprConfD: |-
APT::Get::AllowUnauthenticated 'true';
APT::Get::Install-Suggests 'false';
APT::Get::Install-Recommends 'false';
repo:
mcp_saltstack:
- source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/saltstack-2017.7/xenial xenial main"
+ source: "deb [arch=amd64] http://mirror.mirantis.com/${distribRevision}/saltstack-2017.7/xenial xenial main"
pinning: |-
Package: libsodium18
Pin: release o=SaltStack
@@ -64,14 +63,17 @@
Pin: release o=SaltStack
Pin-Priority: 1100
mcp_extra:
- source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/extra/xenial xenial main"
+ source: "deb [arch=amd64] http://mirror.mirantis.com/${distribRevision}/extra/xenial xenial main"
+ mcp_saltformulas:
+ source: "deb http://apt.mcp.mirantis.net:8085/xenial ${distribRevision} salt salt-latest"
+ repo_key: "http://apt.mcp.mirantis.net:8085/public.gpg"
ubuntu:
- source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/ubuntu xenial main restricted universe"
+ source: "deb [arch=amd64] http://mirror.mirantis.com/${distribRevision}/ubuntu xenial main restricted universe"
ubuntu-upd:
- source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/ubuntu xenial-updates main restricted universe"
+ source: "deb [arch=amd64] http://mirror.mirantis.com/${distribRevision}/ubuntu xenial-updates main restricted universe"
ubuntu-sec:
- source: "deb [arch=amd64] http://mirror.mirantis.com/SUB_DISTRIB_REVISION/ubuntu xenial-security main restricted universe"
-'''
+ source: "deb [arch=amd64] http://mirror.mirantis.com/${distribRevision}/ubuntu xenial-security main restricted universe"
+"""
def img = docker.image(dockerImageName)
def extraReposYaml = config.get('extraReposYaml', defaultExtraReposYaml)