Switch credential to maintenance-team-robot for build-config-drive job
Also drop ssh-agent custom code
PROD-37197
Change-Id: Id3ed14b8eee5e18c53afe97278034853c24c1174
diff --git a/jobs/pipelines/swarm-create-cfg-config-drive.groovy b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
index aff36df..b64e867 100644
--- a/jobs/pipelines/swarm-create-cfg-config-drive.groovy
+++ b/jobs/pipelines/swarm-create-cfg-config-drive.groovy
@@ -42,54 +42,52 @@
withCredentials([[$class: 'SSHUserPrivateKeyBinding',
keyFileVariable: "GERRIT_KEY",
credentialsId: env.GERRIT_MCP_CREDENTIALS_ID,
- usernameVariable: "GERRIT_USERNAME",
- passwordVariable: "GERRIT_PASSWORD"]]) {
+ usernameVariable: "GERRIT_USERNAME"]]) {
def gerrit_user = env.GERRIT_USERNAME
- def gerrit_password = env.GERRIT_PASSWORD
String gerrit_host = "gerrit.mcp.mirantis.com"
String gerrit_port = "29418"
- ssh.prepareSshAgentKey(env.GERRIT_MCP_CREDENTIALS_ID)
-
- ssh.agentSh(
- "set -ex; " +
- "git clone ssh://${gerrit_user}@${gerrit_host}:${gerrit_port}/mcp/mcp-common-scripts mcp-common-scripts-git; " +
- "git clone --mirror ssh://${gerrit_user}@${gerrit_host}:${gerrit_port}/mk/mk-pipelines mk-pipelines; " +
- "git clone --mirror ssh://${gerrit_user}@${gerrit_host}:${gerrit_port}/mcp-ci/pipeline-library pipeline-library")
-
- if (COMMON_SCRIPTS_COMMIT != '') {
- sh ("""\
- set -ex
- cd mcp-common-scripts-git
- git checkout ${COMMON_SCRIPTS_COMMIT}
- git log -1
- """)
- }
-
- if (MCP_COMMON_SCRIPTS_REFS != '') {
- ssh.agentSh(
+ sshagent([env.GERRIT_MCP_CREDENTIALS_ID]) {
+ sh (
"set -ex; " +
- "cd mcp-common-scripts-git; " +
- "git fetch https://${gerrit_host}/mcp/mcp-common-scripts ${MCP_COMMON_SCRIPTS_REFS} && git checkout FETCH_HEAD; " +
- "git log -1")
- }
+ "git clone ssh://${gerrit_user}@${gerrit_host}:${gerrit_port}/mcp/mcp-common-scripts mcp-common-scripts-git; " +
+ "git clone --mirror ssh://${gerrit_user}@${gerrit_host}:${gerrit_port}/mk/mk-pipelines mk-pipelines; " +
+ "git clone --mirror ssh://${gerrit_user}@${gerrit_host}:${gerrit_port}/mcp-ci/pipeline-library pipeline-library")
- if (PIPELINE_LIBRARY_REF != '') {
- ssh.agentSh(
- "set -ex; " +
- "cd pipeline-library; " +
- "git fetch https://${gerrit_host}/mcp-ci/pipeline-library ${PIPELINE_LIBRARY_REF}; " +
- "git tag ${MCP_VERSION} FETCH_HEAD -f; " +
- "git branch -f release/${MCP_VERSION} FETCH_HEAD; " +
- "git log -1")
- }
- if (MK_PIPELINES_REF != '') {
- ssh.agentSh(
- "set -ex; " +
- "cd mk-pipelines; " +
- "git fetch https://${gerrit_host}/mk/mk-pipelines ${MK_PIPELINES_REF}; " +
- "git tag ${MCP_VERSION} FETCH_HEAD -f; " +
- "git branch -f release/${MCP_VERSION} FETCH_HEAD; " +
- "git log -1")
+ if (COMMON_SCRIPTS_COMMIT != '') {
+ sh ("""\
+ set -ex
+ cd mcp-common-scripts-git
+ git checkout ${COMMON_SCRIPTS_COMMIT}
+ git log -1
+ """)
+ }
+
+ if (MCP_COMMON_SCRIPTS_REFS != '') {
+ sh (
+ "set -ex; " +
+ "cd mcp-common-scripts-git; " +
+ "git fetch https://${gerrit_host}/mcp/mcp-common-scripts ${MCP_COMMON_SCRIPTS_REFS} && git checkout FETCH_HEAD; " +
+ "git log -1")
+ }
+
+ if (PIPELINE_LIBRARY_REF != '') {
+ sh (
+ "set -ex; " +
+ "cd pipeline-library; " +
+ "git fetch https://${gerrit_host}/mcp-ci/pipeline-library ${PIPELINE_LIBRARY_REF}; " +
+ "git tag ${MCP_VERSION} FETCH_HEAD -f; " +
+ "git branch -f release/${MCP_VERSION} FETCH_HEAD; " +
+ "git log -1")
+ }
+ if (MK_PIPELINES_REF != '') {
+ sh (
+ "set -ex; " +
+ "cd mk-pipelines; " +
+ "git fetch https://${gerrit_host}/mk/mk-pipelines ${MK_PIPELINES_REF}; " +
+ "git tag ${MCP_VERSION} FETCH_HEAD -f; " +
+ "git branch -f release/${MCP_VERSION} FETCH_HEAD; " +
+ "git log -1")
+ }
}
}
}
diff --git a/jobs/templates/swarm-create-cfg-config-drive-jjb.yaml b/jobs/templates/swarm-create-cfg-config-drive-jjb.yaml
index 979ce74..3012008 100644
--- a/jobs/templates/swarm-create-cfg-config-drive-jjb.yaml
+++ b/jobs/templates/swarm-create-cfg-config-drive-jjb.yaml
@@ -121,7 +121,7 @@
trim: 'false'
- string:
name: GERRIT_MCP_CREDENTIALS_ID
- default: 'f4fb9dd6-ba63-4085-82f7-3fa601334d95'
+ default: 'maintenance-team-ssh'
description: 'Credentials ID to access gerrit.mcp.mirantis.net'
trim: 'false'
- string: