Skip to content

Specifying the maximum files listed in a change set

netwolfuk edited this page Nov 13, 2019 · 7 revisions

Since v1.1.352.395 and v1.2.0-alpha.4

Specifying the maximum files listed in a change set

When tcWebHooks processes the build object to create the payload for a webhook, it build a changes object which contains an array of the changes relevant to the build. See the following example:

    "changes": [
      {
        "version": "fff02ffeedaef9adf5efe81bb485cb56a58c3f5d",
        "change": {
          "files": [
            "tcwebhooks-core/src/main/java/webhook/teamcity/payload/content/WebHookPayloadContent.java",
            "tcwebhooks-core/src/main/java/webhook/teamcity/payload/content/WebHooksChange.java",
            "tcwebhooks-core/src/main/java/webhook/teamcity/payload/content/WebHooksChangeBuilder.java",
            "tcwebhooks-core/src/test/java/webhook/teamcity/payload/content/WebHookPayloadContentChangesTest.java"
          ],
          "comment": "Add ability to limit or exclude vcs file list whilst building payload",
          "username": "netwolfuk",
          "vcsRoot": "github-tcwebhooks"
        }
      },
      {
        "version": "d489de89fa31a7db23e7cc2a98e347dd175ed0a0",
        "change": {
          "files": [
            "tcwebhooks-core/src/main/java/webhook/teamcity/payload/content/WebHookPayloadContent.java"
          ],
          "comment": "Use java 7 for 1.1.x.x",
          "username": "netwolfuk",
          "vcsRoot": "github-tcwebhooks"
        }
      },
      {
        "version": "c72e4a7cd653e6651d2931ce3c5d53fb7ee3274c",
        "change": {
          "files": [
            "tcwebhooks-core/src/main/java/webhook/teamcity/BuildStateEnum.java",
            "tcwebhooks-core/src/main/java/webhook/teamcity/payload/content/WebHookPayloadContent.java"
          ],
          "comment": "Set \"running\" status to something relevant to result.\n\nAddresses issue #138",
          "username": "netwolfuk",
          "vcsRoot": "github-tcwebhooks"
        }
      }
    ]

This change includes the following new features:

  1. The list of changed VCS files can be disabled.
  2. The list of changed VCS files can be disabled if it is too large. The default value is 100 files across all changes in a build.

NOTE: In the cases where the change list is disabled or too large (1 & 2 above), the payload will contain a null files list. This is preferable to returning an empty list, because the empty list implies no actual changed files were included in the change. A null change list will typically be serialised to nothing in JSON or XML, so the json array or xml element will be missing from the payload. If your endpoint is expecting these, then it should fail in this scenario or handle the missing field gracefully.

Enables control over whether or not to include the list of files in a change. This can be enabled in the three ways below, in order of priority.

  1. Add a 'param' named 'includeChangeFileList' to a webhook config by editing plugin-settings.xml
  2. Add a build parameter to a buildType or project called 'webhook.includeChangeFileList'
  3. Define a property in teamcity's internal properties file called 'webhook.includeChangeFileList'.

The value must be a string representation of a boolean. eg, "true" or anything else will evaluate to false.

Enables control over the maximum number of files changed in a build before the changed file list is null. This can be controlled in the three ways below, in order of priority.

  1. Add a 'param' named 'maxChangeFileListSize' to a webhook config by editing plugin-settings.xml
  2. Add a build parameter to a buildType or project called 'webhook.maxChangeFileListSize'
  3. Define a property in teamcity's internal properties file called 'webhook.maxChangeFileListSize'

If the total number of files is greater than maxChangeFileListSize, then the change list will be null. See note above.

Clone this wiki locally