Pass gerrit http login/pass to build
PROD-37075
Change-Id: I62c3ccdb03035ebe3312cad3d3093c4d4c51724c
diff --git a/packer-image-buid.groovy b/packer-image-buid.groovy
index b615cdc..4117d06 100644
--- a/packer-image-buid.groovy
+++ b/packer-image-buid.groovy
@@ -43,6 +43,7 @@
//
def job_env = env.getEnvironment().findAll { k, v -> v }
gerritCredentials = env.CREDENTIALS_ID ?: 'gerrit'
+gerritCredentialsHttp = env.GERRIT_HTTP_CREDENTIALS_ID ?: 'mcp-jenkins-http'
/////
extra_vars = readYaml text: job_env.get('EXTRA_VARIABLES_YAML','').trim()
@@ -187,6 +188,15 @@
if (os_openrc.get('CLOUD_REGION', 'US').matches("[Ee][Uu]")) {
sh "sed -i 's/debmirror_mirrors_host: .*/debmirror_mirrors_host: mirror-eu.mcp.mirantis.net/' config-drive/model/${filePath}"
}
+ filePath = 'classes/cluster/mcp-offline/infra/mirror/init.yml'
+ withCredentials([usernamePassword(
+ credentialsId: gerritCredentialsHttp,
+ usernameVariable: 'GERRIT_HTTP_USER',
+ passwordVariable: 'GERRIT_HTTP_PASS')
+ ]) {
+ sh "sed -i 's/%STACKLIGHT_PYTEST_GIT_HTTPS_USER%/${GERRIT_HTTP_USER}/' config-drive/model/${filePath}"
+ sh "sed -i 's/%STACKLIGHT_PYTEST_GIT_HTTPS_PASS%/${GERRIT_HTTP_PASS}/' config-drive/model/${filePath}"
+ }
}
def reclass_url = extra_vars.get('RECLASS_SYSTEM_URL', '')