mjensen Posted October 16, 2020 Report Share Posted October 16, 2020 I'm setting up mergebots to help with our CI/CD and I've run into a problem. We use the default trunkbot that comes with plastic server installation, but when we run it, it seems like it doesn't build from a shelve. Our plastic version is 9.0.16.4608 and TeamCity version 2019.2.1 Plastic mergebot logs show that the bot makes a shelve, but TeamCity runs the changeset already on main instead of that shelve. We did a test where we made changes to a branch to make it unable to build, but the mergebot still sucesfully merged it into main because main could build. After the merge main could no longer build. The logs in case you can see why it didn't work as expected. If there are any other logs that show why this happened, please let me know trunkbot.trunk.log.txtteamcityplug.TeamCityForMerges.log.txt Thanks in advance Link to comment Share on other sites More sharing options...
calbzam Posted October 16, 2020 Report Share Posted October 16, 2020 Hi, I've been reviewiong your TRUNKBOT log: 2020-10-16 13:09:08,653 INFO trunkbot - Processing branch /main/HCHB_MacAutorun attribute change... 2020-10-16 13:09:08,654 INFO trunkbot - Getting task number of branch /main/HCHB_MacAutorun ... 2020-10-16 13:09:08,655 INFO trunkbot - Building the merge report of task HCHB_MacAutorun ... 2020-10-16 13:09:08,657 INFO trunkbot - Trying to shelve server-side-merge from /main/HCHB_MacAutorun to /main 2020-10-16 13:09:08,667 INFO trunkbot - Testing branch /main/HCHB_MacAutorun ... 2020-10-16 13:10:54,136 INFO trunkbot - Checking-in shelved merged 9 from /main/HCHB_MacAutorun to /main 2020-10-16 13:10:54,168 INFO trunkbot - Checkin: Created changeset 1863 in branch /main 2020-10-16 13:10:54,168 INFO trunkbot - Setting branch /main/HCHB_MacAutorun as 'integrated'... At "13:09:08" "testing branch /main/HCHB_MacAutorun", and if we review the plug log at that time, TeamCity is running the build folder the shelve: sh:9@HavenPlastic@http://192.168.59.56:8087 020-10-16 13:09:08,676 INFO teamcityplug - Launch plan was requested. Fields: 2020-10-16 13:09:08,676 INFO teamcityplug - PlanName: Haven_Test_Configurations_TestMerge 2020-10-16 13:09:08,676 INFO teamcityplug - ObjectSpec: sh:9@HavenPlastic@http://192.168.59.56:8087 2020-10-16 13:09:08,676 INFO teamcityplug - Comment: MergeBot - Building branch /main/HCHB_MacAutorun 2020-10-16 13:09:08,676 INFO teamcityplug - Properties: 2020-10-16 13:09:08,676 INFO teamcityplug - branch.head.changeset.author: mjensen 2020-10-16 13:09:08,676 INFO teamcityplug - branch.head.changeset.guid: ed01e110-4457-45db-9266-ebf2f8916974 2020-10-16 13:09:08,676 INFO teamcityplug - branch.head.changeset.number: 1862 2020-10-16 13:09:08,676 INFO teamcityplug - branch.name: /main/HCHB_MacAutorun 2020-10-16 13:09:08,676 INFO teamcityplug - build.name: 2020-10-16 13:09:08,676 INFO teamcityplug - build.number: 2020-10-16 13:09:08,676 INFO teamcityplug - label: 2020-10-16 13:09:08,676 INFO teamcityplug - release.notes: 2020-10-16 13:09:08,676 INFO teamcityplug - repspec: HavenPlastic@http://192.168.59.56:8087 2020-10-16 13:09:08,676 INFO teamcityplug - stage: pre 2020-10-16 13:09:08,676 INFO teamcityplug - task.number: HCHB_MacAutorun 2020-10-16 13:09:08,676 INFO teamcityplug - trunk.head.changeset.guid: 71ee7ee1-9bc2-4c8c-89cf-3cc367afab09 2020-10-16 13:09:08,676 INFO teamcityplug - trunk.head.changeset.number: 1860 At "13:10:54" the shelve that was already tested is finally checked in into main: "Checking-in shelved merged 9 from /main/HCHB_MacAutorun to /main". After that, the "/main/HCHB_MacAutorun" branch is set as integrated and a new build is run for the recently created changeset 1863. 2020-10-16 13:10:54,176 INFO teamcityplug - Launch plan was requested. Fields: 2020-10-16 13:10:54,176 INFO teamcityplug - PlanName: Haven_Test_Configurations_TestMergePost 2020-10-16 13:10:54,176 INFO teamcityplug - ObjectSpec: cs:1863@HavenPlastic@http://192.168.59.56:8087 2020-10-16 13:10:54,176 INFO teamcityplug - Comment: MergeBot - Running plan after merging branch /main/HCHB_MacAutorun 2020-10-16 13:10:54,176 INFO teamcityplug - Properties: 2020-10-16 13:10:54,176 INFO teamcityplug - branch.head.changeset.author: mjensen 2020-10-16 13:10:54,176 INFO teamcityplug - branch.head.changeset.guid: ed01e110-4457-45db-9266-ebf2f8916974 2020-10-16 13:10:54,176 INFO teamcityplug - branch.head.changeset.number: 1862 2020-10-16 13:10:54,176 INFO teamcityplug - branch.name: /main/HCHB_MacAutorun 2020-10-16 13:10:54,176 INFO teamcityplug - build.name: 2020-10-16 13:10:54,176 INFO teamcityplug - build.number: 2020-10-16 13:10:54,176 INFO teamcityplug - label: 2020-10-16 13:10:54,176 INFO teamcityplug - release.notes: 2020-10-16 13:10:54,176 INFO teamcityplug - repspec: HavenPlastic@http://192.168.59.56:8087 2020-10-16 13:10:54,176 INFO teamcityplug - stage: post 2020-10-16 13:10:54,176 INFO teamcityplug - task.number: HCHB_MacAutorun 2020-10-16 13:10:54,176 INFO teamcityplug - trunk.head.changeset.guid: b69336f0-ffb6-4e8e-a53e-722b08d036fa 2020-10-16 13:10:54,176 INFO teamcityplug - trunk.head.changeset.number: 1863 Regards, Carlos. Link to comment Share on other sites More sharing options...
mjensen Posted October 19, 2020 Author Report Share Posted October 19, 2020 Hi Carlos, thanks for responding. I 100% agree that the logs say it shelved and tested the shelve, but TeamCity build logs said something else. Sorry i forgot to add a screenshot of the builds last friday. Build #31 is a test of the branch im about the merge into main, #32 is the build initiated by the bot, and #33 is me again building to test if main works after merge. This is the reason why we believe there might be something working differently than intended. Is there any settings, setups, or installations we've missed that could cause this issue? Link to comment Share on other sites More sharing options...
calbzam Posted October 19, 2020 Report Share Posted October 19, 2020 Hi, - I think the key is you have defined a stage "post" in the plug configuration. It's not mandatory and you can remove it from your configuration. 2020-10-16 13:10:54,176 INFO teamcityplug - stage: post - Also review that you have installed the "Mergebot plugin" but not the regular "Plastic SCM Teamcity plugin" that may be triggering a build every time a new changeset appears in the repo. Regards, Carlos. Link to comment Share on other sites More sharing options...
mjensen Posted October 19, 2020 Author Report Share Posted October 19, 2020 Hi Carlos You're right, we only had the regular VCS support: Plastic SCM on our TeamCity server. I can't find any plugin for teamcity called "Mergebot plugin". The closest is https://github.com/PlasticSCM/teamcityplug, which talks about the mergebot. Is that the correct one? If not, can you throw a link to the right plugin? Link to comment Share on other sites More sharing options...
calbzam Posted October 19, 2020 Report Share Posted October 19, 2020 Sorry for not being clear enough. The plugin to use is this one: In the repo link, it's also refered as the "The TeamCity Lightweight Plugin". Please review the the following sections: https://github.com/PlasticSCM/teamcityplug Installation requirements - The TeamCity Lightweight Plugin TeamCity Configuration Please let us know if it helps. Regards, Carlos. Link to comment Share on other sites More sharing options...
mjensen Posted October 19, 2020 Author Report Share Posted October 19, 2020 Hi Carlos IT WORKS Thanks a lot. 1 Link to comment Share on other sites More sharing options...
mjensen Posted October 21, 2020 Author Report Share Posted October 21, 2020 We've run into another problem, though it's less on the Plastic side and more on TeamCity... We want to run a build chain to determine whether or not a given merge should be accepted, but TeamCity cannot send parameters down the line, so we can't access the shelve. Is this an issue you've run into before and know a workaround for? We've found a request for TeamCity to change the behaviour to allow parameters to be resolved and reverse.dep'ed as value instead of strings, but it's 5 years old and seems to be ignored... Link to comment Share on other sites More sharing options...
calbzam Posted October 21, 2020 Report Share Posted October 21, 2020 What are the specific parameters you would need? Not sure if you can get this information via "cm find" command in a build step. Regards, Carlos. Link to comment Share on other sites More sharing options...
mjensen Posted October 22, 2020 Author Report Share Posted October 22, 2020 The parameters i need to pass is how to access the shelve. We've found the parameters are passed to the called build configuration, but we haven't been able to pass it along down a dependency chain. We want to build to multiple platforms before we accept it as passed, but so far can only have a single build configuration to work. Link to comment Share on other sites More sharing options...
calbzam Posted October 22, 2020 Report Share Posted October 22, 2020 Quote The parameters i need to pass is how to access the shelve. But you are not refering to the shelve id, right? or any other Plastic related info, right? eg: "cm find shelve..." I was guessing if running any Plastic command could provide this information instead of using the TeamCity parameters. Could you share the link of the request in the TeamCity side? Not sure if they could provide some more feedback. Regards, Carlos. Link to comment Share on other sites More sharing options...
mjensen Posted October 22, 2020 Author Report Share Posted October 22, 2020 The issue on TeamCity is https://youtrack.jetbrains.com/issue/TW-42994 We've found a workaround we plan to try. We are going to query the parameters of the config initiated by the mergebot using the REST api available, which lets us hopefully use the merge bot tools you've created. Link to comment Share on other sites More sharing options...
mjensen Posted October 29, 2020 Author Report Share Posted October 29, 2020 New problem The plastic mergebot doesn't seem to work for mac build agents. When the CM commands are run, they are run from the folder where plastic client is located, and not the workspace they TeamCity uses for checkout. This causes the build to fail wiht Plastic was unable to undo workspace changes in path: [/Volumes/Mac External Drive/TeamCity/work/Haven/Merge/BuildClient/MacOS] Command errors:/Users/buildagent2/Applications/buildAgent/bin/Drive/TeamCity/work/Haven/Merge/BuildClient/MacOS is not in a workspace. Step Load Plastic SCM Shelve (Mergebot Plastic SCM) failed with unexpected error Is this something you have a workaround for? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now