Skip to content

Commit

Permalink
Merge pull request #5 from nikita-andreev/master
Browse files Browse the repository at this point in the history
Job DSL extension
  • Loading branch information
danielputerman authored Jul 29, 2019
2 parents 6a84069 + 0a85631 commit 3dee6a2
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 12 deletions.
27 changes: 17 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<!-- Java Level to use. Java 7 required when using core >= 1.612 -->
<java.level>7</java.level>
<plugins.workflow.version>1.15</plugins.workflow.version>
<plugins.job-dsl.version>1.52</plugins.job-dsl.version>
</properties>

<developers>
Expand All @@ -45,16 +46,22 @@
</developers>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>${plugins.workflow.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>${plugins.workflow.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>${plugins.workflow.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>${plugins.workflow.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>job-dsl</artifactId>
<version>${plugins.job-dsl.version}</version>
<optional>true</optional>
</dependency>
</dependencies>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static void outputVariables(final TaskListener listener, Map<String, Stri
final String APPLITOOLS_BATCH_NAME = "BATCH_NAME";
final String APPLITOOLS_BATCH_ID = "BATCH_ID";
final String APPLITOOLS_PROJECT_SERVER_URL = "PROJECT_SERVER_URL";
final String APPLITOOLS_SEQUENCE_NAME = "SEQUENCE_NAME";
final String APPLITOOLS_BATCH_SEQUENCE = "BATCH_SEQUENCE";

listener.getLogger().println("Creating Applitools environment variables:");

Expand All @@ -30,7 +30,7 @@ public static void outputVariables(final TaskListener listener, Map<String, Stri
}

if (projectName != null) {
outputEnvironmentVariable(listener, env, APPLITOOLS_SEQUENCE_NAME, projectName, true);
outputEnvironmentVariable(listener, env, APPLITOOLS_BATCH_SEQUENCE, projectName, true);
}
}

Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/applitools/jenkins/ApplitoolsJobDsl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.applitools.jenkins;

import hudson.Extension;
import javaposse.jobdsl.dsl.helpers.wrapper.WrapperContext;
import javaposse.jobdsl.plugin.ContextExtensionPoint;
import javaposse.jobdsl.plugin.DslExtensionMethod;

@Extension(optional = true)
public class ApplitoolsJobDsl extends ContextExtensionPoint {
@DslExtensionMethod(context = WrapperContext.class)
public Object Applitools(String serverUrl) {
return new ApplitoolsBuildWrapper(serverUrl);
}

@DslExtensionMethod(context = WrapperContext.class)
public Object Applitools() {
return new ApplitoolsBuildWrapper(ApplitoolsCommon.APPLITOOLS_DEFAULT_URL);
}

}

0 comments on commit 3dee6a2

Please sign in to comment.