microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.72k stars 864 forks source link

[BUG]: PublishPipelineArtifact - Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' #4339

Closed GMoody closed 1 year ago

GMoody commented 1 year ago

What happened?

Using following pipeline config (azure-pipelines.yml) and got stuck on PublishPipelineArtifact task that suppose to upload manifest files for the next Deploy step to AKS

Task from docs: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/publish-pipeline-artifact-v1?view=azure-pipelines

Mystery ID №1 (2a313f99-f039-49a7-b2dd-792d5ddab990) from logs leads here: https://github.com/Azure/azure-devops-cli-extension/blob/master/tests/recordings/test_build_definition_listShow.yaml

Myster ID №2 (dad8ea94-df27-42c0-ad9c-c6d61dc100a4) is a Resource group (VisualStudioOnline-DAD8EA94DF2742C0AD9CC6D61DC100A4) that reflects Azure DevOps organization linked to subscription (organization attached billing)

azure-pipelines.yml

  trigger:
  - master

  resources:
  - repo: self

  variables:
    dockerRegistryServiceConnection: '***'
    imageRepository: '***'
    containerRegistry: '***'
    tag: '$(Build.BuildId)'
    imagePullSecret: '***'
    vmImageName: 'ubuntu-latest'

  stages:
  - stage: Build
    displayName: Build & publish stage
    jobs:
    - job: Build
      displayName: Build & image publish
      pool:
        vmImage: $(vmImageName)
      steps:
      - task: Gradle@2
        inputs:
          workingDirectory: ''
          gradleWrapperFile: 'gradlew'
          gradleOptions: | 
            -Xmx3072m
            -DREGISTRY_USERNAME=$(REGISTRY_USERNAME)
            -DREGISTRY_PASSWORD=$(REGISTRY_PASSWORD)
          javaHomeOption: 'JDKVersion'
          jdkVersionOption: '1.17'
          jdkArchitectureOption: 'x64'
          publishJUnitResults: false
          testResultsFiles: '**/TEST-*.xml'
          tasks: 'build jib'
        env:
          REGISTRY_USERNAME: $(REGISTRY_USERNAME)
          REGISTRY_PASSWORD: $(REGISTRY_PASSWORD)

      - task: PublishPipelineArtifact@1
        inputs:
          artifactName: 'manifests'
          path: 'manifests'

  - stage: Deploy
    displayName: Deploy stage
    dependsOn: Build
    jobs:
    - deployment: Deploy
      displayName: Deploy
      pool:
        vmImage: $(vmImageName)
      environment: '***'
      strategy:
        runOnce:
          deploy:
            steps:
            - task: KubernetesManifest@0
              displayName: Create imagePullSecret
              inputs:
                action: createSecret
                secretName: $(imagePullSecret)
                dockerRegistryEndpoint: $(dockerRegistryServiceConnection)

            - task: KubernetesManifest@0
              displayName: Deploy to Kubernetes cluster
              inputs:
                action: deploy
                manifests: |
                  $(Pipeline.Workspace)/manifests/deployment.yml
                  $(Pipeline.Workspace)/manifests/service.yml
                imagePullSecrets: |
                  $(imagePullSecret)
                containers: |
                  $(containerRegistry)/$(imageRepository):$(tag)

Versions

Image: Ubuntu 22.04.2 LTS Agent: Hosted Agent Agent version: '3.220.5' Runner Image Provisioner version: '20230702.1.0'

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

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Azure DevOps Server Version (if applicable)

No response

Operation system

No response

Version controll system

No response

Relevant log output

##[debug]Evaluating condition for step: 'PublishPipelineArtifact'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
==============================================================================
Artifact name input: manifests
Uploading pipeline artifact from /home/vsts/work/1/s/manifests for build #6
Using default max parallelism.
Max dedup parallelism: 192
Verbose, ArtifactHttpClientFactory.CreateVssHttpClient: DedupStoreHttpClient with BaseUri: https://vsblobprodweu2.vsblob.visualstudio.com/Adad8ea94-df27-42c0-ad9c-c6d61dc100a4/, MaxRetries:5, SendTimeout:00:01:40
Information, ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session 4dce0909-c79c-43ac-9274-b65c6062ede7
Verbose, Started ITelemetrySender BlobStoreApplicationInsightsTelemetrySender.
Information, DedupManifestArtifactClient will correlate http requests with X-TFS-Session 4dce0909-c79c-43ac-9274-b65c6062ede7
Verbose, Globbing completed in: 00:00:00.0127504
Verbose, Pages to upload computed in 00:00:00.0061927
Information, 2 files processed.
Information, Processed 2 files from /home/vsts/work/1/s/manifests successfully.
Verbose, Trying to put node 9A*02 of 2 children, 0 receipts used. (Children: 92*01 [None], C0*01 [None])
Verbose, Added node 9A*02 of 2 children and got 1 receipts back. (Receipts: 9A*02 [2023-07-08T08:06:05Z])
Verbose, ManifestId: 8E*01
Verbose, ContentNode: 9A*02
Verbose, RootId: F5*02
Verbose, Trying to put node F5*02 of 2 children, 1 receipts used. (Children: 9A*02 [2023-07-08T08:06:05Z], 8E*01 [None])
Verbose, Added node F5*02 of 2 children and got 1 receipts back. (Receipts: F5*02 [2023-07-08T08:06:05Z])
Information, Uploaded 0 out of 885 bytes
Information, Content upload is done!
Information, 
Content upload statistics:
Total Content: 1.5 KB
Physical Content Uploaded: 0.0 bytes
Logical Content Uploaded: 0.0 bytes
Compression Saved: 0.0 bytes
Deduplication Saved: 1.5 KB
Number of Chunks Uploaded: 0
Total Number of Chunks: 5

##[debug]Processed: ##vso[telemetry.publish area=AzurePipelinesAgent;feature=PipelineArtifact]{"FileCount":"2","PlanId":"f8fd96f5-8bb1-45b7-ba9b-e521dd91b59a","JobId":"3dc8fd7e-4368-5a92-293e-d53cefc8c4b3","TaskInstanceId":"82bdd7ee-477c-57ce-c22f-e3c2a72854b8","ActionDurationMs":"1126","ActionName":"PipelineArtifact.UploadAsync","ActionResult":"Success","AttemptNumber":"1","ItemCount":"0","Level":"ThirdParty","CreatedUtcNow":"2023-07-05T09:20:49.5724916Z","SentUtcNow":"2023-07-05T09:20:50.7016511Z","BaseAddress":"https://vsblobprodweu2.vsblob.visualstudio.com/Adad8ea94-df27-42c0-ad9c-c6d61dc100a4/","X_TFS_Session":"4dce0909-c79c-43ac-9274-b65c6062ede7","DeploymentEnvironment":"PRODUCTION","DeploymentEnvironmentIsProduction":"True","VSOAccount":"vsblobprodweu2","OSName":"Linux","OSVersion":"2023","FrameworkDescription":".NET ","ProcessName":"Agent.PluginHost","DotNetReleaseDword":"-1","Version":"19.212.33005.0","ExceptionCount":"0"}
Verbose, ApplicationInsightsTelemetrySender sent PipelineArtifact.UploadAsync telemetry
Verbose, ApplicationInsightsTelemetrySender sent DedupUpload.UploadAsync telemetry
[] Try 1/3, non-retryable exception caught. Throwing. Details:
No LastRequestResponse on exception VssServiceException: Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' from host'dad8ea94-df27-42c0-ad9c-c6d61dc100a4'. Please ensure the service is registered with the Shared Platform Service. Microsoft.VisualStudio.Services.Common.VssServiceException: Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' from host'dad8ea94-df27-42c0-ad9c-c6d61dc100a4'. Please ensure the service is registered with the Shared Platform Service.
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Agent.Plugins.BuildServer.AssociateArtifactAsync(Guid projectId, Int32 pipelineId, String name, String jobId, String type, String data, Dictionary`2 propertiesDictionary, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/Agent.Plugins/Artifact/BuildServer.cs:line 49
   at Agent.Plugins.PipelineArtifactServer.<>c__DisplayClass2_1.<<UploadAsync>b__5>d.MoveNext() in /home/vsts/work/1/s/src/Agent.Plugins/Artifact/PipelineArtifactServer.cs:line 91
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.Services.Content.Common.AsyncHttpRetryHelper`1.InvokeAsync(CancellationToken cancellationToken)
Verbose, ApplicationInsightsTelemetrySender waiting for 0 of 2 TrackEvent operations to complete...
Verbose, ApplicationInsightsTelemetrySender operations completed in 0 ms
Information, ApplicationInsightsTelemetrySender correlated 2 events with X-TFS-Session 4dce0909-c79c-43ac-9274-b65c6062ede7
Verbose, Stopped ITelemetrySender BlobStoreApplicationInsightsTelemetrySender.
##[error]Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' from host'dad8ea94-df27-42c0-ad9c-c6d61dc100a4'. Please ensure the service is registered with the Shared Platform Service.
##[debug]Processed: ##vso[task.logissue type=error;]Could not find service '2a313f99-f039-49a7-b2dd-792d5ddab990' from host'dad8ea94-df27-42c0-ad9c-c6d61dc100a4'. Please ensure the service is registered with the Shared Platform Service.
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug]   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.HandleResponseAsync(HttpResponseMessage response, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Microsoft.TeamFoundation.Build.WebApi.BuildHttpClientCompatBase.SendAsync[T](HttpMethod method, IEnumerable`1 additionalHeaders, Guid locationId, Object routeValues, ApiResourceVersion version, HttpContent content, IEnumerable`1 queryParameters, Object userState, CancellationToken cancellationToken, Func`3 processResponse)
   at Agent.Plugins.BuildServer.AssociateArtifactAsync(Guid projectId, Int32 pipelineId, String name, String jobId, String type, String data, Dictionary`2 propertiesDictionary, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/Agent.Plugins/Artifact/BuildServer.cs:line 49
   at Agent.Plugins.PipelineArtifactServer.<>c__DisplayClass2_1.<<UploadAsync>b__5>d.MoveNext() in /home/vsts/work/1/s/src/Agent.Plugins/Artifact/PipelineArtifactServer.cs:line 91
--- End of stack trace from previous location ---
   at Microsoft.VisualStudio.Services.Content.Common.AsyncHttpRetryHelper`1.InvokeAsync(CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Services.Content.Common.ExceptionExtensions.ReThrow(Exception ex)
   at Microsoft.VisualStudio.Services.Content.Common.AsyncHttpRetryHelper`1.InvokeAsync(CancellationToken cancellationToken)
   at Agent.Plugins.PipelineArtifactServer.UploadAsync(AgentTaskPluginExecutionContext context, Guid projectId, Int32 pipelineId, String name, String source, IDictionary`2 properties, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/Agent.Plugins/Artifact/PipelineArtifactServer.cs:line 88
   at Agent.Plugins.PipelineArtifact.PublishPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token) in /home/vsts/work/1/s/src/Agent.Plugins/PipelineArtifact/PipelineArtifactPluginV1.cs:line 146
   at Agent.PluginHost.Program.Main(String[] args) in /home/vsts/work/1/s/src/Agent.PluginHost/Program.cs:line 71
Finishing: PublishPipelineArtifact
wortner commented 1 year ago

@GMoody did you resolve the issue? If so how? We are hitting the same. Probably something with Telemetry, but I don't get why it fails the stage, the artifact is successfully uploaded.