Skip to content

Commit 2b4c2c2

Browse files
Minreauxtimja
andauthored
Add support for Azure CDN endpoint URL (#85)
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
1 parent 9d1c33f commit 2b4c2c2

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

pom.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
<version>${changelist}</version>
1313
<packaging>hpi</packaging>
1414
<name>Azure Artifact Manager plugin</name>
15-
<description>A Jenkins plugin to keep artifacts and Pipeline stashes in Azure storage.</description>
1615

1716
<properties>
1817
<changelist>999999-SNAPSHOT</changelist>
19-
<jenkins.version>2.361.4</jenkins.version>
18+
<jenkins.version>2.387.3</jenkins.version>
2019
</properties>
2120

2221
<licenses>
@@ -30,8 +29,8 @@
3029
<dependencies>
3130
<dependency>
3231
<groupId>io.jenkins.tools.bom</groupId>
33-
<artifactId>bom-2.361.x</artifactId>
34-
<version>2102.v854b_fec19c92</version>
32+
<artifactId>bom-2.387.x</artifactId>
33+
<version>2543.vfb_1a_5fb_9496d</version>
3534
<scope>import</scope>
3635
<type>pom</type>
3736
</dependency>
@@ -42,7 +41,7 @@
4241
<dependency>
4342
<groupId>org.jenkins-ci.plugins</groupId>
4443
<artifactId>windows-azure-storage</artifactId>
45-
<version>386.v673495b0a5de</version>
44+
<version>414.v87922b9c52e2</version>
4645
</dependency>
4746
<dependency>
4847
<groupId>org.jenkins-ci.plugins.workflow</groupId>

src/main/java/com/microsoft/jenkins/artifactmanager/Utils.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ public static String getBlobUrl(
102102

103103
BlobClient blob = container.getBlobClient(blobName);
104104

105-
return blob.getBlobUrl();
105+
// Check if CDN endpoint exists and use CDN URL, otherwise use blob URL
106+
String cdnEndpoint = storageAccount.getCdnEndPointURL();
107+
if (!StringUtils.isBlank(cdnEndpoint)) {
108+
return (cdnEndpoint + "/" + blob.getContainerName() + "/" + blob.getBlobName());
109+
} else {
110+
return blob.getBlobUrl();
111+
}
106112
}
107113

108114
public static String generateBlobSASURL(

src/main/resources/index.jelly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?jelly escape-by-default='true'?>
22
<div>
3-
Jenkins Azure artifact manager plugin
3+
Jenkins Azure Artifact Manager plugin enables keeping artifacts and Pipeline stashes in Azure Blob storage.
44
</div>

src/test/java/com/microsoft/jenkins/artifactmanager/IntegrationTests/IntegrationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected static class TestEnvironment {
4141
azureStorageAccountKey2 = TestEnvironment.loadFromEnv("AZURE_STORAGE_TEST_STORAGE_ACCOUNT_KEY2");
4242

4343
blobURL = Utils.DEF_BLOB_URL;
44-
sampleStorageAccount = new StorageAccountInfo(azureStorageAccountName, azureStorageAccountKey1, blobURL);
44+
sampleStorageAccount = new StorageAccountInfo(azureStorageAccountName, azureStorageAccountKey1, blobURL, "");
4545
containerName = name;
4646
shareName = name;
4747
}

0 commit comments

Comments
 (0)