1

In my build pipeline, I'm trying to run the below task: The main responsibility of the task is to mount the volume for Test and the Script from the AzDo to the container's working dir which is /app/ and then run the test(basically it will run npm test inside the container). But unfortunately, I don't see any outcomes. Hence I changed the command as ls -ltrR /app at the end of the docker run to check if the files are copied or not. But I see the directory is created but no files are inside.

So, to prove the files exist in $(System.DefaultWorkingDirectory) for AzDo. I tried to run all kinds of ls commands prior to docker-run which shows that the files do exist in the $(System.DefaultWorkingDirectory). But for some reason files are not mapped in docker containers. I tried to use PWD and $(Build.SourcesDirectory) but in all cases, it is not working.

I tried to replicate the same docker run command using in my local workstation, it works as expected. So, can anyone suggest how to mount the files in the docker run using AzDo build task?

- task: Bash@3
      inputs:
        targetType: 'inline'
        script: |
          echo "check in if Scripts and Tests file exists"
          ls -Rtlr ./Script
          cat ./Script/dev_blueprint_jest2/MyJavaScript.js
          ls -ltrR $PWD/Script
          ls -ltr $PWD/Test
          ls -ltrR $(Build.SourcesDirectory)/Script/
          docker run -v $(System.DefaultWorkingDirectory)/Script/:/app/ScriptStages/ -v $(System.DefaultWorkingDirectory)/Test/:/app/Test/ -i dockerimage ls -ltrR /app/
        workingDirectory: $(System.DefaultWorkingDirectory)
      displayName: 'Run the JS test pipeline.
change198
  • 1,647
  • 3
  • 21
  • 60
  • If possible, please check this thread:https://stackoverflow.com/questions/62025650/mount-repo-into-docker-image-when-running-yaml-pipeline-in-azure-devops – Joy Sep 16 '21 at 06:37
  • @joy I'm not using container steps however In my case i'm using Linux based agent, so I tried to hardcode the path `/home/vsts/work/1/s` in my bind mount volume. But still does not work. – change198 Sep 16 '21 at 08:31

0 Answers0