Hello i tried to use SFDX in azure devops pipeline and use a cached npm (sfdx + plugins) from this solution https://learn.microsoft.com/en-us/azure/devops/pipelines/release/caching?view=azure-devops
But after cache reuse and try to install there is no command available. And got error when running pipeline about command not found
I can install this using npm install sfdx-cli
but this cost more pipeline minutes so i tried to limit that
Here is a error which i got when use a cached npm :
/home/vsts/work/_temp/0ffaa6e5-b953-41a4-a173-5ce1ba6b11f3.sh: line 1: sfdx: command not found
i tried use a npm ci --config $(npm_config_cache) --loglevel verbose
but this is not working too :(
Here is sample pipeline which im using:
jobs:
- job: Validate
displayName: Validate
pool:
vmImage: 'ubuntu-latest'
variables:
npm_config_cache: $(Pipeline.Workspace)/.npm
steps:
- task: DownloadSecureFile@1
name: SalesforceToken
displayName: 'Download auth file for SFDX'
inputs:
secureFile: ${{ parameters.tokenName }}
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | ./package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
path: $(npm_config_cache)
displayName: "Cache npm"
- task: Npm@1
inputs:
command: 'install'
workingDir: '.'
- script: |
if ! command -v sfdx &> /dev/null
then
exit 0
else
echo "SFDX installed."
fi
displayName: "Check SFDX"