0
votes

I have created ASP.NET Core Pipeline for my project on Azure DevOps. And to successfully build it i need to download some dependent source repositories i have on github.

Need help with configuring the pipeline yaml that the dependend github sources. The file structure to build the project should be something like this:

Birko.Data // Github repo 
Birko.Data.Helper // Github repo 
Birko.Data.ElasticSearch // Github repo 
Affiliate  // Azure dev ops repo
  - project sources
  -.sln file

If I understand this correct all the sources are downloaded to the $(System.ArtifactsDirectory) so the Githubs repos need to be in parent directory?

pipeline definition YAML:

    trigger:
    - master

    pool:
      vmImage: 'windows-latest'

    variables:
      solution: '**/*.sln'
      buildPlatform: 'Any CPU'
      buildConfiguration: 'Release'

    steps:
    - task: DownloadGitHubRelease@0
      displayName: 'Chekout: Birko.Data'
      inputs:
        connection: 'birko-test'
        userRepository: 'birko/Birko.Data'
        defaultVersionType: 'latest'
        downloadPath: '$(System.ArtifactsDirectory)'

    - task: DownloadGitHubRelease@0
      displayName: 'Chekout: Birko.Data.Helper'
      inputs:
        connection: 'birko-test'
        userRepository: 'birko/Birko.Data.Helper'
        defaultVersionType: 'latest'
        downloadPath: '$(System.ArtifactsDirectory)'

    - task: DownloadGitHubRelease@0
      displayName: 'Chekout Birko.Data.ElasticSearch'
      inputs:
        connection: 'birko-test'
        userRepository: 'birko/Birko.Data.ElasticSearch'
        defaultVersionType: 'latest'
        downloadPath: '$(System.ArtifactsDirectory)'

    - task: NuGetToolInstaller@1

    - task: NuGetCommand@2
      inputs:
        restoreSolution: '$(solution)'

    - task: VSBuild@1
      inputs:
        solution: '$(solution)'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'

    - task: VSTest@2
      inputs:
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
1

1 Answers

1
votes

All the sources are download to $(Build.SourcesDirectory) that is the s folder in the agent (e.g. D:\a\1\s).

So if in your Azure DevOps repo you have multiple folders and files in the repository root you will get them in the folder s, and according to your structure you should download the GitHub repos to the parent folder. but, if in your Azure DevOps repo there is a one folder and in this folder there are more files and folders so in the s you will see only the folder (with sub folders and files), and in this case you need to download the GitHub repos to $(Build.SourcesDirectory).

If the first case is true I'm not recommended to download to the parent folder, maybe you need to consider to write a small PowerShell script that create a new folder in the s, move all the Azure DevOps files to there and then download to s the GitHub repos.