1

So I have a Jenkins master container ali_jenkins_m setup which I spin up using a data volume container ali_jenkins_data for storing the Jenkins data.

docker run -p 8080:8080 -p 50000:50000 --name ali_jenknins_master --volumes-from ali_jenkins_data -d ali_jenkins_m

I have setup a TFS plugin and mapped one of our TFS branches to pull the code into Jenkins and build. Everything worked well until I removed my jenkins master container ali_jenkins_m and then recreated it. When recreating I still used the data volume container ali_jenkins_data. All my data has persisted as expected but I am running into issues building from TFS in Jenkins.

The error I get is:

  Creating workspace 'HUDSON-MCA Continuous Development Build-MASTER' owned by 'DOMAIN\tfsbuild'...
FATAL: com.microsoft.tfs.core.exceptions.TECoreException: The workspace HUDSON-Development Build-MASTER;tfsbuild already exists on computer **a4d8cdb6981d**.

The a4d8cdb6981d is the container ID of the ali_jenkins_m that I removed. My new conatiner ali_jenkins_m has a new container id. I looked around everywhere on the mount to figure out what needs to be changed to make this work.

Any pointers will be appreciated.

Daniel Mann
  • 49,975
  • 11
  • 87
  • 105
Ali Bhagat
  • 347
  • 1
  • 3
  • 14

2 Answers2

2

So, this was a problem with TFS and nothing to do with Docker or Jenkins. I solved this problem by running this command.

 tf workspace /delete /server:http://abc.xyz.eee:8080/tfs/IntlSysDev "HUDSON-MCA Continuous Development Build-MASTER";tfsbuild

Another way, we solved this problem was to use a -h option to specify a hostname when running the docker run command. So from above my docker run command now looks like this:

docker run -p 8080:8080 -p 50000:50000 -h jenkinsali --name ali_jenknins_master --volumes-from ali_jenkins_data -d ali_jenkins_m

This was a better way to do it. Now we dont need to run the tf workspace /delete command every time I recreated the container

Ali Bhagat
  • 347
  • 1
  • 3
  • 14
1

I ran into exactly the same problem (this is a problem with the TFS workspace being mapped to a named computer - which will be the same if you restart a docker container); I deleted the workspace using Team foundation sidekicks which gives you a nice GUI to manipulate workspaces (even other people's workspaces if you have access)

  1. Open TFS Sidekicks, go to tools --> Workspace sidekick
  2. Specify the workspace details (will be in the hudson error message)
  3. Hit search
  4. Find the offending workspace and remove it.
  5. Kick off your build again, and all should be good!
Jay
  • 7,855
  • 4
  • 48
  • 64