Release MCP version pipeline - create symlinks to ubuntu mirror snapshots
Related: PROD-17757
Change-Id: I7d143362667313d3c75569c4a87255a17a04049b
diff --git a/release-mcp-version.groovy b/release-mcp-version.groovy
index b265944..95e8bac 100644
--- a/release-mcp-version.groovy
+++ b/release-mcp-version.groovy
@@ -1,10 +1,12 @@
/**
*
- * Release MCP
+ * Promote MCP
*
* Expected parameters:
- * MCP_VERSION
+ * SOURCE_REVISION
+ * TARGET_REVISION
* RELEASE_APTLY
+ * RELEASE_DEB_MIRRORS
* RELEASE_DOCKER
* RELEASE_GIT
* APTLY_URL
@@ -33,15 +35,22 @@
]
}
-def triggerDockerMirrorJob(dockerCredentials, dockerRegistryUrl, mcpVersion, imageList) {
+def triggerDockerMirrorJob(dockerCredentials, dockerRegistryUrl, targetTag, imageList) {
build job: "docker-images-mirror", parameters: [
[$class: 'StringParameterValue', name: 'TARGET_REGISTRY_CREDENTIALS_ID', value: dockerCredentials],
[$class: 'StringParameterValue', name: 'REGISTRY_URL', value: dockerRegistryUrl],
- [$class: 'StringParameterValue', name: 'IMAGE_TAG', value: mcpVersion],
+ [$class: 'StringParameterValue', name: 'IMAGE_TAG', value: targetTag],
[$class: 'StringParameterValue', name: 'IMAGE_LIST', value: imageList]
]
}
+def triggerMirrorRepoJob(snapshotId, snapshotName) {
+ build job: "mirror-snapshot-name-all", parameters: [
+ [$class: 'StringParameterValue', name: 'SNAPSHOT_NAME', value: snapshotName],
+ [$class: 'StringParameterValue', name: 'SNAPSHOT_ID', value: snapshotId]
+ ]
+}
+
def gitRepoAddTag(repoURL, repoName, tag, credentials, ref = "HEAD"){
git.checkoutGitRepository(repoName, repoURL, "master", credentials)
dir(repoName) {
@@ -70,22 +79,27 @@
timeout(time: 12, unit: 'HOURS') {
node() {
try {
- if(RELEASE_APTLY.toBoolean())
- {
- stage("Release Aptly"){
- triggerAptlyPromoteJob(APTLY_URL, 'all', false, true, 'all', false, '(.*)/testing', APTLY_STORAGES, '{0}/stable')
- triggerAptlyPromoteJob(APTLY_URL, 'all', false, true, 'all', false, '(.*)/stable', APTLY_STORAGES, '{0}/${MCP_VERSION}')
+ stage("Promote"){
+ if(RELEASE_APTLY.toBoolean())
+ {
+ common.infoMsg("Promoting Aptly")
+ triggerAptlyPromoteJob(APTLY_URL, 'all', false, true, 'all', false, "(.*)/${SOURCE_REVISION}", APTLY_STORAGES, "{0}/${TARGET_REVISION}")
}
- }
- if(RELEASE_DOCKER.toBoolean())
- {
- stage("Release Docker"){
- triggerDockerMirrorJob(DOCKER_CREDENTIALS, DOCKER_URL, MCP_VERSION, DOCKER_IMAGES)
+
+ if(RELEASE_DEB_MIRRORS.toBoolean()){
+ common.infoMsg("Promoting Debmirrors")
+ triggerMirrorRepoJob(SOURCE_REVISION, TARGET_REVISION)
}
- }
- if(RELEASE_GIT.toBoolean())
- {
- stage("Release Git"){
+
+ if(RELEASE_DOCKER.toBoolean())
+ {
+ common.infoMsg("Promoting Docker images")
+ triggerDockerMirrorJob(DOCKER_CREDENTIALS, DOCKER_URL, TARGET_REVISION, DOCKER_IMAGES)
+ }
+
+ if(RELEASE_GIT.toBoolean())
+ {
+ common.infoMsg("Promoting Git repositories")
def repos = GIT_REPO_LIST.tokenize('\n')
def repoUrl, repoName, repoCommit, repoArray
for (repo in repos){
@@ -96,7 +110,7 @@
repoName = repoArray[0]
repoUrl = repoArray[1]
repoCommit = repoArray[2]
- gitRepoAddTag(repoUrl, repoName, MCP_VERSION, GIT_CREDENTIALS, repoCommit)
+ gitRepoAddTag(repoUrl, repoName, TARGET_REVISION, GIT_CREDENTIALS, repoCommit)
}
}
}