Accommodate Global Download for Build.ps1 in Sitecore Docker-Images repo

Global download or usage of CDN is in effect for Sitecore packages. This means that you don't need to provide Sitecore username and password to download SDN resources anywhere anymore -

As excited as this man above in the picture, but without shouting aloud, decided to make the  Docker Images  repo Build.ps1 compatible with global download. A screen shot of how Build.ps1 behaved before making the changes:

Without much ado: Forked the repo for making the necessary changes. Apart from a couple of modifications, I didn't have to flex much but excited that I could contribute to another open-source project this year. 

For beginners: Open-source projects are addictive. Once you do one, you will want to contribute more. Would advise to start with a minor change and you will understand what I mean.

Anyway, here are the changes I did for the  Docker Images  repo:

1. Modify Build.ps1 so that username and password is not needed anymore as params -


2. Next, while invoking the package download PS script, username and password not needed as params:

3. In the above two steps, the changes are made to the invocation, the actual call to the SDN url is in Invoke-PackageRestore.ps1 under C:\docker-images\build\modules\SitecoreImageBuilder\1.0.0\Public:

3.a Remove the params as they are not needed anymore:


3.b Remove username and password from the actual call to the SDN Url as well as the session logic:


That's it. Fire Build.ps1 from PowerShell and you don't need to provide the SitecoreUsername and SitecorePassword params anymore and the packages download happens without those params -

In action: .\Build.ps1 -Topology "xm", "xp" -SitecoreVersion "9.3.0"  -IncludeSpe -IncludeSxa


Important note: In order to ensure that the SDN url benefits from global downloads, use the cdn url instead of the old url. What this means is, the url must start with https://sitecoredev.azureedge.net instead of the old  https://dev.sitecore.net domain. 

Code in github repo fork. Try it out.

Comments

Popular Posts