Skip to content

Commit

Permalink
Merge pull request #9 from seanturner83/noscriptexecution
Browse files Browse the repository at this point in the history
Rips out the ability to execute a Groovy script with this plugin
  • Loading branch information
seanturner83 authored Jul 17, 2017
2 parents 1fa18db + 98405fb commit 61e66e6
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 135 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: java

deploy:
provider: releases
api_key:
secure: "InJlegbaieloea85f3DbzizAwmCWE5bQHzNY2JA/p6j3rY3w6urDZtvjY1/WaOttot8o7uehEm4lpXpB+sF5+tLYcMea6ibheC93E8Akh1eBrhlG4qQGZwvflkWUtniviqED0vUZd5TYkMKpdc29u+emzWX/lvlv0zSiFYKiuiCjuQxNvUhuvrJRoU0/yOqOYJmQSlNNeC2OmPoIm1WC7Y4imX6noF6G8+pQD+N5rT8Afyvs/cWoQaT8zehp4bVYgY26EdozblSoc7pQDJv6bhTwCdrq7aBH+XQBFKd5dLdnbrCLkOM1IkO+LBwMIUd8/qU0qVO9vkPAq8vzcn6hnR3ap+Wd19HGPQVfeb9b9/kHK1d6/CdvBlP9txwXgQD0HDWkNONhoPxVRucyAux3PJpVlsS89G24zhx7QcrPb1k9e2sXFfEB54PCGkFF3MdosmevV5MY0AtZDh31i5nHo2dc0607xGAPGNWv8bORmyin3NITV0Hir+qBPZRjfCXXfgQwKntT/H9fLiD2ziJdZLV4Ss+OcmJSG4uhVFO/RDA/SWtJvpBIWyUvH/bqS/VVxVsxzMfgG+sNoZ6RzqZCH8kUjOtDEONNRj0teBIPN4FqIsccStQlDSdkYvDXxegKKD7uDp1npyd11a4Zs60LHgq+aUZrimHkluRfZg8JJ10="
file: 'target/artifactdeployer.hpi'
skip_cleanup: true
on:
tags: true
all_branches: true
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.565.1</version>
<version>1.585</version>
</parent>

<artifactId>artifactdeployer</artifactId>
<packaging>hpi</packaging>
<name>Jenkins Artifact Deployer Plug-in</name>
<version>0.34-SNAPSHOT</version>
<version>0.40</version>
<url>http://wiki.jenkins-ci.org/display/JENKINS/ArtifactDeployer+Plugin</url>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class ArtifactDeployerBuilder extends Builder implements Serializable {
ArtifactDeployerEntry entry;

@DataBoundConstructor
public ArtifactDeployerBuilder(String includes, String basedir, String excludes, String remote, boolean flatten, boolean deleteRemote, boolean deleteRemoteArtifacts, DeleteRemoteArtifactsByScriptModel deleteRemoteArtifactsByScript, boolean failNoFilesDeploy) {
this.entry = new ArtifactDeployerEntry(includes, basedir, excludes, remote, flatten, deleteRemote, deleteRemoteArtifacts, deleteRemoteArtifactsByScript, failNoFilesDeploy);
public ArtifactDeployerBuilder(String includes, String basedir, String excludes, String remote, boolean flatten, boolean deleteRemote, boolean deleteRemoteArtifacts, boolean failNoFilesDeploy) {
this.entry = new ArtifactDeployerEntry(includes, basedir, excludes, remote, flatten, deleteRemote, deleteRemoteArtifacts, failNoFilesDeploy);
}

public ArtifactDeployerBuilder() {
Expand Down Expand Up @@ -199,18 +199,6 @@ public void onDeleted(AbstractBuild build) {
}

}

//Execute the script for deletion
if (entry.isDeleteRemoteArtifactsByScript()) {
//Inject list artifacts as variable
Binding binding = new Binding();
if (artifactDeployerBuildAction != null) {
List<ArtifactDeployerVO> listArtifacts = info.get(entry.getUniqueId());
binding.setVariable("ARTIFACTS", listArtifacts);
}
GroovyShell shell = new GroovyShell(binding);
shell.evaluate(entry.getGroovyExpression());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,30 +46,22 @@ public class ArtifactDeployerEntry implements Serializable {
private boolean flatten;
private boolean deleteRemote;
private boolean deleteRemoteArtifacts;
private boolean deleteRemoteArtifactsByScript;
private boolean deleteRemoteArtifactsByScript=false;
private String groovyExpression;
private boolean failNoFilesDeploy;

public ArtifactDeployerEntry() {
}

@DataBoundConstructor
public ArtifactDeployerEntry(String includes, String basedir, String excludes, String remote, boolean flatten, boolean deleteRemote, boolean deleteRemoteArtifacts, DeleteRemoteArtifactsByScriptModel deleteRemoteArtifactsByScript, boolean failNoFilesDeploy) {
public ArtifactDeployerEntry(String includes, String basedir, String excludes, String remote, boolean flatten, boolean deleteRemote, boolean deleteRemoteArtifacts, boolean failNoFilesDeploy) {
this.includes = includes;
this.basedir = basedir;
this.excludes = excludes;
this.remote = remote;
this.flatten = flatten;
this.deleteRemote = deleteRemote;
this.deleteRemoteArtifacts = deleteRemoteArtifacts;
//this.deleteRemoteArtifactsByScript = deleteRemoteArtifactsByScript;
//this.groovyExpression = groovyExpression;
if (deleteRemoteArtifactsByScript != null) {
this.deleteRemoteArtifactsByScript = true;
this.groovyExpression = deleteRemoteArtifactsByScript.getGroovyExpression();
} else {
this.deleteRemoteArtifactsByScript = false;
}
this.failNoFilesDeploy = failNoFilesDeploy;
}

Expand Down Expand Up @@ -115,14 +107,6 @@ public boolean isDeleteRemoteArtifacts() {
}

@SuppressWarnings("unused")
public boolean isDeleteRemoteArtifactsByScript() {
return StringUtils.isNotBlank(groovyExpression);
}

@SuppressWarnings("unused")
public String getGroovyExpression() {
return groovyExpression;
}

public boolean isFailNoFilesDeploy() {
return failNoFilesDeploy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,6 @@ public void onDeleted(AbstractBuild build) {
}

}

//Execute the script for deletion
if (entry.isDeleteRemoteArtifactsByScript()) {
//Inject list artifacts as variable
Binding binding = new Binding();
if (artifactDeployerBuildAction != null) {
List<ArtifactDeployerVO> listArtifacts = info.get(entry.getUniqueId());
binding.setVariable("ARTIFACTS", listArtifacts);
}
GroovyShell shell = new GroovyShell(binding);
shell.evaluate(entry.getGroovyExpression());
}
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,6 @@ THE SOFTWARE.
<label class="attach-previous">Delete remote artifacts when the build is deleted</label>
</f:entry>

<f:entry>
<table style="width:100%">
<f:optionalBlock
field="deleteRemoteArtifactsByScript"
name="artifactdeployer.entry.deleteRemoteArtifactsByScript"
checked="${instance.entry.deleteRemoteArtifactsByScript}"
title="${%Execute a groovy script when the job is deleted}">

<f:entry field="groovyExpression" title="${%Groovy Expression}">
<f:textarea name="artifactdeployer.entry.groovyExpression"
value="${instance.entry.groovyExpression}"/>
</f:entry>
</f:optionalBlock>
</table>
</f:entry>

</f:advanced>

</j:jelly>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,7 @@ THE SOFTWARE.
checked="${deployedArtifact.deleteRemoteArtifacts}"/>
<label class="attach-previous">Delete remote artifacts when the build is deleted</label>
</f:entry>

<f:entry>
<table style="width:100%">
<f:optionalBlock
field="deleteRemoteArtifactsByScript"
name="artifactdeployer.entry.deleteRemoteArtifactsByScript"
checked="${deployedArtifact.deleteRemoteArtifactsByScript}"
title="${%Execute a groovy script when the job is deleted}">

<f:entry field="groovyExpression" title="${%Groovy Expression}">
<f:textarea name="artifactdeployer.entry.groovyExpression"
value="${deployedArtifact.groovyExpression}"/>
</f:entry>
</f:optionalBlock>
</table>
</f:entry>


</f:advanced>

<f:entry title="">
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test

0 comments on commit 61e66e6

Please sign in to comment.