Skip to content

Commit

Permalink
Merge pull request #12 from jenkinsci/idos/trello_bugfix_2201_missing…
Browse files Browse the repository at this point in the history
…_custom_batch_id

Idos/trello bugfix 2201 missing custom batch
  • Loading branch information
itaibh authored Mar 14, 2023
2 parents 4673f27 + d152803 commit 2c9eda4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [vNext] - dNext
### Updated
- Check if using a custom batch id before archiving it. [Trello 2201](https://trello.com/c/B8KrpLpF)
- Update `jenkins.version` to version `2.361.4` as [recommended here](https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/).
- Update parent pom to `4.51`.
- Remove deprecated `java.level` property.
- Bump JobDSL to `1.72` to rely on non-vulnerable version.
- Rely on Jenkins core BOM for workflow plugins versions.

## [1.14] - 2023-02-27
### Fixed
- Fixed crash on newer Jenkins versions.
Expand Down
25 changes: 17 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.22</version>
<version>4.51</version>
<relativePath />
</parent>
<artifactId>applitools-eyes</artifactId>
Expand All @@ -30,11 +30,10 @@

<properties>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.22</jenkins.version>
<!-- 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>
<!-- Recommended version: https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.version>2.361.4</jenkins.version>
<!-- <= 1.71 vulnerable: https://www.jenkins.io/security/advisory/2019-03-06/#SECURITY-1342 -->
<plugins.job-dsl.version>1.72</plugins.job-dsl.version>
</properties>

<developers>
Expand All @@ -45,16 +44,26 @@
</developer>
</developers>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.303.x</artifactId>
<version>1409.v7659b_c072f18</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<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</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class ApplitoolsBuildWrapper extends BuildWrapper implements Serializable
public boolean notifyByCompletion;
public String applitoolsApiKey;

private static boolean isCustomBatchId = false;

static final Map<String, String> ARTIFACT_PATHS = new HashMap();

static {
Expand Down Expand Up @@ -67,7 +69,9 @@ public Environment setUp(final AbstractBuild build, final Launcher launcher, fin
return new Environment() {
@Override
public boolean tearDown(AbstractBuild build, BuildListener listener) throws IOException, InterruptedException {
build.pickArtifactManager().archive(build.getWorkspace(), launcher, listener, ARTIFACT_PATHS);
if (isCustomBatchId) {
build.pickArtifactManager().archive(build.getWorkspace(), launcher, listener, ARTIFACT_PATHS);
}
ApplitoolsCommon.closeBatch(build, listener, serverURL, notifyByCompletion, applitoolsApiKey);
return true;
}
Expand All @@ -92,8 +96,10 @@ public static Map<String, String> getApplitoolsArtifactList(AbstractBuild build,
Matcher m = ApplitoolsCommon.artifactRegexp.matcher(apath.getKey());
if (m.find()) {
applitoolsArtifacts.put(m.group(1), value);
isCustomBatchId = true;
}
} catch (IOException e) {
isCustomBatchId = false;
listener.getLogger().println(String.format("Custom BATCH_ID is not defined: %s", rootDir.child(apath.getValue())));
}
}
Expand Down

0 comments on commit 2c9eda4

Please sign in to comment.