Skip to content

Commit

Permalink
removed anything that has been deprecated in 1.55 and 1.56
Browse files Browse the repository at this point in the history
  • Loading branch information
daspilker committed Jul 6, 2017
1 parent 3a22222 commit 8427854
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 68 deletions.
2 changes: 2 additions & 0 deletions docs/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
* Support for older versions of the [Gradle Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin) is
deprecated, see [Migration](Migration#migrating-to-164)
* Removed anything that has been deprecated in 1.54, see [Migration](Migration#migrating-to-154)
* Removed anything that has been deprecated in 1.55, see [Migration](Migration#migrating-to-155)
* Removed anything that has been deprecated in 1.56, see [Migration](Migration#migrating-to-156)
* 1.63 (May 09 2017)
* Fixed problem with special characters in job, folder and view names
([JENKINS-44140](https://issues.jenkins-ci.org/browse/JENKINS-44140))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ abstract class AbstractDslScriptLoader<S extends JobParent, G extends GeneratedI

protected S runScriptEngine(ScriptRequest scriptRequest, GroovyShell groovyShell) {
try {
if (scriptRequest.scriptPath || scriptRequest.location) {
if (scriptRequest.scriptPath) {
logger.println("Processing DSL script ${scriptRequest.scriptName}")
checkValidScriptName(scriptRequest)
checkCollidingScriptName(scriptRequest, groovyShell.classLoader, logger)
Expand Down Expand Up @@ -117,11 +117,7 @@ abstract class AbstractDslScriptLoader<S extends JobParent, G extends GeneratedI
}

protected GroovyCodeSource createGroovyCodeSource(ScriptRequest scriptRequest) {
if (scriptRequest.body != null) {
new GroovyCodeSource(scriptRequest.body, scriptRequest.scriptName ?: 'script', DEFAULT_CODE_BASE)
} else {
new GroovyCodeSource(new URL(scriptRequest.urlRoots[0], scriptRequest.location))
}
new GroovyCodeSource(scriptRequest.body, scriptRequest.scriptName ?: 'script', DEFAULT_CODE_BASE)
}

protected void runScript(Script script) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import groovy.transform.EqualsAndHashCode

@EqualsAndHashCode
class ScriptRequest {
// Starting Object
@Deprecated
final String location

// Starting Script
final String body

Expand All @@ -21,27 +17,14 @@ class ScriptRequest {
final String scriptPath

ScriptRequest(String body) {
this(null, body, new File('.').toURI().toURL())
this(body, new File('.').toURI().toURL())
}

ScriptRequest(String body, URL urlRoot, boolean ignoreExisting = false, String scriptPath = null) {
this(null, body, [urlRoot] as URL[], ignoreExisting, scriptPath)
this(body, [urlRoot] as URL[], ignoreExisting, scriptPath)
}

ScriptRequest(String body, URL[] urlRoots, boolean ignoreExisting = false, String scriptPath = null) {
this(null, body, urlRoots, ignoreExisting, scriptPath)
}

@Deprecated
ScriptRequest(String location, String body, URL urlRoot, boolean ignoreExisting = false,
String scriptPath = null) {
this(location, body, [urlRoot] as URL[], ignoreExisting, scriptPath)
}

@Deprecated
ScriptRequest(String location, String body, URL[] urlRoots, boolean ignoreExisting = false,
String scriptPath = null) {
this.location = location
this.body = body
this.urlRoots = urlRoots
this.ignoreExisting = ignoreExisting
Expand All @@ -57,9 +40,6 @@ class ScriptRequest {
* @return the script`s file name or {@code null} if no file name has been provided
*/
String getScriptName() {
if (location) {
return location
}
if (!scriptPath) {
return null
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ class WrapperContext extends AbstractExtensibleContext {
*
* @param credentials name of the credentials to use
*/
@RequiresPlugin(id = 'ssh-agent')
@RequiresPlugin(id = 'ssh-agent', minimumVersion = '1.5')
void sshAgent(String credentials) {
jobManagement.logPluginDeprecationWarning('ssh-agent', '1.5')
Preconditions.checkNotNull(credentials, 'credentials must not be null')

wrapperNodes << new NodeBuilder().'com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper' {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@ class DslScriptLoaderSpec extends Specification {
noExceptionThrown()
}

def 'run engine with location'() {
setup:
ScriptRequest request = new ScriptRequest('simple.dsl', null, resourcesDir, false)

when:
def jobs = dslScriptLoader.runScripts([request]).jobs

then:
jobs != null
jobs.size() == 1
jobs.iterator().next().jobName == 'test'
}

def 'run engine'() {
setup:
ScriptRequest request = new ScriptRequest(loadScript('simple.dsl'), resourcesDir, false, 'simple.dsl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ class ScriptRequestSpec extends Specification {
expect:
new ScriptRequest('', [] as URL[], false, 'foo\\bar.txt').scriptName == 'bar.txt'
new ScriptRequest('', [] as URL[], false, 'foo/bar.txt').scriptName == 'bar.txt'
new ScriptRequest('', '', [] as URL[], false, 'foo/bar.txt').scriptName == 'bar.txt'
new ScriptRequest('', '', [] as URL[], false, '').scriptName == null
new ScriptRequest('foo.txt', '', [] as URL[]).scriptName == 'foo.txt'
new ScriptRequest('script').scriptName == null
}

def 'script base name'() {
expect:
new ScriptRequest('', [] as URL[], false, 'foo\\bar.txt').scriptBaseName == 'bar'
new ScriptRequest('', [] as URL[], false, 'foo/bar.txt').scriptBaseName == 'bar'
new ScriptRequest('', '', [] as URL[], false, 'foo/bar.txt').scriptBaseName == 'bar'
new ScriptRequest('', '', [] as URL[], false, '').scriptBaseName == null
new ScriptRequest('foo.txt', '', [] as URL[]).scriptBaseName == 'foo'
new ScriptRequest('script').scriptBaseName == null
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ class WrapperContextSpec extends Specification {
then:
context.wrapperNodes[0].name() == 'com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper'
context.wrapperNodes[0].user[0].value() == 'acme'
1 * mockJobManagement.requirePlugin('ssh-agent')
1 * mockJobManagement.logPluginDeprecationWarning('ssh-agent', '1.5')
1 * mockJobManagement.requireMinimumPluginVersion('ssh-agent', '1.5')
}

def 'sshAgent with multiple credentials'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ abstract class SecureDslScriptLoader extends JenkinsDslScriptLoader {
protected Collection<ScriptRequest> createSecureScriptRequests(Collection<ScriptRequest> scriptRequests) {
scriptRequests.collect {
// it is not safe to use additional classpath entries
new ScriptRequest(it.location, it.body, new URL[0], it.ignoreExisting, it.scriptPath)
new ScriptRequest(it.body, new URL[0], it.ignoreExisting, it.scriptPath)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -77,7 +76,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -95,7 +93,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT
requests[0].urlRoots.length == 2
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -114,7 +111,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT
requests[0].urlRoots.length == 2
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -135,7 +131,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT
requests[0].urlRoots.length == 3
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -155,7 +150,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -173,7 +167,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -191,7 +184,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -211,13 +203,11 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 2
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
!requests[0].ignoreExisting
requests[0].scriptPath == getAbsolutePath(build.workspace.child('a.groovy'))
requests[1].location == null
requests[1].body == SCRIPT_B
requests[1].urlRoots.length == 1
requests[1].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -235,13 +225,11 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 2
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 1
requests[0].urlRoots[0].toString() == 'workspace:/'
!requests[0].ignoreExisting
requests[0].scriptPath == getAbsolutePath(build.workspace.child('a.groovy'))
requests[1].location == null
requests[1].body == SCRIPT_B
requests[1].urlRoots.length == 1
requests[1].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -261,15 +249,13 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 2
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 3
requests[0].urlRoots[0].toString() == 'workspace:/'
requests[0].urlRoots[1] == new URL(build.workspace.toURI().toURL(), 'classes/')
requests[0].urlRoots[2] == new URL(build.workspace.toURI().toURL(), 'output/')
!requests[0].ignoreExisting
requests[0].scriptPath == getAbsolutePath(build.workspace.child('a.groovy'))
requests[1].location == null
requests[1].body == SCRIPT_B
requests[1].urlRoots.length == 3
requests[1].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -291,7 +277,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 3
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand All @@ -313,7 +298,6 @@ class ScriptRequestGeneratorSpec extends Specification {

then:
requests.size() == 1
requests[0].location == null
requests[0].body == SCRIPT_A
requests[0].urlRoots.length == 3
requests[0].urlRoots[0].toString() == 'workspace:/'
Expand Down

0 comments on commit 8427854

Please sign in to comment.