Azure pipeline skips DownloadSecureFile task?

37 Views Asked by At

I created this azure-pipelines-regression.yaml file to run tasks in my Azure pipeline, it has those steps:

...... other scripts
- task: NodeTool@0
  inputs:
    versionSpec: '18'
  displayName: 'Install Node.js'

- script: |
    cd /home/vsts/work/1/s
    npm install --legacy-peer-deps
  displayName: 'npm install'

- script: |
    cd /home/vsts/work/1/s
    dir
  displayName: 'List contents 1'

- task: DownloadSecureFile@1
  displayName: 'Download env file'
  inputs:
    secureFile: '.env.local'

- script: |
    cd /home/vsts/work/1/s
    dir
  displayName: 'List contents 2'
...... other scripts

In the pipeline job there are all the steps except the Download env file step. I deliberately created the List contents 1 and List contents 2 steps and they showed in the job, so I'm sure the code change was pushed. Just the step in the middle was skipped? enter image description here

1

There are 1 best solutions below

0
Ziyang Liu-MSFT On

The DownloadSecureFile@1 task is not skipped but executed as a pre-job right after the initialization. enter image description here

Once downloaded, you can use the name value that is set on the task to reference the path to the secure file on the agent machine. For example, if the task is given the name mySecureFile, its path can be referenced in the pipeline as $(mySecureFile.secureFilePath).

- task: DownloadSecureFile@1
  name: mySecureFile
  displayName: 'Download env file'
  inputs:
    secureFile: '{secure file}'

- script: |
    echo The path of my secure file is : $(mySecureFile.secureFilePath)

The output is:

enter image description here