0

My understanding of building 2GMP validated version was that validation already checks if upgrade flow is working fine, but to my great surprize on this weekend, the validation and successful build of released managed package version does not guarantee the successful upgrade from the previous package version to the new one.

I received the following error on package upgrade which wasn't detected when package version was created and validated.

ERROR running force:package:install: Installation errors:

  1. (approvers) lwc/approvers/approvers.js-meta.xml: You can't remove the property tag named 'defaultCollapsed,displayHeader' specified in targetConfig lightning__RecordPage. The component is part of a managed package. lwc/approvers/approvers.js-meta.xml: You can’t remove the following public properties: recordId,objectApiName,displayHeader,defaultCollapsed, because the component is part of a managed package., Details: approvers: lwc/approvers/approvers.js-meta.xml: You can't remove the property tag named 'defaultCollapsed,displayHeader' specified in targetConfig lightning__RecordPage. The component is part of a managed package. lwc/approvers/approvers.js-meta.xml: You can’t remove the following public properties: recordId,objectApiName,display

How can I prevent such upgrade fail scenario blocker issues in the future?

1 Answer 1

0

I build specific CI flow to test and verify the upgrade flow.

The new job in CI process does the following thing:

  1. Install the last released package version into scratch org environment.
  2. Install the last build beta package version into the same environment to upgrade.
  3. Fail the CI workflow if the upgrade was not successful.
  4. Delete the scratch org.

I used the following jobs in the Github Actions CI to implement the step 2 and 3.

  - name: "Install Previous Package Version to Dev"
    id: "installOld"
    run: |
      cd src/packaged
      pid=$(sfdx force:package:version:list -p MyPackageName -r --concise -o MinorVersion --json  | jq '.result [-1].SubscriberPackageVersionId ' -r)
      echo "PID: $pid"

      version=$(sfdx force:package:version:list -r  --json | jq ".result [] | select(.SubscriberPackageVersionId==\"$pid\") .Version" -r)
      echo "version: $version"

      username=$(sfdx force:org:display --json | jq '.result.username' -r)
      echo "Username = $username"
      echo "Last part is ${username##*.}"

      echo $(sfdx force:package:install -p $pid -r --json) > install.txt
      v=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.status')
      s=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.result.Status')
      echo "status=$v"
      echo "Result.Status=$s"
      while [[ ($v == 0) && ($s == '"IN_PROGRESS"') ]]
      do 
          sleep 10
          v=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.status')
          s=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.result.Status')
          echo "status=$v"
          echo "Result.Status=$s"
      done
      if [[ ($v == 0) && ($s == '"SUCCESS"')]] 
      then 
          echo "Installed successfully"
          echo "::set-output name=success::true"
          result="Latest Managed Beta version $version with subscriber install id $pid was installed into ${username##*.} sandbox ($username)"
      


          sandbox=${username##*.}
          echo "Sandbox : $sandbox"
          
      fi
      if [[ ($v != 0) || ($s != '"SUCCESS"') ]] 
      then 
          echo "Install failed"
          m=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.message' -r)
          echo "Error message: $m"
          echo "::set-output name=success::false"
          mx=$(echo $m | tr '\n' ' ')
          result="Install of the latest Managed Beta version $version with subscriber install id $pid into ${username##*.} sandbox ($username) failed with errors $mx"
      fi
      
      echo "::set-output name=result::$result"
      sandbox=${username##*.}
      echo "::set-output name=sandbox::$sandbox"

  - name: "Install Package Version to Dev"
    id: "install"
    run: |
      cd src/packaged
      pid="${{needs.create-package-version.outputs.pid}}"
      echo "Pid of the created package version: $pid"

      version=$(sfdx force:package:version:list -c 1  --json | jq ".result [] | select(.SubscriberPackageVersionId==\"$pid\") .Version" -r)
      echo "version: $version"

      username=$(sfdx force:org:display --json | jq '.result.username' -r)
      echo "Username = $username"
      echo "Last part is ${username##*.}"

      echo $(sfdx force:package:install -p $pid -r --json) > install.txt
      v=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.status')
      s=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.result.Status')
      echo "status=$v"
      echo "Result.Status=$s"
      while [[ ($v == 0) && ($s == '"IN_PROGRESS"') ]]
      do 
          sleep 10
          v=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.status')
          s=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.result.Status')
          echo "status=$v"
          echo "Result.Status=$s"
      done
      if [[ ($v == 0) && ($s == '"SUCCESS"')]] 
      then 
          echo "Installed successfully"
          echo "::set-output name=success::true"
          result="Latest Managed Beta version $version with subscriber install id $pid was installed into ${username##*.} sandbox ($username)"
      

          sandbox=${username##*.}
          echo "Sandbox : $sandbox"
          
      fi
      if [[ ($v != 0) || ($s != '"SUCCESS"') ]] 
      then 
          echo "Install failed"
          m=$(sfdx force:package:install:report -i $(cat install.txt | jq '.result.Id' -r)  --json | jq '.message' -r)
          echo "Error message: $m"
          echo "::set-output name=success::false"
          mx=$(echo $m | tr '\n' ' ')
          result="Install of the latest Managed Beta version $version with subscriber install id $pid into ${username##*.} sandbox ($username) failed with errors $mx"
      fi
      
      echo "::set-output name=result::$result"
      sandbox=${username##*.}
      echo "::set-output name=sandbox::$sandbox"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .