Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made changes so that it supports pluggable-scm #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 8 additions & 21 deletions jenkins/jobs/dsl/environment_provisioning.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import pluggable.scm.*;

SCMProvider scmProvider = SCMProviderHandler.getScmProvider("${SCM_PROVIDER_ID}", binding.variables)

// Folders
def workspaceFolderName = "${WORKSPACE_NAME}"
def projectFolderName = "${PROJECT_NAME}"
def projectScmNamespace = "${SCM_NAMESPACE}"

// Variables
def environmentTemplateGitUrl = "ssh://jenkins@gerrit:29418/${PROJECT_NAME}/adop-cartridge-java-environment-template"
def environmentTemplateGitUrl = "adop-cartridge-java-environment-template"

// Jobs
def environmentProvisioningPipelineView = buildPipelineView(projectFolderName + "/Environment_Provisioning")
Expand Down Expand Up @@ -74,16 +79,7 @@ The reference application deploy job is expecting the default environment to be
|docker exec proxy /usr/sbin/nginx -s reload
|set -x'''.stripMargin())
}
scm {
git {
remote {
name("origin")
url("${environmentTemplateGitUrl}")
credentials("adop-jenkins-master")
}
branch("*/master")
}
}
scm scmProvider.get(projectScmNamespace, environmentTemplateGitUrl, "*/master", "pluggable-scm", null)
publishers {
buildPipelineTrigger("${PROJECT_NAME}/Destroy_Environment") {
parameters {
Expand All @@ -104,16 +100,7 @@ destroyEnvironmentJob.with{
env('WORKSPACE_NAME',workspaceFolderName)
env('PROJECT_NAME',projectFolderName)
}
scm {
git {
remote {
name("origin")
url("${environmentTemplateGitUrl}")
credentials("adop-jenkins-master")
}
branch("*/master")
}
}
scm scmProvider.get(projectScmNamespace, environmentTemplateGitUrl, "*/master", "pluggable-scm", null)
wrappers {
preBuildCleanup()
injectPasswords()
Expand Down
39 changes: 8 additions & 31 deletions jenkins/jobs/dsl/java_reference_application_jobs.groovy
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import pluggable.scm.*;

SCMProvider scmProvider = SCMProviderHandler.getScmProvider("${SCM_PROVIDER_ID}", binding.variables)

// Folders
def workspaceFolderName = "${WORKSPACE_NAME}"
def projectFolderName = "${PROJECT_NAME}"
def projectScmNamespace = "${SCM_NAMESPACE}"

// Variables
def projectNameKey = projectFolderName.toLowerCase().replace("/", "-")
def referenceAppgitRepo = "spring-petclinic"
def regressionTestGitRepo = "adop-cartridge-java-regression-tests"
def referenceAppGitUrl = "ssh://jenkins@gerrit:29418/${PROJECT_NAME}/" + referenceAppgitRepo
def regressionTestGitUrl = "ssh://jenkins@gerrit:29418/${PROJECT_NAME}/" + regressionTestGitRepo

// Jobs
def buildAppJob = freeStyleJob(projectFolderName + "/Reference_Application_Build")
Expand Down Expand Up @@ -39,31 +42,13 @@ buildAppJob.with {
maskPasswords()
sshAgent("adop-jenkins-master")
}
scm {
git {
remote {
url(referenceAppGitUrl)
credentials("adop-jenkins-master")
}
branch("*/master")
}
}
scm scmProvider.get(projectScmNamespace, referenceAppgitRepo, "*/master", "pluggable-scm", null)
environmentVariables {
env('WORKSPACE_NAME', workspaceFolderName)
env('PROJECT_NAME', projectFolderName)
}
label("java8")
triggers {
gerrit {
events {
refUpdated()
}
project(projectFolderName + '/' + referenceAppgitRepo, 'plain:master')
configure { node ->
node / serverName("ADOP Gerrit")
}
}
}
triggers scmProvider.trigger(projectScmNamespace, referenceAppgitRepo, "master")
steps {
maven {
goals('clean install -DskipTests')
Expand Down Expand Up @@ -250,15 +235,7 @@ regressionTestJob.with {
stringParam("PARENT_BUILD", "Reference_Application_Build", "Parent build name")
stringParam("ENVIRONMENT_NAME", "CI", "Name of the environment.")
}
scm {
git {
remote {
url(regressionTestGitUrl)
credentials("adop-jenkins-master")
}
branch("*/master")
}
}
scm scmProvider.get(projectScmNamespace, regressionTestGitRepo, "*/master", "pluggable-scm", null)
wrappers {
preBuildCleanup()
injectPasswords()
Expand Down