Skip to content

Commit

Permalink
Bump jenkins core baseline (#146)
Browse files Browse the repository at this point in the history
* Bump jenkins core baseline

* Fix tests

* Rerun CI

* Remove unused var

* Restore test

* Small tweaks, trying to fix windows build

* Downgrade to compatible core version
  • Loading branch information
timja authored and gavinfish committed Apr 12, 2019
1 parent 49afafe commit feb0c47
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 36 deletions.
80 changes: 60 additions & 20 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.11</version>
<version>3.40</version>
</parent>


Expand All @@ -17,7 +17,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jenkins.version>1.651.3</jenkins.version>
<jenkins.version>2.89.4</jenkins.version>
<java.level>8</java.level>
<findbugs.failOnError>true</findbugs.failOnError>
<findbugs.excludeFilterFile>exclude-findbugs.xml</findbugs.excludeFilterFile>
Expand Down Expand Up @@ -47,9 +47,9 @@
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand All @@ -61,12 +61,6 @@
<artifactId>copyartifact</artifactId>
<version>1.38</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.7.1</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -76,7 +70,7 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
<version>1.11</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
Expand All @@ -92,7 +86,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>credentials</artifactId>
<version>2.1.5</version>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -103,18 +97,18 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>azure-commons</artifactId>
<version>${azure-commons.version}</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.6</version>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>4.11</version>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand All @@ -134,6 +128,51 @@
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>1.3.8</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci</groupId>
<artifactId>symbol-annotation</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.5</version>
</dependency>
</dependencies>
</dependencyManagement>

<scm>
<connection>scm:git:ssh://github.com/jenkinsci/windows-azure-storage-plugin.git</connection>
<developerConnection>scm:git:ssh://[email protected]/jenkinsci/windows-azure-storage-plugin.git
Expand Down Expand Up @@ -163,6 +202,7 @@
<artifactId>maven-hpi-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<minimumJavaVersion>1.8</minimumJavaVersion>
<pluginFirstClassLoader>true</pluginFirstClassLoader>
<maskClasses>
com.microsoft.azure.management.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ public String getValue() {
@Override
public Descriptor<AzureBlobMetadataPair> getDescriptor() {
Jenkins instance = Jenkins.getInstance();
if (instance == null) {
return null;
} else {
return instance.getDescriptor(getClass());
}
return instance.getDescriptor(getClass());
}

@Extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,7 @@ private String detectContentType(FilePath file) throws InterruptedException, IOE
@Override
public Descriptor<AzureBlobProperties> getDescriptor() {
Jenkins instance = Jenkins.getInstance();
if (instance == null) {
return null;
} else {
return instance.getDescriptor(getClass());
}
return instance.getDescriptor(getClass());
}

@Extension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.cloudbees.plugins.credentials.CredentialsStore;
import com.cloudbees.plugins.credentials.domains.Domain;
import com.microsoftopentechnologies.windowsazurestorage.beans.StorageAccountInfo;
import hudson.util.Secret;
import java.util.UUID;
import jenkins.model.Jenkins;
import org.junit.Before;
import org.junit.ClassRule;
Expand All @@ -19,6 +21,7 @@
import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

/**
* @author arroyc
Expand All @@ -30,15 +33,13 @@ public class AzureCredentialsTest {

private AzureCredentials azureCred;
private AzureCredentials.StorageAccountCredential stCred;
private Jenkins jenkinsInstance;

@ClassRule
public static JenkinsRule j = new JenkinsRule();

@Before
public void setUp() throws IOException {
jenkinsInstance = Jenkins.getInstance();
azureCred = new AzureCredentials(CredentialsScope.GLOBAL, Utils.getMD5(stName.concat(stKey)), null, stName, stKey, stURL);
azureCred = new AzureCredentials(CredentialsScope.GLOBAL, UUID.randomUUID().toString(), null, stName, stKey, stURL);
stCred = new AzureCredentials.StorageAccountCredential(stName, stKey, stURL);
CredentialsStore s = CredentialsProvider.lookupStores(Jenkins.getInstance()).iterator().next();
s.addCredentials(Domain.global(), azureCred);
Expand All @@ -50,10 +51,11 @@ public void setUp() throws IOException {
@Test
public void testGetStorageAccountCredential() {
System.out.println("getStorageAccountCredential");
assertEquals(null, AzureCredentials.getStorageAccountCredential(null, null));
assertNull(AzureCredentials.getStorageAccountCredential(null, null));
String storageCredentialId = azureCred.getId();

AzureCredentials.StorageAccountCredential result = AzureCredentials.getStorageAccountCredential(null, storageCredentialId);
assert result != null;
assertEquals(stCred.getStorageAccountKey(), result.getStorageAccountKey());
assertEquals(stCred.getSecureKey(), result.getSecureKey());
assertEquals(stCred.getStorageAccountName(), result.getStorageAccountName());
Expand Down Expand Up @@ -92,7 +94,7 @@ public void testGetStorageAccountName() {
@Test
public void testGetStorageKey() {
System.out.println("getStorageKey");
assertEquals(stCred.getSecureKey().getEncryptedValue(), azureCred.getStorageKey());
assertEquals(stCred.getSecureKey().getPlainText(), Secret.decrypt(azureCred.getStorageKey()).getPlainText());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void testUpgradeStorageConfig() throws Exception {

assertEquals(u.getStorageAccountName(), storageCred.getStorageAccountName());
assertEquals(u.getEndpointURL(), storageCred.getBlobEndpointURL());
assertEquals(u.getSecureKey().getEncryptedValue(), storageCred.getStorageKey());
assertEquals(u.getSecureKey().getPlainText(), storageCred.getPlainStorageKey());

}

Expand Down

0 comments on commit feb0c47

Please sign in to comment.