microsoft / artifacts-credprovider

The Azure Artifacts Credential Provider enables dotnet, NuGet.exe, and MSBuild to interactively acquire credentials for Azure Artifacts feeds.
MIT License
766 stars 705 forks source link

GitHub Actions Support for Cred Provider #261

Closed badgerowluke closed 3 years ago

badgerowluke commented 3 years ago

I'm getting 401'd when I try and run a simple dotnet restore -s ${{ secrets.AZ_ARTIFACTS }} step in a bash script from within my Github Action workflow. The same action executes a docker build just shiny. I'm hoping that someone can point me in the direction that gets the credential provider installed on the container executing my GHA workflow. Below is the relevant block of my Action, as well as the subsequent error:

      - name: az login
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZCLI_CREDS }}         

      - name: build test and release
        working-directory: whitewaterfinder.api.rivers
        env:
          NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED: true
          VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: '{"endpointCredentials": [{"endpoint":"${{ secrets.AZ_ARTIFACTS }}", "password": "${{ secrets.AZ_ARTIFACT_TOKEN }}"}]}'

        run: |
          dotnet restore -s ${{ secrets.AZ_ARTIFACTS }}
          dotnet build --no-restore --configuration Release
          dotnet test --no-build --verbosity normal
          dotnet publish --no-restore -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/rivers'

      - name: deploy to funtionapp
        uses: azure/webapps-deploy@v2
        with: 
          app-name: 'paddle-finder'
          package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/rivers'
  dotnet restore -s ***
3
  dotnet build --no-restore --configuration Release
4
  dotnet test --no-build --verbosity normal
5
  dotnet publish --no-restore -c Release -o '/rivers'
6
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail ***0***
7
  env:
8
    DOTNET_ROOT: /home/runner/.dotnet
9
    AZURE_HTTP_USER_AGENT: 
10
    AZUREPS_HOST_ENVIRONMENT: 
11
    NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED: true
12
    VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: ***"endpointCredentials": [***"endpoint":"***", "password": "***"***]***
14
  Determining projects to restore...
15
/home/runner/.dotnet/sdk/3.1.411/NuGet.targets(128,5): error : Unable to load the service index for source ***. [/home/runner/work/whitewaterfinder/whitewaterfinder/whitewaterfinder.api.rivers/whitewaterfinder.api.rivers.csproj]
16
/home/runner/.dotnet/sdk/3.1.411/NuGet.targets(128,5): error :   Response status code does not indicate success: 401 (Unauthorized). [/home/runner/work/whitewaterfinder/whitewaterfinder/whitewaterfinder.api.rivers/whitewaterfinder.api.rivers.csproj]
github-actions[bot] commented 3 years ago

In order to consolidate to fewer feedback channels, we've moved suggestions and issue reporting to Developer Community.

badgerowluke commented 3 years ago

so did this get auto-generated for me in the Developer Community?

badgerowluke commented 3 years ago

DC Link:

https://developercommunity.visualstudio.com/t/github-actions-support-for-cred-provider/1477894?from=email