TeamCity run step in docker



  • I'm trying to set up TeamCity to run tests on a .NET project. I have installed TeamCity and its agent (with access to docker) using docker compose :

      teamcity:
        image: jetbrains/teamcity-server
        container_name: teamcity
        volumes:
         - /home/arsene/teamcity/data:/data/teamcity_server/datadir
         - /home/arsene/teamcity/logs:/opt/teamcity/logs
        environment:
          - TEAMCITY_HTTPS_PROXY_ENABLED=true
        labels:
          - traefik.http.routers.teamcity.rule=Host(`myhost`)
          - traefik.http.routers.teamcity.tls=true
          - traefik.http.routers.teamcity.tls.certresolver=le   
          - traefik.http.services.teamcity.loadbalancer.server.port=8111
    

    teamcityagent:
    image: jetbrains/teamcity-agent
    container_name: teamcityagent
    volumes:
    - /home/arsene/teamcity/agent:/data/teamcity_agent/conf
    - /var/run/docker.sock:/var/run/docker.sock
    - /opt/buildagent/work:/opt/buildagent/work
    - /opt/buildagent/temp:/opt/buildagent/temp
    environment:
    - AGENT_NAME=TeamCityRunner
    - SERVER_URL=myhost
    - DOCKER_IN_DOCKER=start
    privileged: true

    When I configure my project I select the following config :

    TeamCity Config

    TeamCity Config

    But my build fail with very few detail about whats wrong.

    Step 1/2: Test (.NET)
      Running step within Docker container mcr.microsoft.com/dotnet/sdk:5.0
      dotnet test
        Starting: .NET SDK 5.0.408 /usr/bin/dotnet test /opt/buildagent/work/e83eb8da5bf3868c/ImPresent.Tests/ImPresent.Tests.csproj @/opt/buildagent/temp/agentTmp/1.rsp
        in directory: /opt/buildagent/work/e83eb8da5bf3868c
        MSBUILD : error MSB1021: Cannot create an instance of the logger. The given assembly name or codebase was invalid. (0x80131047)
        Switch: TeamCity.MSBuild.Logger.TeamCityMSBuildLogger,/opt/buildagent/plugins/dotnet/tools/msbuild15/TeamCity.MSBuild.Logger.dll;TeamCity;plain
        Process exited with code 1
        Process exited with code 1 (Step: Test (.NET))
      Step Test (.NET) failed
    

    Do you have any idea of what could be wrong, or how to check logs the have more details ? I ran my tests in the same container on my desktop, they pass.



  • Two things I would try:

    1. Add "Build" Step before testing:

      Runner Type: .NET.

      Command: build.

      Also it may be required to add another build configuration to Restore the project before build.

    2. Execute this build step in "verbose" mode to get more logging information.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2