Hi all,

I am trying to update the Azure Artifact manager plugin 
<https://plugins.jenkins.io/azure-artifact-manager/> to be capable of using 
an Azure content delivery network (CDN) link for the produced artifacts 
available through Jenkins instead of the direct Azure blob storage links. 
The reason I am doing this is because downloads from the blob storage 
directly are throttled and downloads from the CDN are considerably faster, 
especially for geographically distributed users.

This is also my first time trying to modify a Jenkins plugin, so I do 
acknowledge a lack of knowledge in general Jenkins plugin development. That 
being said, I've been investigating the Azure Artifact Manager source code 
for a couple days and I've determined this:

   1. toExternalURL in the AzureBlobVirtualFile class 
   
<https://github.com/jenkinsci/azure-artifact-manager-plugin/blob/master/src/main/java/com/microsoft/jenkins/artifactmanager/AzureBlobVirtualFile.java#L189>,
 
   seems to be what determines the final link that users would see in Jenkins 
   to click upon that would download the blob artifact from the CDN. I removed 
   the "sas" variable from this URL and confirmed that the generated URL in 
   Jenkins that a user sees was missing the shared access signature and thus 
   inaccessible, so this confirmed it for me.
   2. I also know that, eventually, I would need to update the Azure 
   storage plugin <https://plugins.jenkins.io/windows-azure-storage/> to 
   take in a CDN URL through the Jenkins Azure Storage credential, do 
   validation on that URL, and then pass that URL into the Azure Artifact 
   Manager plugin

That being said, the first problem I am having is finding a way to manually 
change the external URL in the Azure Artifact Manager so that it uses the 
CDN URL instead of the blob storage URL to prove this is possible before I 
dive deeper into the Azure storage plugin and passing the credential around.

I've tried modifying the toExternalUrl method in the AzureBlobVirtualFile 
class by replacing the blob storage endpoint URL string with a manually 
input string of my CDN endpoint URL, but no matter what I try (except 
removing the '"sas" variable) I get a NullPointerException when trying to 
change the external URL string to anything other than a string that points 
to the blob storage endpoint URL:

   - java.lang.NullPointerException
      - at 
      
com.microsoftopentechnologies.windowsazurestorage.helper.AzureStorageAccount.convertToStorageAccountInfo(AzureStorageAccount.java:254)
      - at 
      
com.microsoft.jenkins.artifactmanager.Utils.getStorageAccount(Utils.java:90)
      - at 
      
com.microsoft.jenkins.artifactmanager.AzureArtifactManager.archive(AzureArtifactManager.java:123)
      - at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:258)
   
Does anyone have any ideas on where to go from here? All I really need to 
do is swap the endpoint URL link at the very end of the artifact archiving 
process so that the artifact link that shows in Jenkins points to the CDN 
URL instead of the blob storage URL.

Thanks!
Ian

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/432a78bf-c750-455b-aa5c-d1d01c09f3b9n%40googlegroups.com.

Reply via email to