Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Docker@2 arguments (VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) without quotes #19784

Open
4 of 7 tasks
mrlioncub opened this issue Apr 16, 2024 · 0 comments
Open
4 of 7 tasks

Comments

@mrlioncub
Copy link

mrlioncub commented Apr 16, 2024

New issue checklist

Task name

Docker@2

Task version

2.231.2

Issue Description

Docker@2 task removes quotes from the variable in the arguments

I tested with arguments:

  arguments: "--build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)'"
  arguments: '--build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS="$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)"'
  arguments: '--build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS=$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)'
  arguments: '--build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS=`$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)`'

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

Ubuntu 22.04

Relevant log output

Run:

/usr/bin/docker build -f /home/vsts/work/1/s/docker/Dockerfile --label com.azure.dev.image.system.teamfoundationcollectionuri=https://dev.azure.com/company/ --label com.azure.dev.image.build.sourceversion=9b1e77de8d765eeb2a63ac7377f37d1e0aaf3795 --build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{endpointCredentials:[{endpoint:https://nuget.domain.com/repository/nuget-group/index.json,username:***,password:***}]}' -t docker.domain.com/docker/docker:1.2.1.1 -t docker.domain.com/docker/docker:latest /home/vsts/work/1/s

Error:

MSBuild version 17.9.8+b34f75857 for .NET
#13 1.277   Determining projects to restore...
##[debug]Agent environment resources - Disk: / Available 18402.00 MB out of 74244.00 MB, Memory: Used 755.00 MB out of 6921.00 MB, CPU: Usage 20.80%
#13 1.943 [NuGet Manager] [Error]     [CredentialProvider]Failed to acquire session token: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: h. Path 'endpointCredentials[0].endpoint', line 1, position 33.
#13 1.943    at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
#13 1.949    at Newtonsoft.Json.JsonTextReader.ReadAsString()
#13 1.949    at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
#13 1.949    at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
#13 1.949    at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
#13 1.949    at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
#13 1.949    at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
#13 1.949    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
#13 1.949    at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
#13 1.949    at NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider.ParseJsonToDictionary()
#13 1.949    at NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider.<.ctor>b__3_0()
#13 1.949    at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
#13 1.949    at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
#13 1.949    at System.Lazy`1.CreateValue()
#13 1.949    at NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider.get_Credentials()
#13 1.949    at NuGetCredentialProvider.CredentialProviders.VstsBuildTaskServiceEndpoint.VstsBuildTaskServiceEndpointCredentialProvider.HandleRequestAsync(GetAuthenticationCredentialsRequest request, CancellationToken cancellationToken)
#13 1.949    at NuGetCredentialProvider.RequestHandlers.GetAuthenticationCredentialsRequestHandler.HandleRequestAsync(GetAuthenticationCredentialsRequest request)

Full task logs with system.debug enabled

##[debug]which '/usr/bin/docker'
##[debug]found: '/usr/bin/docker'
##[debug]/usr/bin/docker arg: build
##[debug]/usr/bin/docker arg: ["-f","/home/vsts/work/1/s/docker/Dockerfile"]
##[debug]/usr/bin/docker arg: ["--label","com.azure.dev.image.system.teamfoundationcollectionuri=[https://dev.azure.com/abycus/"](https://dev.azure.com/company/%22)]
##[debug]/usr/bin/docker arg: ["--label","com.azure.dev.image.build.sourceversion=9b1e77de8d765eeb2a63ac7377f37d1e0aaf3795"]
##[debug]/usr/bin/docker arg: --build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{"endpointCredentials":[{"endpoint":"[https://nuget.domain.com/repository/nuget/index.json","username":"***","password":***}]}'](https://nuget.domain.com/repository/nuget/index.json%22,%22username%22:%22***%22,%22password%22:***%7D]%7D') 

##[debug]buildContext=/home/vsts/work/1/s
##[debug]SYSTEM_DEFAULTWORKINGDIRECTORY=/home/vsts/work/1/s
##[debug]/usr/bin/docker arg: /home/vsts/work/1/s
##[debug]DOCKER_BUILDKIT=undefined
##[debug]DOCKER_HOST=undefined
##[debug]exec tool: /usr/bin/docker
##[debug]arguments:
##[debug]   build
##[debug]   -f
##[debug]   /home/vsts/work/1/s/docker/Dockerfile
##[debug]   --label
##[debug]   com.azure.dev.image.system.teamfoundationcollectionuri=https://dev.azure.com/company/
##[debug]   --label
##[debug]   com.azure.dev.image.build.sourceversion=9b1e77de8d765eeb2a63ac7377f37d1e0aaf3795
##[debug]   --build-arg
##[debug]   VSS_NUGET_EXTERNAL_FEED_ENDPOINTS='{endpointCredentials:[{endpoint:[https://nuget.domain.com/repository/nuget/index.json,username:***,password:***}]}'](https://nuget.domain.com/repository/nuget/index.json,username:***,password:***')

Repro steps

- task: Docker@2
  displayName: 'docker build'
  inputs:
    containerRegistry: 'docker'
    repository: 'docker/docker'
    command: 'build'
    Dockerfile: 'docker/Dockerfile'
    buildContext: '.'
    tags: |
      $(dockerTag)
      $(dockerTagAlias)
   arguments: '--build-arg VSS_NUGET_EXTERNAL_FEED_ENDPOINTS="$(VSS_NUGET_EXTERNAL_FEED_ENDPOINTS)"'
   addPipelineData: false
   addBaseImageData: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants