Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'JENKINS-50726' of github.com:jenkinsci/artifact-manager…
…-s3-plugin into JENKINS-50726
  • Loading branch information
kuisathaverat committed Jun 8, 2018
2 parents ff7085e + 7a20887 commit d248a1f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 61 deletions.
79 changes: 24 additions & 55 deletions pom.xml
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.13</version>
<version>3.14</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -16,7 +16,7 @@
<properties>
<revision>1.0-alpha-1</revision>
<changelist>-SNAPSHOT</changelist>
<jclouds.version>2.0.3</jclouds.version>
<jclouds.version>2.1.0</jclouds.version>
<jenkins.version>2.121</jenkins.version>
<java.level>8</java.level>
<workflow-api-plugin.version>2.28-rc343.e9b9e0610374</workflow-api-plugin.version> <!-- TODO https://github.com/jenkinsci/workflow-api-plugin/pull/67 -->
Expand All @@ -41,29 +41,11 @@
</scm>

<dependencies>
<!-- shaded jclouds by the jclouds plugin -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jclouds-shaded</artifactId>
<version>2.14</version>
<exclusions>
<!--
<exclusion>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-multibindings</artifactId>
</exclusion>
-->
</exclusions>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>aws-s3</artifactId>
<version>${jclouds.version}</version>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>aws-java-sdk</artifactId>
Expand All @@ -74,14 +56,7 @@
<artifactId>apache-httpcomponents-client-4-api</artifactId>
<version>4.5.5-2.2-rc32.4a9f3bcc3908</version> <!-- TODO https://github.com/jenkinsci/apache-httpcomponents-client-4-api-plugin/pull/9 -->
</dependency>
<!--
<dependency>
<groupId>org.apache.jclouds.provider</groupId>
<artifactId>aws-s3</artifactId>
<version>${jclouds.version}</version>
</dependency>
-->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.8.9</version>
Expand Down Expand Up @@ -143,7 +118,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.53</version>
<version>2.54-rc730.05bb1322341d</version> <!-- TODO https://github.com/jenkinsci/workflow-cps-plugin/pull/231 -->
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -167,6 +142,22 @@
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>${jenkins-core.version}</version>
<exclusions>
<exclusion> <!-- JENKINS-50520: pick up 18 from jclouds, which needs at least TypeToken (12+) -->
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <!-- JENKINS-50520: picked up from jclouds; to match the Guice version in core -->
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-assistedinject</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
Expand All @@ -177,11 +168,6 @@
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
Expand All @@ -205,29 +191,12 @@

<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>display-info</id>
<configuration>
<rules>
<requireUpperBoundDeps>
<excludes combine.children="append">
<exclude>com.google.inject:guice</exclude> <!-- TODO jclouds classpath hell -->
</excludes>
</requireUpperBoundDeps>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
<configuration>
<pluginFirstClassLoader>true</pluginFirstClassLoader>
<!-- JENKINS-50520: since we need a custom version of Guava -->
<maskClasses>com.google.common.</maskClasses>
</configuration>
</plugin>

Expand Down
Expand Up @@ -60,7 +60,7 @@
import hudson.Extension;
import io.jenkins.plugins.artifact_manager_jclouds.BlobStoreProvider;
import io.jenkins.plugins.artifact_manager_jclouds.BlobStoreProviderDescriptor;
import shaded.com.google.common.base.Supplier;
import com.google.common.base.Supplier;

/**
* Extension that customizes JCloudsBlobStore for AWS S3. Credentials are fetched from the environment, env vars, aws
Expand Down
Expand Up @@ -283,7 +283,10 @@ public String getSeparator() {

}

/** @see <a href="https://issues.apache.org/jira/browse/JCLOUDS-1422">JCLOUDS-1422</a> */
/**
* TODO delete when updating to 2.1.1 or 2.2.0
* @see <a href="https://issues.apache.org/jira/browse/JCLOUDS-1422">JCLOUDS-1422</a>
*/
public static final class PatchedLocalBlobStore implements BlobStore {

private final LocalBlobStore delegate;
Expand Down
Expand Up @@ -47,6 +47,7 @@
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.BuildWatcher;
Expand Down Expand Up @@ -323,18 +324,29 @@ public void interruptedListing() throws Exception {
r.assertLogContains(new TimeoutStepExecution.ExceededTimeout().getShortDescription(), r.assertBuildStatus(Result.ABORTED, p.scheduleBuild2(0)));
}

@Ignore("TODO JENKINS-51779 Iterators.skip linkage error since Guava 18 is in test classpath")
@Test
public void errorCleaning() throws Exception {
public void errorCleaningArtifacts() throws Exception {
loggerRule.record(WorkflowRun.class, Level.WARNING).capture(10);
WorkflowJob p = r.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("node('remote') {writeFile file: 'f', text: '.'; archiveArtifacts 'f'; stash 'stuff'}", true));
MockApiMetadata.handleRemoveBlob("container", "p/1/stashes/stuff.tgz", () -> {throw new ContainerNotFoundException("container", "sorry about your stashes");});
p.setDefinition(new CpsFlowDefinition("node('remote') {writeFile file: 'f', text: '.'; archiveArtifacts 'f'}", true));
r.buildAndAssertSuccess(p);
p.setBuildDiscarder(new LogRotator(-1, -1, -1, 0));
MockApiMetadata.handleRemoveBlob("container", "p/1/artifacts/f", () -> {throw new ContainerNotFoundException("container", "sorry about your artifacts");});
r.buildAndAssertSuccess(p);
assertThat(loggerRule.getRecords().stream().map(LogRecord::getThrown).filter(Objects::nonNull).map(Throwables::getRootCause).map(Throwable::getMessage).collect(Collectors.toSet()),
containsInAnyOrder("container not found: sorry about your stashes", "container not found: sorry about your artifacts"));
containsInAnyOrder("container not found: sorry about your artifacts"));
}

@Test
public void errorCleaningStashes() throws Exception {
loggerRule.record(WorkflowRun.class, Level.WARNING).capture(10);
WorkflowJob p = r.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("node('remote') {writeFile file: 'f', text: '.'; stash 'stuff'}", true));
MockApiMetadata.handleRemoveBlob("container", "p/1/stashes/stuff.tgz", () -> {throw new ContainerNotFoundException("container", "sorry about your stashes");});
r.buildAndAssertSuccess(p);
assertThat(loggerRule.getRecords().stream().map(LogRecord::getThrown).filter(Objects::nonNull).map(Throwables::getRootCause).map(Throwable::getMessage).collect(Collectors.toSet()),
containsInAnyOrder("container not found: sorry about your stashes"));
}

// Interrupts probably never delivered during HTTP requests (maybe depends on servlet container?).
Expand Down

0 comments on commit d248a1f

Please sign in to comment.