Skip to content

Commit

Permalink
Add support for Azure CDN endpoint URL (#85)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jacomb <[email protected]>
  • Loading branch information
Minreaux and timja authored Dec 13, 2023
1 parent 9d1c33f commit 2b4c2c2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
9 changes: 4 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
<version>${changelist}</version>
<packaging>hpi</packaging>
<name>Azure Artifact Manager plugin</name>
<description>A Jenkins plugin to keep artifacts and Pipeline stashes in Azure storage.</description>

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.version>2.361.4</jenkins.version>
<jenkins.version>2.387.3</jenkins.version>
</properties>

<licenses>
Expand All @@ -30,8 +29,8 @@
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.361.x</artifactId>
<version>2102.v854b_fec19c92</version>
<artifactId>bom-2.387.x</artifactId>
<version>2543.vfb_1a_5fb_9496d</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -42,7 +41,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>windows-azure-storage</artifactId>
<version>386.v673495b0a5de</version>
<version>414.v87922b9c52e2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ public static String getBlobUrl(

BlobClient blob = container.getBlobClient(blobName);

return blob.getBlobUrl();
// Check if CDN endpoint exists and use CDN URL, otherwise use blob URL
String cdnEndpoint = storageAccount.getCdnEndPointURL();
if (!StringUtils.isBlank(cdnEndpoint)) {
return (cdnEndpoint + "/" + blob.getContainerName() + "/" + blob.getBlobName());

Check warning on line 108 in src/main/java/com/microsoft/jenkins/artifactmanager/Utils.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 106-108 are not covered by tests
} else {
return blob.getBlobUrl();
}
}

public static String generateBlobSASURL(
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/index.jelly
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?jelly escape-by-default='true'?>
<div>
Jenkins Azure artifact manager plugin
Jenkins Azure Artifact Manager plugin enables keeping artifacts and Pipeline stashes in Azure Blob storage.
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected static class TestEnvironment {
azureStorageAccountKey2 = TestEnvironment.loadFromEnv("AZURE_STORAGE_TEST_STORAGE_ACCOUNT_KEY2");

blobURL = Utils.DEF_BLOB_URL;
sampleStorageAccount = new StorageAccountInfo(azureStorageAccountName, azureStorageAccountKey1, blobURL);
sampleStorageAccount = new StorageAccountInfo(azureStorageAccountName, azureStorageAccountKey1, blobURL, "");
containerName = name;
shareName = name;
}
Expand Down

0 comments on commit 2b4c2c2

Please sign in to comment.