Deploy in different cluster cluster than test

Posted on

We have created a Jenkinsfile, which is in the git project.
We currently have a project deployed in testing that runs in a cluster different from the production one. Everything works correctly, except when you want to deploy in production, since it is another cluster and I do not see how to do it.

I enclose the copy of the jenkinsfile.

environment {
SRC_REGISTRY_CREDENTIALS = credentials('ocp-jenkins-no-prod')
DST_REGISTRY_CREDENTIALS = credentials('ocp-jenkins-prod')
}

node {
stage('Build') {
openshiftBuild(buildConfig: 'ocp', showBuildLogs: 'true')
}

stage('Acceso GitLab') {
git 'http://gitlab.xxxxx.local/root/hola_ocp.git'
}
stage('Deploy a Dev') {
openshiftDeploy(deploymentConfig: 'ocp')
}

stage('Aprobar a Test') {
input message: 'Aprobar pasaje a Test?',
id: 'approval'
}

stage('Deploy a Test') {
openshiftTag srcStream: 'hola',
namespace: 'holamundo',
srcTag: 'latest',
destinationNamespace: 'holamundo-test',
destStream: 'hola-test',
destTag: 'latest'
openshiftVerifyDeployment depCfg: 'hola-test',
namespace: 'holamundo-test'
}

stage('Aprobar a Produccion') {
input message: 'Aprobar pasaje a Produccion?',
id: 'approval'
}

stage('Deploy a Produccion') {
openshift.withCluster() {
openshift.withProject() {
echo "Using project: ${openshift.project()}"
}

    openshift.raw("image mirror --insecure --loglevel=8 http://docker-registry-default.noprod.local:443/holamundo/hola:latest http://docker-registry-default.prod.local:443/holamundo/hola-prod:latest")
}
openshiftTag srcStream: 'hola',
namespace: 'holamundo',
srcTag: 'latest',
destinationNamespace: 'holamundoprod',
destStream: 'hola-prod',
destTag: 'latest'
openshiftVerifyDeployment depCfg: 'hola-prod',
namespace: 'holamundoprod'

}

}

Responses