skip to Main Content

I’m trying to create a pipeline in Azure Devops for an API project in NET 7, but I’m getting build error everytime, even with a fresh project with the base example of WeatherForecast.
I tried with Docker Windows, and downgrading the version of NET using NET 6, but it won’t work either.

I tried with different accounts so it’s not an auth problem, not even a version of NET problem, I think that is generating the yaml file in the incorrect way, this is the version of the NET 6 with Docker Linux:

trigger:

- master

resources:

- repo: self

variables:

dockerRegistryServiceConnection: '3cdd4a4c-****-****-****-132c5f7c77c0'
imageRepository: '****'
containerRegistry: 'directiocontainers.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Test3Pipeline/Dockerfile'
tag: '$(Build.BuildId)'

vmImageName: 'ubuntu-latest'

stages:

- stage: Build
  displayName: Build and push stage
  jobs:
  - job: Build
    displayName: Build
    pool:
    vmImage: $(vmImageName)
    steps:
    - task: Docker@2
      displayName: Build and push an image to container registry
      inputs:
      command: buildAndPush
      repository: $(imageRepository)
      dockerfile: $(dockerfilePath)
      containerRegistry: $(dockerRegistryServiceConnection)
      tags: |
      $(tag)

2

Answers


  1. Chosen as BEST ANSWER
    That's the part that I think talks about the error:
    
    ##[error] > [build 3/7] COPY [Test3Pipeline/Test3Pipeline.csproj, Test3Pipeline/]:
    ##[debug]Processed: ##vso[task.issue type=error;] > [build 3/7] COPY [Test3Pipeline/Test3Pipeline.csproj, Test3Pipeline/]:
    ##[error]------
    ##[debug]Processed: ##vso[task.issue type=error;]------
    ##[error]Dockerfile:10
    ##[debug]Processed: ##vso[task.issue type=error;]Dockerfile:10
    ##[error]--------------------
    ##[debug]Processed: ##vso[task.issue type=error;]--------------------
    ##[error]   8 |     FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
    ##[debug]Processed: ##vso[task.issue type=error;]   8 |     FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
    ##[error]   9 |     WORKDIR /src
    ##[debug]Processed: ##vso[task.issue type=error;]   9 |     WORKDIR /src
    ##[error]  10 | >>> COPY ["Test3Pipeline/Test3Pipeline.csproj", "Test3Pipeline/"]
    ##[debug]Processed: ##vso[task.issue type=error;]  10 | >>> COPY ["Test3Pipeline/Test3Pipeline.csproj", "Test3Pipeline/"]
    ##[error]  11 |     RUN dotnet restore "Test3Pipeline/Test3Pipeline.csproj"
    ##[debug]Processed: ##vso[task.issue type=error;]  11 |     RUN dotnet restore "Test3Pipeline/Test3Pipeline.csproj"
    ##[error]  12 |     COPY . .
    ##[debug]Processed: ##vso[task.issue type=error;]  12 |     COPY . .
    ##[error]--------------------
    ##[debug]Processed: ##vso[task.issue type=error;]--------------------
    ##[error]ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref b3f67a6d-0f36-4371-8431-22933491e334::nknpqivautqy7baur4gwjtpwl: "/Test3Pipeline/Test3Pipeline.csproj": not found
    ##[debug]Processed: ##vso[task.issue type=error;]ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref b3f67a6d-0f36-4371-8431-22933491e334::nknpqivautqy7baur4gwjtpwl: "/Test3Pipeline/Test3Pipeline.csproj": not found
    ##[debug]Trying to logout from registry: ***
    ##[debug]DOCKER_CONFIG=/home/vsts/work/_temp/DockerConfig_1697038045208
    ##[debug]agent.tempDirectory=/home/vsts/work/_temp
    ##[debug]Found the Docker Config stored in the temp path. Docker config path: /home/vsts/work/_temp/DockerConfig_1697038045208/config.json, Docker config: {"auths": { "***": {"auth": "***", "email": "ServicePrincipal@AzureRM" } }, "HttpHeaders":{"X-Meta-Source-Client":"VSTS"} }
    ##[debug]Deleting Docker config directory. Path: /home/vsts/work/_temp/DockerConfig_1697038045208/config.json
    ##[debug]DOCKER_CONFIG=/home/vsts/work/_temp/DockerConfig_1697038045208
    ##[debug]agent.tempDirectory=/home/vsts/work/_temp
    ##[debug]Deleting Docker config directory. Path: /home/vsts/work/_temp/DockerConfig_1697038045208
    ##[debug]set DOCKER_CONFIG=
    ##[debug]Processed: ##vso[task.setvariable variable=DOCKER_CONFIG;isOutput=false;issecret=false;]
    ##[debug]task result: Failed
    ##[error]The process '/usr/bin/docker' failed with exit code 1
    ##[debug]Processed: ##vso[task.issue type=error;]The process '/usr/bin/docker' failed with exit code 1
    ##[debug]Processed: ##vso[task.complete result=Failed;]The process '/usr/bin/docker' failed with exit code 1
    

  2. Most likely your build context is incorrect, try adding

    buildContext: $(Build.SourcesDirectory)

    right under the

    containerRegistry: $(dockerRegistryServiceConnection)

    line of your yml pipeline file.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search