tcplugins / tcWebHooks

WebHooks plugin for Teamcity. Supports many build states and payload formats.
https://netwolfuk.wordpress.com/category/teamcity/tcplugins/tcwebhooks/
155 stars 30 forks source link

Support 2024.03 and also previous TeamCity versions #239

Closed netwolfuk closed 5 months ago

netwolfuk commented 5 months ago

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:

netwolfuk commented 5 months ago

Process to "copy" tcwebhooks-rest-api to tcwebhook-rest-api-legacy

  1. Clone to alternative location git clone -s . ../testing to create a new repo named "testing" (terrible name).

  2. cd ../testing to move to new repo

  3. git checkout -b sliced to change to new branch

  4. Filter and rename the dir using filter-branch as per https://stackoverflow.com/a/28840897

    git 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`
    '
  5. 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 with git 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
  6. Switch to another branch just in case... git checkout -b tcwebhooks-rest-api-legacy

  7. Prune all the empty commits git filter-branch --prune-empty -f

  8. Switch back to normal repo cd ../tcWebHooks

  9. Add testing repo as a local "remote" named tcwebhooks-rest-api-legacy git remote add tcwebhooks-rest-api-legacy ../testing and then fetch it git fetch tcwebhooks-rest-api-legacy

  10. Merge in the "remote" repo and branch git merge tcwebhooks-rest-api-legacy/tcwebhooks-rest-api-legacy --allow-unrelated-histories

netwolfuk commented 5 months ago

This is now done. A 2.0.0 final release is out, and I've also updated the Jetbrains plugin marketplace.