My azure-pipelines.yml file
jobs:
- job: linux_bionic
displayName: 'Linux (Bionic)'
pool:
vmImage: 'Ubuntu 16.04'
steps:
- template: ci/docker.yml
parameters:
imageName: 'microsoft/dotnet:2.1-sdk-bionic'
environmentVariables: |
BUILD_CONFIG=Release
My ci/docker.yml
steps:
- bash: chmod 755 ./ci/*.sh
displayName: 'Ensure build script permissions'
- task: docker@0
displayName: Build
inputs:
action: 'Run an image'
imageName: ${{ parameters.imageName }}
volumes: |
$(Build.SourcesDirectory):/src
$(Build.BinariesDirectory):/build
envVars: ${{ parameters.environmentVariables }}
workDir: '/src'
containerCommand: '/src/ci/build.sh'
detached: false
in my build.sh i have dotnet build
command witch is supposed to restore packages from nuget.org and also from my private azure artifacts feed
<add key="MyFeed"
value="https://pkgs.dev.azure.com/MyOrg/_packaging/MyFeed/nuget/v3/index.json" />
This is a part of azure pipelines logs
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for /src/src/MyProj/MyProj.csproj...
/usr/share/dotnet/sdk/2.1.402/NuGet.targets(114,5): error : Unable to load the service index for source https://pkgs.dev.azure.com/MyOrg/_packaging/MyFeed/nuget/v3/index.json. [/src/MyProj.sln]
/usr/share/dotnet/sdk/2.1.402/NuGet.targets(114,5): error : Response status code does not indicate success: 401 (Unauthorized). [/src/MyProj.sln]
Build FAILED.
I think it's possible to add the feed's api key in nuget.config, i have it in my global nuget.config, but i don't want to check that in source control.
Is there any way to make the feed accessible from within the docker image, the same way it's accessible from within the build agent?
You can use the Azure Artifacts Credential Provider in your container along with the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS
environment variable to pass in the build's access token.