Support 2024.03 and also previous TeamCity versions
netwolfuk opened this issue · 2 comments
Since 2024.03 changed the Jersey stuff ALOT, I need a way to support 2023.11 and previous as well as 2024.03 and future versions.
My current thinking is:
- git subtree a copy of the REST plugin to a new maven sub-project so that history is maintained.
- build two copies of the REST plugin, both with different
requirements
in theteamcity-plugin.xml
- Version the two plugins with different version names (eg,
2.0.0
, and2.0.0-legacy
). - Publish both "versions" when pushing them to the plugin marketplace and github
Process to "copy" tcwebhooks-rest-api
to tcwebhook-rest-api-legacy
-
Clone to alternative location
git clone -s . ../testing
to create a new repo named "testing" (terrible name). -
cd ../testing
to move to new repo -
git checkout -b sliced
to change to new branch -
Filter and rename the dir using
filter-branch
as per https://stackoverflow.com/a/28840897git filter-branch --index-filter ' git read-tree --prefix=tcwebhooks-rest-api-legacy/ $GIT_COMMIT:tcwebhooks-rest-api/ git read-tree -m $GIT_COMMIT `git mktree </dev/null` '
-
We now have a repo with just the files from the
tcwebhooks-rest-api
module, but it contains all the commits, most of which are empty. We can see that withgit log --name-only --oneline
which looks like this..
989c2e51 (HEAD -> sliced) Minor tidy up to tests and formatting
c929ac39 Remove build agent plugin
e0350ea0 Remove references to method that was removed from TC REST API
8785f053 Set version to 2.0.0 release candidate 2
a8f97755 Move WebHook Thread to start on boot. Add 802 status to graph
57aade11 Minor sonarqube cleanup.
64d70804 Jdom is inherited via server.jar. No need to declare it here
78d9bd68 Add support for storing/retrieving threadpool settings from main-config
430405d3 Add dedicated threadpool for WebHooks. No config wired up yet.
2036f373 Update minimum TeamCity version to 2019.1 to use ExecutorsFactory
22408058 Update minimum TeamCity version to 2018.2.
tcwebhooks-rest-api-legacy/pom.xml
tcwebhooks-rest-api-legacy/src/test/java/webhook/teamcity/test/springmock/MockProjectManager.java
tcwebhooks-rest-api-legacy/src/test/java/webhook/teamcity/test/springmock/MockSBuildServer.java
tcwebhooks-rest-api-legacy/src/test/java/webhook/teamcity/test/springmock/MockSecurityContext.java
e45f612c Attempt to filter out webhooks for non-applicable build events
05fa6aba Remove references to method that was removed from TC REST API
tcwebhooks-rest-api-legacy/src/main/java/webhook/teamcity/server/rest/model/parameter/ProjectWebhookParameters.java
tcwebhooks-rest-api-legacy/src/main/java/webhook/teamcity/server/rest/model/webhook/ProjectWebHookParameters.java
- Switch to another branch just in case...
git checkout -b tcwebhooks-rest-api-legacy
- Prune all the empty commits
git filter-branch --prune-empty -f
- Switch back to normal repo
cd ../tcWebHooks
- Add
testing
repo as a local "remote" named tcwebhooks-rest-api-legacy
git remote add tcwebhooks-rest-api-legacy ../testing
and then fetch itgit fetch tcwebhooks-rest-api-legacy
- Merge in the "remote" repo and branch
git merge tcwebhooks-rest-api-legacy/tcwebhooks-rest-api-legacy --allow-unrelated-histories
This is now done. A 2.0.0
final release is out, and I've also updated the Jetbrains plugin marketplace.