Skip to content
Merged
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
2 changes: 2 additions & 0 deletions docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
[Migration](Migration#migrating-to-144)
* Deprecated a method for the [Perforce Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Perforce+Plugin), see
[Migration](Migration#migrating-to-144)
* Deprecated several methods for the [Git Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin), see
[Migration](Migration#migrating-to-144)
* Removed a method in `JobManagement` interface, see [Migration](Migration#migrating-to-144)
* Moved two classes, see [Migration](Migration#migrating-to-144)
* 1.43 (February 13 2016)
Expand Down
71 changes: 71 additions & 0 deletions docs/Migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,76 @@
## Migrating to 1.44

### Git

DSL support for the [Git Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin) has been changed to reflect the
configuration style of version 2.0 of the Git plugin.

DSL prior to 1.44
```groovy
job('example') {
scm {
git {
strategy {
inverse()
}
mergeOptions {
remote('origin')
branch('feature')
}
createTag()
clean()
wipeOutWorkspace()
remotePoll(false)
shallowClone()
reference('/git/repo.git')
cloneTimeout(10)
recursiveSubmodules()
trackingSubmodules()
pruneBranches()
localBranch('ci')
relativeTargetDir('ws')
ignoreNotifyCommit()
}
}
}
```

DSL since 1.44
```groovy
job('example') {
scm {
git {
extensions {
choosingStrategy {
inverse()
}
mergeOptions {
remote('origin')
branch('feature')
}
perBuildTag()
cleanAfterCheckout()
wipeOutWorkspace()
disableRemotePoll()
cloneOptions {
shallow()
reference('/git/repo.git')
timeout(10)
}
submoduleOptions {
recursive()
tracking()
}
pruneBranches()
localBranch('ci')
relativeTargetDirectory('ws')
ignoreNotifyCommit()
}
}
}
}
```

### Lockable Resources

Support for versions older than 1.7 of the
Expand Down
7 changes: 4 additions & 3 deletions docs/The-Configure-Block.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,16 +572,17 @@ Result:

DSL:
```groovy
// this creates XML for version 1.x of the Git Plugin, but version 2.x is backwards compatible
job('example') {
scm {
git {
remote {
name 'remoteB'
url 'git@server:account/repo1.git'
}
clean()
relativeTargetDir('repo1')
extensions {
relativeTargetDirectory('repo1')
cleanAfterCheckout()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ job('example') {
remote {
github('jenkinsci/jenkins')
}
relativeTargetDir('jenkins')
extensions {
relativeTargetDirectory('jenkins')
}
}
git {
remote {
github('jenkinsci/job-dsl-plugin')
}
relativeTargetDir('job-dsl-plugin')
extensions {
relativeTargetDirectory('job-dsl-plugin')
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ job('example-1') {
name('remoteB')
url('git@server:account/repo1.git')
}
clean()
relativeTargetDir('repo1')
extensions {
cleanAfterCheckout()
relativeTargetDirectory('repo1')
}
}
}
}
Expand All @@ -26,7 +28,12 @@ job('example-2') {
url('git@serverB:account/repo1.git')
}
branch('featureA')
mergeOptions('upstream', 'master')
extensions {
mergeOptions {
remote('upstream')
branch('master')
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class ScmContext extends AbstractExtensibleContext {
}

if (gitContext.shallowClone || gitContext.reference || gitContext.cloneTimeout) {
gitContext.extensions << new NodeBuilder().'hudson.plugins.git.extensions.impl.CloneOption' {
gitContext.extensionContext.extensions << new NodeBuilder().
'hudson.plugins.git.extensions.impl.CloneOption' {
shallow(gitContext.shallowClone)
reference(gitContext.reference)
if (gitContext.cloneTimeout) {
Expand Down Expand Up @@ -136,8 +137,8 @@ class ScmContext extends AbstractExtensibleContext {
localBranch gitContext.localBranch
}
skipTag !gitContext.createTag
if (gitContext.extensions) {
extensions(gitContext.extensions)
if (gitContext.extensionContext.extensions) {
extensions(gitContext.extensionContext.extensions)
}
}

Expand Down Expand Up @@ -186,7 +187,9 @@ class ScmContext extends AbstractExtensibleContext {
if (configure) {
delegate.configure(configure)
}
delegate.createTag()
extensions {
perBuildTag()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package javaposse.jobdsl.dsl.helpers.scm

import javaposse.jobdsl.dsl.Context

class GitCloneOptionsContext implements Context {
boolean shallow
String reference
Integer timeout

/**
* Perform shallow clone, so that Git will not download history of the project. Defaults to {@code false}.
*/
void shallow(boolean shallow = true) {
this.shallow = shallow
}

/**
* Specify a folder containing a repository that will be used by Git as a reference during clone operations.
*/
void reference(String reference) {
this.reference = reference
}

/**
* Specify a timeout (in minutes) for clone and fetch operations.
*/
void timeout(Integer timeout) {
this.timeout = timeout
}
}
Loading