Jenkins OpenShift Pipeline Plugin

10 views
Skip to first unread message

Milan Tomic

unread,
Apr 8, 2020, 10:15:18 AM4/8/20
to Jenkins Users
Hello

I am sorry if this is not right group to post this question, but I was not able to find more suitable group.

I have multibranch pipeline Jenkins project and in my Jenkins file (see below) I create Docker image and deploy it into Nexus repository.

Now I would like to use Jenkins OpenShift Pipeline Plugin inside my Jenkins file, to deploy this Docker image into OpenShift 3.11.
I found many examples of OpenShift Pipeline Plugin usage, but none of them takes path to the Docker image and deploys it into OpenShift 3.11.

I am complete beginner with Jenkins pipelines so please correct me if I am doing something conceptually wrong or guide me into the right direction.

Jenkins file:
stage ('Deployment Stage') {
  steps {
    withMaven(maven : 'apache-maven-3.6.3') {
      sh 'mvn deploy'
    }
  }
}
stage('Building image') {
  steps {
    script {
      dockerImage = docker.build DOCKER_REGISTRY + "/" + CONTAINER_NAME + ":$POM_VERSION"
    }
  }
}
stage('Deploy Image') {
  steps {
    script {
      docker.withRegistry( "https://" + DOCKER_REGISTRY, DOCKER_CREDENTIAL ) {
        dockerImage.push()
      }
    }
  }
}
Reply all
Reply to author
Forward
0 new messages