Go not found issue with teamcity user in ubuntu 18.04

Answered

Hi Guys,

I have run into an issue I have not been able to make sense of in a teamcity installation. I have an ubuntu 18.04 on which Teamcity is installed and run with its user teamcity.

The TeamCity user is created with command like: $ useradd -m -r -s /bin/bash teamcity . That user is the one configured in the teamcity.service in systems. I have as well installed golang using apt ppa repository. $ which go command give the output : /usr/lib/go-1.15/bin/go . I have configured the environment variables in ~/.bashrc for the teamcity user:

################# GO SECTION ###################

export GOROOT="/usr/lib/go-1.15"
export GOPATH="$HOME/go"
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"

################# END GO SECTION ##############

So whether I do : su - teamcity or su teamcity. and I test go using the go version command. It shows the right output: /usr/lib/go-1.15/bin/go .

When I run the first step with command line runner with : go fmt. Teamcity says it cannot find go

 

But when I use the full path on it

It works well. I am not sure if I have missed any part of configuration. This a new server we are setting up and we will like to avoid any misconfiguration before we start building on it. Grateful if you can shed some lights on this. 

 

Best Regards,

 

0
6 comments

Hello!

I just wanted to double check on where (and how) the build agent is set up. Could you please confirm if the agent is also running under the "teamcity" user?
Could you please try to also invoke 

echo $PATH

before the go fmt, so to see if the PATH variable is read correctly?

0

Hello Fedor,

 

Thanks for replying this. It's about the default Build Agent that comes with Teamcity. It's uses the same teamcity user . My systemctl setup for teamcity uses runAll.sh for the startup.

I have also echoed the $PATH and it's surprising it's using a different one. So I put an whoami command in the step and it does show the user teamcity. Now I am confused.

 

 

0

Hello!

Just to double-check, have you restarted the agent process after the PATH has been amended? It may retain the session value which was in effect when the process was started, but should honor new value after restarting. 

0

Hi Blacksensei! Did you manage to sort this out? I'm experiencing the same issue with the nvm command. 

0

Hi Blacksensei  did you get a solution for this?

@...  could you help on this one please?

0

Hi Miguel,

Can you please share with us details regarding the problem you are facing? Any logs or screenshots would be helpful.

0

Please sign in to leave a comment.