Select to view content in your preferred language

Allow use of commit hash in download-times.json to assist automated builds

462
1
03-05-2025 05:27 AM
Status: Open
Labels (2)
RyanTaylor
Occasional Contributor

As documented ArcGIS Experience Builder | Deployment you can manually rename cdn/x to cdn/y and update a couple references to bust the service worker cache. Alternatively you can increment the value in download-times.json file as well.

However, for CI/CD scenarios this is a bit cumbersome. It would be helpful if we could supply a git commit hash to use as the cache busting id. Some non-exhaustive suggestions.

  1. Either allow non-numeric ids in download-times.json or provide another file to write the preferred id
  2. Update app-download.js to accept another parameter, `cacheId: string` that specifies the id to use

With this in place more options are available to developers to assist busting cache in a repeatable way. Folks could use commit hash, commit tag, date format, a numeric sequence, or anything else suitable for their particular needs.

---

For anyone seeing this that needs a quick workaround for their CI, you can turn your git short hash into an unsigned integer and set that as they value in the download-times.json. The number will be incremented by 1 in the final output but this should work until there is official support for arbitrary strings of our making.

Here's an example in PowerShell

 

Write-Host "Busting cache..."
$gitHash = git rev-parse --short HEAD
$numHash = [uint32]"0x$gitHash"
$numHash | Set-Content $downloadTimesJsonFile -Force

 

 

1 Comment
TimWestern

I'm just now reading about CI/CD deployment, and I've seen two different ways that works.

Often the same folder is cleared, then deployed to on the host.   Some create a new folder per build name and repoint stuff (that seems tricky to me)

I know with Custom Widgets things getting cached can be frustrating at times.  I think updating one of the settings in manifest.json might have a cache busting impact, but  I have yet to prove that changing the version of the widget in the manifest does it reliabiliy.