Giter Site home page Giter Site logo

jetbrains / teamcity-docker-agent Goto Github PK

View Code? Open in Web Editor NEW
76.0 20.0 64.0 68 KB

TeamCity agent docker image sources

Home Page: https://hub.docker.com/r/jetbrains/teamcity-agent/

License: Apache License 2.0

Shell 0.70% PowerShell 1.26% Dockerfile 98.04%
teamcity teamcity-agent docker-image

teamcity-docker-agent's Introduction

official JetBrains project jetbrains/teamcity-agent

DEPRECATED TeamCity Agent Image Dockerfile

⛔ This repository is no longer supported, please consider using teamcity-docker-images instead.

This project contains the Dockerfiles and all necessary scripts to build the Linux and Windows Docker images and run a TeamCity Build Agent inside the container.

You can pull the ready-to-use image from the Docker Hub repository

docker pull jetbrains/teamcity-agent

If you need to build your own image, you need to perform the following:

  1. Pull our minimal agent image and re-tag it
docker pull jetbrains/teamcity-minimal-agent
docker tag jetbrains/teamcity-minimal-agent teamcity-minimal-agent

If you want to start with your own base agent image, see our instructions on how to build it. If you change the operation system, update the following line in the in Dockerfile appropriately:

apt-get install -y docker-engine=1.13.0-0~ubuntu-xenial
  1. Run the docker build command:
docker build -t teamcity-agent

See our detailed instructions on how to use the image in the Docker Hub repository.

Expose docker engine to container

Common way:

  • docker run ... -e DOCKER_HOST=tcp://%docker-host%:%port%

Linux hosts:

  • docker run ... -v /var/run/docker.sock:/var/run/docker.sock
  • docker run ... --privileged -e DOCKER_IN_DOCKER=start

Windows hosts:

  • docker run ... -v //var/run/docker.sock:/var/run/docker.sock (In Linux containers mode)
  • docker run ... -v \\.\pipe\docker_engine:\\.\pipe\docker_engine (For Windows Containers 1709+)
  • docker run ... -v /var/run/docker.sock:/var/run/docker.sock (via WSL & npiperelay in LCOW mode on Windows 1803+)

teamcity-docker-agent's People

Contributors

dimyriy avatar dmitry-treskunov avatar dtretyakov avatar julia-alexandrova avatar kir avatar ludeknovy avatar pavelsher avatar shkate avatar stayclassychicago avatar vladrassokhin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

teamcity-docker-agent's Issues

NUGET_XMLDOC_MODE=skip has consequences and is not recommended by TeamCity documentation.

The Dockerfile sets NUGET_XMLDOC_MODE=skip. I can see that this would help performance. However, I can find no general TeamCity documentation that advises making this change on build agents. Therefore it would seem likely that this is not set on most users' non-Docker-based agents. And so it seems odd that it would be set on the Docker image, which, arguably, should represent the typical agent configuration that a user would have created by hand following the best practices advocated by the relevant TeamCity documentation.

In our case, we have a custom code generation tool (consumed as a NuGet package) that, among other things, mirrors documentation from base classes into overridden methods in the generated classes - and the XML documentation files are needed for this. So this setting breaks our builds.

Issues trying to build ubuntu Docker Image

Since the shell script referenced while building dockerfile is one level up we are having issues building the docker image.
We should probably move run-docker.sh in the ubuntu folder.

Update docker-engine

Please, update Docker. Your current version is outdated (little) and doesn't support commands like cat /data/teamcity_agent/conf/gcloud.service-key | docker login -u _json_key --password-stdin https://gcr.io

Questions related to updating to Ubuntu 18.04

Hi! I'd like to run a teamcity agent based on Ubuntu 18.04. I cloned each of teamcity-minimal-agent and this repo, move ubuntu/Dockerfile to the root of each repo and delete all other dirs, then updated the dockerfile to use biomic and such.

Building this repo's image failed, as systemd was not installed in the image. Systemd should not be used in docker anyway, as the whole point is you run the app as the init process - it's a container not a VM.

Additionally, this appears to be for using docker inside a docker container???
From what I can tell, this is never actually used in my CI and I'm not even sure how it's supposed to be used.

So, questions:

  1. Why does this image use docker inside it, what feature allows me to make builds use it, and can it be removed?
  2. When will the default image from docker hub use 18.04?
  3. How can I install systemd to make this image work, and is there an example teamcity-base?

teamcity-base/Dockerfile:

FROM ubuntu:18.04

ENV DEBIAN_FRONTEND noninteractive
ENV JAVA_HOME       /usr/lib/jvm/java-8-oracle
ENV LANG            en_US.UTF-8
ENV LC_ALL          en_US.UTF-8

RUN apt-get update && \
  apt-get install -y wget gnupg && \
  apt-get install -y --no-install-recommends locales && \
  locale-gen en_US.UTF-8 && \
  apt-get dist-upgrade -y && \
  apt-get --purge remove openjdk* && \
  echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections && \
  echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu bionic main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list && \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 && \
  apt-get update && \
  apt-get install -y --no-install-recommends oracle-java8-installer oracle-java8-set-default && \
  apt-get clean all

teamcity-minimal-agent/Dockerfile:

FROM teamcity-base

MAINTAINER Kateryna Shlyakhovetska <[email protected]>

VOLUME /data/teamcity_agent/conf
ENV CONFIG_FILE /data/teamcity_agent/conf/buildAgent.properties
LABEL dockerImage.teamcity.version="latest" \
      dockerImage.teamcity.buildNumber="latest"

COPY run-agent.sh /run-agent.sh
COPY run-services.sh /run-services.sh
COPY dist/buildagent /opt/buildagent

RUN useradd -m buildagent && \
    chmod +x /run-agent.sh /run-services.sh && sync

CMD ["/run-services.sh"]

EXPOSE 9090

teamcity-agent/Dockerfile:

FROM teamcity-minimal-agent

MAINTAINER Vladislav Rassokhin <[email protected]>

LABEL dockerImage.teamcity.version="latest" \
      dockerImage.teamcity.buildNumber="latest"

ENV NUGET_XMLDOC_MODE=skip \
    DOTNET_CLI_TELEMETRY_OPTOUT=true \
    DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true \
    GIT_SSH_VARIANT=ssh

RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository -y ppa:openjdk-r/ppa && add-apt-repository -y ppa:git-core/ppa && apt-get update && \
    apt-get install -y git mercurial openjdk-8-jdk apt-transport-https ca-certificates curl && \
    \
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
#    apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 9DC858229FC7DD38854AE2D88D81803C0EBFCD88 && \
    echo "deb [arch=amd64] https://download.docker.com/linux/ubuntu artful stable" > /etc/apt/sources.list.d/docker.list && \
    \
    apt-cache policy docker-ce && \
    apt-get update && \
    apt-get install -y docker-ce && \
#    systemctl disable docker && \
    curl -SL https://github.com/docker/compose/releases/download/1.20.1/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose && \
    \
    apt-get install -y --no-install-recommends \
            libc6 \
            libcurl3 \
            libgcc1 \
            libgssapi-krb5-2 \
            libicu55 \
            liblttng-ust0 \
            libssl1.0.0 \
            libstdc++6 \
            libunwind8 \
            libuuid1 \
            zlib1g \
        && rm -rf /var/lib/apt/lists/* && \
    \
    curl -SL https://dotnetcli.blob.core.windows.net/dotnet/Sdk/2.1.4/dotnet-sdk-2.1.4-linux-x64.tar.gz --output dotnet.tar.gz \
        && mkdir -p /usr/share/dotnet \
        && tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
        && rm dotnet.tar.gz \
        && ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet && \
    \
    mkdir warmup \
        && cd warmup \
        && dotnet new \
        && cd .. \
        && rm -rf warmup \
        && rm -rf /tmp/NuGetScratch && \
    \
    apt-get clean all && \
    \
    usermod -aG docker buildagent

COPY run-docker.sh /services/run-docker.sh

No MS Build Tools in Windows image

Will be nice if out of the box there will be Visual Studio related binaries so we can use this image to build not only dotnet core apps but also good old .net

Win32 internal error

Error running executables using Powershell.

Try running nuget restore in Powershell:

[<<==>>] Exception: The Win32 internal error "No process is on the other end of the pipe" 0xE9 occurred while setting the console window title. Contact Microsoft Customer Support Services. --> No process is on the other end of the pipe

How to properly install/run nvm

Hello! I am having a really hard time setting up my docker build agent to build projects that use nvm/node/npm. I have created a Dockerfile like this:

FROM jetbrains/teamcity-agent
ENV SERVER_URL=https://tc-master.gc.local:8080
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash

# Install the self-signed TeamCity server SSL cert
COPY teamCityCert.cer /root/teamCityCert.cer
RUN keytool -importcert -file /root/teamCityCert.cer -keystore /usr/lib/jvm/oracle-jdk/jre/lib/security/cacerts -storepass pass -noprompt

When I build a new image using this dockerfile, it seems to install nvm correctly:

PS> docker build -t teamcity-agent-linux .
Sending build context to Docker daemon  5.632kB
Step 1/5 : FROM jetbrains/teamcity-agent
 ---> 5ae0b299f785
Step 2/5 : ENV SERVER_URL=https://tc-master.gc.local:8080
 ---> Running in 289df490e0d6
Removing intermediate container 289df490e0d6
 ---> ccbe76e4485d
Step 3/5 : RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
 ---> Running in e1f3432040ee
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12540  100 12540    0     0  19842      0 --:--:-- --:--:-- --:--:-- 19841
=> Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
Note: checking out '7ad6d98cedde01809e32d56ab8ced064f6f28175'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

=> Compressing and cleaning up git repository

=> Appending nvm source string to /root/.bashrc
=> Appending bash_completion source string to /root/.bashrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
Removing intermediate container e1f3432040ee
 ---> aff4018d04bc
Step 4/5 : COPY teamCityCert.cer /root/teamCityCert.cer
 ---> f85469c33073
Step 5/5 : RUN keytool -importcert -file /root/teamCityCert.cer -keystore /usr/lib/jvm/oracle-jdk/jre/lib/security/cacerts -storepass pass -noprompt
 ---> Running in 267fa7f5411b
Certificate was added to keystore
Removing intermediate container 267fa7f5411b
 ---> 10320cb850ad
Successfully built 10320cb850ad
Successfully tagged teamcity-agent-linux:latest

The agent connects to teamcity correctly, and I have authorized the agent from the TeamCity admin UI. However, when I go to build a project, the build always fails:

[13:05:12]/opt/buildagent/temp/agentTmp/custom_script6044565268267893228: line 1: nvm: command not found
[13:05:12]Process exited with code 127

The agent process appears to be running as root in the container, but do the individual builds get kicked off with the buildagent user? In which case, does nvm need to be installed as the buildagent user? (I tried this in the Dockerfile by placing USER buildagent before the nvm install, but it still did not work).

For what it's worth, when I log into the container, it appears to pick up the .bashrc and finds nvm in the path:

PS> docker exec -it 6c35ea79def1 bash
root@6c35ea79def1:/# nvm

Node Version Manager
...

Thank you in advance

Windows TeamCity images don't seem to stop correctly

Using: TeamCity Server 2018.1.1 running on Windows 10 Enterprise 1803
Using: Docker Cloud plugin to launch agents
Docker image: jetbrains/teamcity-agent:2018.1.1-nanoserver-sac2016

When a build agent is commanded to shut down by TC, either because of manual request ("Stop" clicked from Agents->Cloud screen) or automatic shutdown via plugin configuration ("Terminate after first build" setting), the container is immediately shut down successfully, but TeamCity reports "Cloud image is not configured to stop agents gracefully. The agent that was not stopped gracefully might be assigned with the build."

I have set a shutdown timeout of two minutes on the container but that does not help. From everything I can tell, the container is gracefully shutting down but I believe the agent process within is not.

Container dies during builds

I suspect that this is a Windows Containers problem, not a TeamCity problem, but I'm also logging it here as it may affect fellow users. I have had to abandon using containerized build agents and revert to using VMs.

When running a build via the agent running within the container, at some arbitrary point, the container becomes unresponsive. With process isolation, RDP to the host OS also becomes unresponsive and the host eventually reboots. With hyperv isolation, the container becomes unresponsive and then stops, but the host OS stays up and responsive. Builds do sometimes complete, but more often than not they fail. TeamCity server reports a loss of connection to the build agent, and eventually the build is marked as failed.

The original issue is logged here, with a bit more detail:
docker/for-win#426 (comment)

Connection reset by peer: socket write error

Publishing artifacts from the agent to the TeamCity Server fails.

Error:

[13:40:51] Publishing artifacts (running for 21m:15s)
[13:40:51] [Publishing artifacts] Collecting files to publish: [C:\BuildAgent\temp\buildTmp\coverage8038980754777348497zip\CoverageReport.xml=>.teamcity/.NETCoverage]
[13:40:54] [Publishing artifacts] Publishing 1 file using [WebPublisher]: C:/BuildAgent/temp/buildTmp/coverage8038980754777348497zip/CoverageReport.xml => .teamcity/.NETCoverage
[13:40:55] [Publishing artifacts] Publishing 1 file using [ArtifactsCachePublisher]: C:/BuildAgent/temp/buildTmp/coverage8038980754777348497zip/CoverageReport.xml => .teamcity/.NETCoverage
[13:42:10] [Publishing artifacts] Recoverable problem publishing artifacts (will retry): Connection reset by peer: socket write error

add additional configuration settings

I want to configure with environment variables also the ownAddress and ownPort for the Agent.
In order to achieve that, I patched the run-agent.sh

--- run-agent.sh	2018-02-02 13:11:49.000000000 +0100
+++ run-agent.sh	2018-02-02 13:10:44.000000000 +0100
@@ -19,6 +19,8 @@
     [[ -n "${SERVER_URL}" ]]  && opts[${#opts[@]}]='--server-url' && opts[${#opts[@]}]="$SERVER_URL"
     [[ -n "${AGENT_TOKEN}" ]] && opts[${#opts[@]}]='--auth-token' && opts[${#opts[@]}]="$AGENT_TOKEN"
     [[ -n "${AGENT_NAME}" ]]  && opts[${#opts[@]}]='--name'       && opts[${#opts[@]}]="$AGENT_NAME"
+    [[ -n "${OWN_ADDRESS}" ]] && opts[${#opts[@]}]='--ownAddress' && opts[${#opts[@]}]="$OWN_ADDRESS"
+    [[ -n "${OWN_PORT}" ]]  && opts[${#opts[@]}]='--ownPort'       && opts[${#opts[@]}]="$OWN_PORT"
     if [[ 0 -ne "${#opts[@]}" ]]; then
       # Using sed to strip double quotes produced by docker-compose
       for i in $(seq 0 $(expr ${#opts[@]} - 1)); do

Why re-tag the 'minimal-agent' image?

Hi!

I am Docker newbie and just out of curiosity I wanna ask: what is the purpose of re-tagging the image (as suggested in the README of the repository)?

If you need to build your own image, you need to perform the following:
Pull our minimal agent image and re-tag it

Isn't it bad practice to create a local tag? Doesn't it prevent my docker daemon from checksumming the image in the docker registry (DockerHub) against my local copy? If you update the docker image on DockerHub I will not get the latest version if I use my own re-tagged images for building my custom agent images.

Is this a common practice when building my customized docker images based on another?

Missing fontconfig package in linux

When the code contains Excel generate, the build will fail with following error message:

image

I guess it's because the package fontconfig is missing in the ubuntu.

I work with this script to install fontconfig and resolved the problem, so I strongly suggest to add the following command into the container based ubuntu.

docker exec -it {{agentContainerId}} bash
apt-get install -y fontconfig

Here is the link I get solutions from: adoptium/temurin-build#693

Docker-In-Docker daemon proxy settings

Is it possible to set proxy settings for the docker-in-docker daemon when starting the agent?

For example when I run the agent:

docker run --rm -it -e SERVER_URL="<server>" -e AGENT_NAME="<agent>" -e GIT_SSL_NO_VERIFY=1 -v agent:/data/teamcity_agent/conf --privileged -e DOCKER_IN_DOCKER="start" jetbrains/teamcity-agent

I have to bash in:

docker exec -i -t <container id> /bin/bash

And then add the proxies to /etc/default/docker:

echo "export http_proxy=http://proxy:port" >> /etc/default/docker
echo "export https_proxy=http://proxy:port" >> /etc/default/docker

And finally restart the service:

service docker restart

If I don't do this, when building images I get:

[03:25:58][Step 2/3] docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).

JavaFX Maven build

When agent is building maven goal package it reports that the following packages does not exists:

  • javafx.application
  • javafx.fxml
  • javafx.scene
  • javafx.stage
  • javafx.event

Agent parameters:
docker.server.osType linux
docker.server.version 17.09.0
docker.version 17.06.0
teamcity.agent.hardware.cpuCount 6
teamcity.agent.hardware.memorySizeMb 11845
teamcity.agent.home.dir /opt/buildagent
teamcity.agent.hostname teamcity.agent1
teamcity.agent.jvm.file.encoding UTF-8
teamcity.agent.jvm.file.separator /
teamcity.agent.jvm.java.home /usr/lib/jvm/oracle-jdk/jre
teamcity.agent.jvm.os.arch amd64
teamcity.agent.jvm.os.name Linux
teamcity.agent.jvm.os.version 3.10.0-693.5.2.el7.x86_64
teamcity.agent.jvm.path.separator :
teamcity.agent.jvm.specification 1.8
teamcity.agent.jvm.user.country US
teamcity.agent.jvm.user.home /root
teamcity.agent.jvm.user.language en
teamcity.agent.jvm.user.name root
teamcity.agent.jvm.user.timezone Etc/UTC
teamcity.agent.jvm.version 1.8.0_131
teamcity.agent.launcher.version 50574
teamcity.agent.name teamcity.agent1
teamcity.agent.os.arch.bits 64
teamcity.agent.ownPort 9090
teamcity.agent.protocol polling
teamcity.agent.tools.dir /opt/buildagent/tools
teamcity.agent.work.dir /opt/buildagent/work
teamcity.agent.work.dir.freeSpaceMb 6482
teamcity.hg.agent.path hg
teamcity.hg.version 3.7.3
teamcity.serverUrl http://teamcity.server:8111
teamcity.tool.JetBrains.dotCover.CommandLineTools.bundled /opt/buildagent/tools/JetBrains.dotCover.CommandLineTools.bundled
teamcity.tool.TeamCity.Dotnet.Integration.1.0.0 /opt/buildagent/plugins/dotnet.cli/tools/TeamCity.Dotnet.Integration.1.0.0
teamcity.tool.TeamCity.Dotnet.Integration.BUNDLED /opt/buildagent/plugins/dotnet.cli/tools/TeamCity.Dotnet.Integration.1.0.0
teamcity.tool.TeamCity.Dotnet.Integration.DEFAULT /opt/buildagent/plugins/dotnet.cli/tools/TeamCity.Dotnet.Integration.1.0.0
teamcity.tool.ant-net-tasks /opt/buildagent/tools/ant-net-tasks
teamcity.tool.gant /opt/buildagent/tools/gant
teamcity.tool.idea /opt/buildagent/tools/idea
teamcity.tool.jacoco /opt/buildagent/tools/jacoco
teamcity.tool.jetbrains.resharper-clt.bundled /opt/buildagent/tools/jetbrains.resharper-clt.bundled
teamcity.tool.jps /opt/buildagent/tools/jps
teamcity.tool.maven /opt/buildagent/tools/maven
teamcity.tool.maven3 /opt/buildagent/tools/maven3
teamcity.tool.maven3_1 /opt/buildagent/tools/maven3_1
teamcity.tool.maven3_2 /opt/buildagent/tools/maven3_2
teamcity.tool.maven3_3 /opt/buildagent/tools/maven3_3

Unable to build docker image

I'm trying to build the agent image using this repository (since we need .net core 3.1 sdk installed on the agent and the image from docker hub is still using 3.0.100) but the build fails at "STEP 4", presumably while installing "libc" binaries with a gzip error.
For better understanding I have attatched the last few lines of the build log.

As base image I tried using the minimal agent image from docker hub and one that I build on my machine following the instructions on its repository. Both were resulting in the same error message.

Please let me know if you are able to reproduce the behaviour or if I'm doing something wrong here.

Edit: Forgot to mention I'm building on Windows using docker containers. I'm aiming to build an agent running on ubuntu.

Agent unable to connect to server running behind Caddy reverse proxy with Let's Encrypt certificate

I am attempting to connect a Linux docker agent to a TeamCity 2019.1 server. The server is hosted behind a Caddy (https://caddyserver.com) reverse proxy with transparent proxying including WebSocket. The server also uses a Let's Encrypt wildcard certificate. For some reason which I am unable to grasp, the agent refuses to connect to the server.

Here is the log:
https://gist.github.com/NEXUS2345/93a56c98d346e0094d4e90e395862832

Any help is greatly appreciated.

Failed to initialize CoreCLR, HRESULT: 0x80004005

Hi,

I'm trying to run a TeamCity agent in a container.
This is environment:

The TeamCity and the agent are the latest from the container (2018.1.3 (build 58658))
The container is run in Docker for Windows, using Linux containers (because the production will run on Ubuntu).

root@teamcity-agent3:/opt/buildagent/work/70bf5e8b1cc61bbe/src# dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032

Runtime Environment:
OS Name: ubuntu
OS Version: 16.04
OS Platform: Linux
RID: ubuntu.16.04-x64
Base Path: /usr/share/dotnet/sdk/2.1.401/

Host (useful for support):
Version: 2.1.3
Commit: 124038c13e

.NET Core SDKs installed:
2.1.401 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

When I run the build using

/opt/buildagent/work/70bf5e8b1cc61bbe/src# /usr/bin/dotnet build trains.sln --framework netcoreapp2.1 --configuration Release --runtime ubuntu-x64

in the container, the build is successful.

However when I run the same command as part of a build step, I get this error:

Failed to initialize CoreCLR, HRESULT: 0x80004005

Any ideas on why this error occurs?

Agent image with React/Node?

Hey guys

Do you think it would be possible for you to distribute an image based on the agent image but with node and react tooling above it?

Thanks
Phil

How get the agent windows container running?

That is what I tried according to the guide on https://hub.docker.com/r/jetbrains/teamcity-agent/

docker run -itd --name teamcity-win-agent -e SERVER_URL="<IP>:80" -v/etc/teamcity/agent_win/conf:/data/teamcity_agent/conf jetbrains/teamcity-agent:windowsservercore

the errors were:

Unable to find image 'jetbrains/teamcity-agent:windowsservercore' locally
docker: Error response from daemon: manifest for jetbrains/teamcity-agent:windowsservercore not found.

Can anybody tell me how to get this done? I am kinda unsure if I fully understood how the windows agent is started.

I run the container of a debian environment - no windows container

NuGet Publish build step fails

After an otherwise successful build, I'm getting failures with the NuGet Publish step. I'm using NuGet.exe version 4.7.1, and a image based on jetbrains/teamcity-agent:2018.1.1-windowsservercore-1803 (with added Windows SDK for debugging tools to support symbol server plugin). I am running the build agent image as a swarm of scale 1 (for testing), with default networking. The log looks like this:

[01:45:35]	Step 10/11: NuGet Publish (1m)
[01:45:36]	[Step 10/11] Attempt to publish symbol package. Symbol packages are not fully supported by TeamCity internal feed. For more details see https://confluence.jetbrains.com/display/TCDL/NuGet#NuGet-symbols
[01:45:36]	[Step 10/11] push: Publish package Api.Logging\bin\Release\Redacted.Api.Logging.Redist.2.0.0-alpha-00000056.symbols.nupkg (1m)
[01:45:36]	[push] NuGet command: C:\BuildAgent\tools\NuGet.CommandLine.4.7.1\tools\NuGet.exe push C:\BuildAgent\work\2c2ee6feb437097a\Api.Logging\bin\Release\Redacted.Api.Logging.Redist.2.0.0-alpha-00000056.symbols.nupkg ******* -Source http://redacted.redactedinternaldomain/nuget/internal
[01:45:36]	[push] Starting: C:\BuildAgent\temp\agentTmp\custom_script2499889723989314163.cmd
[01:45:36]	[push] in directory: C:\BuildAgent\work\2c2ee6feb437097a\Api.Logging\bin\Release
[01:45:38]	[push] Pushing Redacted.Api.Logging.Redist.2.0.0-alpha-00000056.symbols.nupkg to 'http://redacted.redactedinternaldomain/nuget/internal'...
[01:45:38]	[push]   PUT http://redacted.redactedinternaldomain/nuget/internal/
[01:45:57]	[push] An error was encountered when fetching 'PUT http://redacted.redactedinternaldomain/nuget/internal/'. The request will now be retried.
[01:45:57]	[push] An error occurred while sending the request.
[01:45:57]	[push]   The underlying connection was closed: An unexpected error occurred on a receive.
[01:45:57]	[push]   Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
[01:45:57]	[push]   A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
[01:45:58]	[push]   PUT http://redacted.redactedinternaldomain/nuget/internal/
[01:46:17]	[push] An error was encountered when fetching 'PUT http://redacted.redactedinternaldomain/nuget/internal/'. The request will now be retried.
[01:46:17]	[push] An error occurred while sending the request.
[01:46:17]	[push]   The underlying connection was closed: An unexpected error occurred on a receive.
[01:46:17]	[push]   Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
[01:46:17]	[push]   A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
[01:46:17]	[push]   PUT http://redacted.redactedinternaldomain/nuget/internal/
[01:46:36]	[push] The underlying connection was closed: An unexpected error occurred on a receive.
[01:46:36]	[push]   Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
[01:46:36]	[push]   A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
[01:46:36]	[push] Process exited with code 1
[01:46:37]	[push] Process exited with code 1 (Step: )
[01:46:36]	[Step 10/11] Step NuGet Publish failed

Host redacted.redactedinternaldomain is a ProGet server running within our internal network as a standalone server (no docker involved). The actual domain name does not end in .local (I'm aware of some issues with that suffix).

Running the exact same nuget push from a powershell console on the Windows Server 2016 docker host machine works as expected.

If I obtain a powershell console on the running docker container and run the exact same nuget push explicitly (with the correct -ApiKey argument added), I get the same error. However, running nuget list -Source http://redacted.redactedinternaldomain/nuget/internal works as expected. I find this quite puzzling: from testing on a Windows 10 desktop with Fiddler, nuget list issues a set of HTTP GET requests, and receives responses; nuget push issues a single HTTP PUSH and receives a response. From looking at firewall logs on the docker host Windows Server (disclaimer: I am not a networking expert), several incoming UDP packets get blocked when I issue the nuget push - almost as if the firewall does not recognise the incoming UDP packets as being part of an established outbound connection. Why this would differ for push vs list I have no idea.

It would be good to know if the NuGet Publish step is working for other people under similar conditions.

How do you grant permission to a teamcity agent running in AKS?

I hit an issue today where I have a bulid step, which involves running an executable file. My build is presently failing, because my TeamCity Agent doesn't have permission apparently to run the EXE. The EXE is located in the build directory. Both the TeamCity Server and the Build Agent reside in Azure Kubernetes Services, and are running version TeamCity.2018.1 Other than this issue, the Build Agent has been working well; it can pull down source code, run NPM commands and the like. It just can't seem to run this EXE.

If the Agent were hosted on a Windows machine, I'd simply RDP on to that machine, amend the User Account under which the Agent Service was running to use an account with elevated permissions, and have confidence that would allow the Build Agent to do what it needs to do. But I'm unsure what the equivalent step I should take is when the Agent is running in Docker / Linux, on AKS.

I've had a look through the TeamCity documentation, but couldn't find any info specific to this scenario. Any ideas how I can achieve what I need to here?

Cannot connect to self-hosted docker registry (.local)

I'm having the same issue reported here – in that I cannot get the tc-agent to talk to a self-hosted docker registry found at myserver.local (i.e. a .local) address. It can fetch images from dockerhub, but not our internal registry.

According to this comment, there already should be a fix — but I'm not seeing it.

Is it only me?

Using jetbrains/teamcity-agent:latest on Ubuntu.

Docker support fails even with privileged flag

The following teamcity agent:

    teamcity-agent-stuff:
        image: jetbrains/teamcity-agent:latest
        restart: always
        environment:
            - "SERVER_URL=http://something:8111"
            - "DOCKER_IN_DOCKER=start"
            - "AGENT_NAME=stuff"
        volumes:
            - teamcity-agent-stuff:/data/teamcity_agent/conf
        networks:
          - teamcity-network
        # Adds docker in docker support
        privileged: true

Still fails when trying a Docker Build step.
Warning: failed to get default registry endpoint from daemon (Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?). Using system default: https://index.docker.io/v1/ Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

Adding docker-compose to agent

Hi, I'm running some integration tests through gradle which in turn start docker-compose services. As for now, I'm getting an error during the build which tells that docker-compose was not found.

How do I install docker-compose command into TC agent?

delete /var/run/docker.pid?

after restarting container with docker-in-docker, docker failed to start. In /var/log/docker.log I see the following line - Error starting daemon: pid file found, ensure docker is not running or delete /var/run/docker.pid.
Suggestion - modify run-docker.sh to delete this file before starting the docker

Custom server certificate

How do we get the agent to accept successfully connect to the server using HTTPS if it is using a certificate signed by an internal/unknown CA?

Currently I'm having to connect over HTTP which is less than ideal.

Agent doesn't start

Hello. I have some problem with starting buildAgent.
Inside the container begins infinity loop after start.

That is how i start container:
docker run -itd -e SERVER_URL="http://teamcity.domain.com" -v /opt/tc_agent/:/data/teamcity_agent/conf -p 0.0.0.0:9090:9090 jetbrains/teamcity-minimal-agent

Seems that each loop cycle finishing with

[2017-09-02 15:39:59,524] INFO - jetbrains.buildServer.AGENT - Upgrade mode: jetbrains.buildServer.agent.impl.upgrade.modes.FullUpgradeMode
[2017-09-02 15:39:59,533] INFO - rocesses.ProcessTreeTerminator - Using jetbrains.buildServer.processes.ProcessTreeTerminatorLinux
[2017-09-02 15:39:59,534] INFO - .ProcessTreeTerminatorImplBase - Will use command 'sh -c echo $$ && ps awwxo pid,ppid,command | tee'.
[2017-09-02 15:39:59,564] INFO - .ProcessTreeTerminatorImplBase - Will use command 'sh -c echo $$ && ps awwxo pid,ppid,command | tee'.
[2017-09-02 15:39:59,588] INFO - ses.ProcessTreeTerminatorLinux - Second thread id is 246
[2017-09-02 15:39:59,588] INFO - ses.ProcessTreeTerminatorLinux - Thread is Process thread model: false
[2017-09-02 15:39:59,589] INFO - .ProcessTreeTerminatorImplBase - Collecting processes from the current one, current process PID 246
[2017-09-02 15:39:59,589] INFO - .ProcessTreeTerminatorImplBase - No processes to kill
[2017-09-02 15:39:59,590] INFO - jetbrains.buildServer.AGENT - Exit for upgrade
[2017-09-02 15:39:59,590] INFO - ent.impl.upgrade.AgentExitCode - Agent exited. Upgrade process
[2017-09-02 15:39:59,591] INFO - buildServer.agent.AgentMain2$2 - Closing jetbrains.buildServer.agent.AgentMain2$2@3cef309d: startup date [Sat Sep 02 15:39:41 UTC 2017]; root of context hierarchy

And next lines again from begin

[2017-09-02 15:39:03,723] INFO - s.buildServer.agent.AgentMain2 - ===========================================================
[2017-09-02 15:39:03,738] INFO - s.buildServer.agent.AgentMain2 - TeamCity Build Agent 2017.1.3 (build 46961)
[2017-09-02 15:39:03,745] INFO - s.buildServer.agent.AgentMain2 - OS: Linux, version 3.10.0-514.16.1.el7.x86_64, amd64, Current user: root, Time zone: UTC
[2017-09-02 15:39:03,746] INFO - s.buildServer.agent.AgentMain2 - Java: 1.8.0_131, Java HotSpot(TM) 64-Bit Server VM (25.131-b11, mixed mode), Java(TM) SE Runtime Environment (1.8.0_131-b11), Oracle Corporation; JVM parameters: -ea -Xmx384m -Dteamcity_logs=../logs/

What i'm doing wrong? Thanks

Docker in docker - external requests time out

Im having an issue building within containers on the agent. First symptoms was that restoring nuget packages in a dotnet restore would time out for each individual package.

I tested this ok directly on the docker agent, but it would consistently fail restoring in the container running on the agent.

Playing around with curl in the container running on the agent i got inconsistent results, it returned the header and partial html, eventually timing out.

After a suggestion from a co-worker we attempted to reduce MTU to 1380 (magic number he suggested) for the docker_ops on the teamcity agent, and it seems to have solved the problem.

Now i mount a /etc/docker/daemon.json in order to set mtu. Looks like this:
{ "mtu":1380 }

Is this something that could be adjusted in the official image? (I do wonder why i'm the only one that seems to have this issue)

Install Google Cloud SDK

    \
    echo "Installing Google Cloud SDK..." && \
    apt-get update && \
    apt-get install -y --no-install-recommends apt-transport-https && \
    export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" && \
    echo "deb https://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list && \
    curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - && \
    apt-get update && \
    apt-get install -y --no-install-recommends google-cloud-sdk && \
    rm -rf /var/lib/apt/lists/* && \
    gcloud config set core/disable_usage_reporting true && \
    gcloud config set component_manager/disable_update_check true && \
    \

Is will allow to use gsutil tools to sync local static folder with google cloud storage bucket (like s3 equivalent)

From:
https://cloud.google.com/storage/docs/gsutil_install#deb

What is the Docker Hub release process?

I've just pulled the Ubuntu image from Docker Hub and I noticed it is currently out of sync with the project's master branch.

According to the docker images command, the image was last published 4 weeks ago:

jetbrains/teamcity-agent latest 5ae0b299f785 4 weeks ago 1.4GB

... and at the moment of writing this comment the corresponding Docker file was last updated just over two weeks ago.

On the same note, would you guys consider Git-tagging the releases that you publish to Docker Hub?

Add Bzip2

phantomjs requires bzip2 to untar its builds. Any node.js projects including phantomjs will break on build without this package.

Solution:
Please add bzip2 to the apt-get list in the ubuntu build list.

Add git-lfs

I found git-lfs missing on jetbrains/teamcity-agent:latest-nanoserver

Kind regards

Konstantin

Docker client version in agent is too old for docker hub

When trying to do something like docker pull registry.hub.docker.com/library/mono in a custom build script it will fail with "could not reach any registry point". Reason seems to be that any docker client version from 1.5 and down is no longer supported by the docker hub registry.

Support for .net sdk 3.0

Hello,
When can we expect support for dotnet sdk 3.0? It has been officially released in September by microsoft.
Thanks and best regards
Peter

DOCKER_IN_DOCKER and Fargate

Can't seem to get DOCKER_IN_DOCKER=start work for Fargate tasks.. Is it supported?
This is the error I get on builds which uses docker stuff (not the Docker plugin):
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
I have set environment variable DOCKER_IN_DOCKER=start
Anyone got this to work with Fargate tasks?

FYI: It works with EC2 tasks

Question: How to properly restart the build agent?

Hi there,

I would like to use this image (specifically the ubuntu image), but in my case, I need to add a custom, self-signed SSL certificate to the java cacert store and then restart the build agent process in order to pick up the new cert. What is the best way to restart the build agent process? Would it be easiest to simply reboot the container all together? It looks like there is also a hook in /opt/buildagent/bin/agent.sh to stop and start the agent. I just want to be sure that whichever way I decide to do it that it has the appropriate configuration/environment variables it needs to run properly. Thank you in advance

Symbol indexing is not working

I'm evaluating the docker agent image. We have the symbol server feature enabled on the TC server. I'm getting build errors when using the docker agent:

.NET 3.5 runtime required for symbols indexing was not found on build agent.
Failed to find Source Server tools home directory. No symbol and source indexing will be performed.

Is there a reason that the docker image does not contain the required components? Could you add them? And how can I add them myself in the mean time?

The documentation does not specifically cover use with the docker image.

I'm using jetbrains/teamcity-agent:2018.1.1-windowsservercore-1803

how to update .net core version

The .net core version of teamcity agent docker in windows is 2.0 now.
I have a problem that how to update the .net core version to 2.1 ?
I have searched history of this repository to find any solution, then "Don't install dotnet core sdk explicitly" had been found.
Is dotnet-framework-build contains .net core ?
As a beginner of docker, I'm confused to how .net core was included, so that I can't follow the same steps to update .net core.

DOCKER_OPTS insecure-registry setting not working

I am trying to run a docker build in an agent within the container. The docker file of my project pulls from an insecure docker registry. I have tried setting the insecure registry in the docker_opts environment variable, but am still getting the error. Hoping someone can guide me in the right direction

Here is my docker run command.
docker run -it -e SERVER_URL="http://buildtest:880" --privileged -e DOCKER_OPTS="--insecure-registry 10.0.4.89:2113" -e DOCKER_IN_DOCKER=start -e AGENT_NAME="Docker-TeamCity" -v :/data/teamcity_agent/conf jetbrains/teamcity-agent

The agent starts and connects to our agent perfectly, but I get the classic insecure registry error 'http response to an https client' I have execed into the machine and dont see a daemon.json file. Not sure if I should just mount the file, or if that would even work. Any help is appreciated.

Log line formatting issue

The below output is from just running docker run -it -e SERVER_URL="https://localhost/" jetbrains/teamcity-agent. It appears that the first few characters of the log lines are being eaten by something - possibly bad log formatting options somewhere?

[2018-02-28 18:54:18,227]   INFO - rver.plugins.PluginManagerImpl - =========================================================== 
[2018-02-28 18:54:18,227]   INFO - rver.plugins.PluginManagerImpl - Plugins initialization started... 
[2018-02-28 18:54:18,228]   INFO - rver.plugins.PluginManagerImpl - Scanning plugins folders 
[2018-02-28 18:54:18,229]   INFO - .plugins.files.JarSearcherBase - Scanning plugin folder: /opt/buildagent/plugins 
[2018-02-28 18:54:18,230]   INFO - .plugins.files.JarSearcherBase - Scanning plugin folder: /opt/buildagent/tools 
[2018-02-28 18:54:18,240]   INFO - rver.plugins.PluginManagerImpl - Found 1 non bundled plugins: [amazonEC2] 
[2018-02-28 18:54:18,240]   INFO - rver.plugins.PluginManagerImpl - Found 0 bundled plugins: [] 
[2018-02-28 18:54:18,241]   INFO - rver.plugins.PluginsCollection - Load shared classloader for 1 plugins [amazonEC2] 
[2018-02-28 18:54:18,245]   INFO - rver.plugins.PluginsCollection - No plugins were loaded with standalone classloaders 
[2018-02-28 18:54:18,336]   INFO - rver.plugins.PluginManagerImpl - Plugins initialization completed (1 plugins loaded): [amazonEC2] 
[2018-02-28 18:54:18,338]   INFO - rver.plugins.PluginManagerImpl - =========================================================== 

ltsc2016 and sac2016 removed

Long term supported 2016 images were removed in this commit that says "Provide Windows 1809 containers". Was this really intentional?

395a700

We still run 2016 servers (update takes time, it's LONG term support after all) and not having new Team City versions for the Windows version that was the latest long term up to very recently seems a bit premature imho.

Examples for SERVER_URL

Please, provide examples for SERVER_URL value at the case both client and server containers are managed by the same docker.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.