Select to view content in your preferred language

Caching dev version automation

555
6
Jump to solution
03-19-2025 11:19 AM
LondonWalker
Regular Contributor

I use automated deployments for my experiences and am trying to work on the service cache. I would rather not increment my release numbers manually and am hoping to do this in my pipeline. Has anyone automated this and be willing to share what they did? 

0 Kudos
1 Solution

Accepted Solutions
JunshanLiu
Esri Contributor

Hi @LondonWalker I think I got why the build number in your app is not increased. The build number is saved in a file, which name is download-times.json, in the app folder. In your script, you copy the apps to the "server/apps" folder so every time, it's a fresh new app. 

 

So, the fix should be you can change the number in the "download-times.json" before you copy the app.

View solution in original post

0 Kudos
6 Replies
JunshanLiu
Esri Contributor

Do you use this script https://developers.arcgis.com/experience-builder/guide/deployment-topics/#automated-deployments? I think the script will increase the number automatically.

0 Kudos
LondonWalker
Regular Contributor

I do, it does not

0 Kudos
JunshanLiu
Esri Contributor

Hi @LondonWalker I reverified, the build number will increase when you run the script. Could you double-check?

0 Kudos
LondonWalker
Regular Contributor

I am currently on number 23. I ran the script and checked again and it is still 23. Here is my yaml

trigger:
- main
jobs:
- job: Build
  pool: 
    vmImage: ubuntu-latest
  steps:
  - script: curl -o exb.zip "$(curl -s 'https://downloads.arcgis.com/dms/rest/download/secured/arcgis-experience-builder-1.16.zip?f=json&folder=software%2FExperienceBuilder%2F1.16' | python3 -c "import sys, json; print(json.load(sys.stdin)['url'])")"
    displayName: Download Experience Builder
    env:
      ARCGIS_LIB_DOWNLOADER_USERNAME: $(username)
      ARCGIS_LIB_DOWNLOADER_PASSWORD: $(password)
  - script: unzip -q exb.zip -d arcgis-experience-builder-1.16
    displayName: Unzip Experience Builder
  - script: cp -r widgets/* arcgis-experience-builder-1.16/ArcGISExperienceBuilder/client/your-extensions/widgets
    displayName: Copy Custom Widgets
  - script: mkdir public && cd public && mkdir apps && cd apps
    workingDirectory: arcgis-experience-builder-1.16/ArcGISExperienceBuilder/server
    displayName: Create App directory
  - script: cp -r apps/* arcgis-experience-builder-1.16/ArcGISExperienceBuilder/server/public/apps
    displayName: Copy apps
  - script: npm ci
    workingDirectory: arcgis-experience-builder-1.16/ArcGISExperienceBuilder/client
    displayName: NPM install client folder
  - script: npm ci
    displayName: NPM install in server folder
    workingDirectory: arcgis-experience-builder-1.16/ArcGISExperienceBuilder/server
  - script: npm run build:prod
    displayName: Build widgets
    workingDirectory: arcgis-experience-builder-1.16/ArcGISExperienceBuilder/client
  - script: node -e "require('./server/src/middlewares/dev/apps/app-download.js').zipApp('6', 'stateviewer.zip')"
    workingDirectory: arcgis-experience-builder-1.16/ArcGISExperienceBuilder
    displayName: Run download script
    env:
      NODE_ENV: production
  - script: unzip -q stateviewer.zip -d stateviewer
    workingDirectory: arcgis-experience-builder-1.16/ArcGISExperienceBuilder
    displayName: Unzip stateviewer zip
  - task: ArchiveFiles@2
    inputs:
      rootFolderOrFile: 'arcgis-experience-builder-1.16/ArcGISExperienceBuilder/stateviewer'
      includeRootFolder: false
      archiveType: 'zip'
      archiveFile: '$(Build.ArtifactStagingDirectory)/stateviewer.zip'
      replaceExistingArchive: true
  - task: PublishBuildArtifacts@1
    displayName: 'Push both compiled code (in build) and Nuget Package (in artifact) to BuildArtifact Container.'
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)/stateviewer.zip' #'$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'drop'

 

0 Kudos
JunshanLiu
Esri Contributor

Hi @LondonWalker I think I got why the build number in your app is not increased. The build number is saved in a file, which name is download-times.json, in the app folder. In your script, you copy the apps to the "server/apps" folder so every time, it's a fresh new app. 

 

So, the fix should be you can change the number in the "download-times.json" before you copy the app.

0 Kudos
LondonWalker
Regular Contributor

Thanks, this worked. I think I got confused because of this section https://developers.arcgis.com/experience-builder/guide/deployment-topics/#service-worker-cache

0 Kudos