2

I have a Azure DevOps pipeline that automates user creation in salesforce. I am expecting the user details in an excel file, which is to be fed to the Azure DevOps pipeline as a pre-build parameter. However, I am not able to find a solution to it in Azure DevOps.

I had implemented this in Jenkins already using File parameter plugin in my previous projects. Does Azure DevOps has this capability?

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
B.T Anand
  • 549
  • 1
  • 13
  • 26

3 Answers3

1

After searching through various blogs and posts, I realized that there is no way to get this done directly in VSTS. However, I was able to get a work around for the same.

  1. I created a VSTS User story and uploaded my attachment there
  2. Using the Work Item ID, I used the work Item api to get the attachment ID.
  3. Using the attachment API I was able to write a python script to download this attachment as a part of a pre-step in the Pipeline. Then this was available to use through out my automation script.
B.T Anand
  • 549
  • 1
  • 13
  • 26
0

I don't think you can load a file before the build start and read the variables, but, you can add a task that read the variables from a file and put him in the beginning (the first step in your pipeline).

There are few extensions to read variable from a JSON file, for example: Json to Variable.

If you want to read from excel I think you should write a script that does it.

Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114
  • Thanks! I do have a script in place that converts excel to Json and then I use it for th further automation. However, these are self service CI/CD pipelines for non technical folks. My user will not know how to commit the excel into git or load it artifactory. Hence I wanted them to upload a file before the build like jenkins: (https://stackoverflow.com/questions/42224691/how-to-use-file-parameter-in-jenkins/42242113) – B.T Anand Apr 01 '20 at 14:56
  • 2
    @B.TAnand According to your scenario, if you want to upload a file before build, I am afraid that this is currently not possible in azure devops.You could add your request for this feature on our [UserVoice](https://developercommunity.visualstudio.com/content/idea/post.html?space=21) site. – Hugh Lin Apr 03 '20 at 06:23
  • @B.T Anand If Shayki's answer is helpful to you, would you please mark it as the answer.Or if you have any concern, feel free to share it here. – Hugh Lin Apr 14 '20 at 09:35
0

Using local hosted agent, you can publish artifact from local share, then move to i.e. ms-hosted agent and use it normally.

      - task: DownloadFileshareArtifacts@1
        inputs:
          filesharePath: '\\myhost\myshare\myfolder'
          artifactName: 'my-artifact'
          downloadPath: '$(System.ArtifactsDirectory)'
          parallelizationLimit: '8'

https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/download-fileshare-artifacts?view=azure-devops

Jakub Pawlinski
  • 442
  • 3
  • 16