Tco - an Update

I’ve added some more features to tco. Some of you might find them interesting. Here is a quick summary.

tco deploy-status

tco deploy-status shows on which installations a change / commit has been deployed:

$ tco deploy-status ae0995b93d6122db034419f66ccfa7f856c59a74
[2023-04-03T07:04:42Z ERROR tco::subcommand::deploy_status] Failed to process installation abc: reqwest: HTTP status server error (503 Service Unavailable) for url (https://abc.tocco.ch/status-tocco?db-check=false)
unknown     v1000.0  abc
…
deployed    v3.1     test301
deployed    v3.2     test302
deployed    v3.3     test303
deployed    v3.4     test304
deployed    v3.5     test305
…
undeployed  v2.27    test227
undeployed  v2.28    test228
undeployed  v2.29    test229
…

If you have commit “aaaaaaaaaaaaa” introducing a bug and “bbbbbbbbbbbbb” fixing it, use the following to show affected installations:

$ tco deploy-status --introduced-in aaaaaaaaaaaaa bbbbbbbbbbbbb
…
deployed    v3.1     test301     # Fix deployed
deployed    v3.2     test302     #
deployed    v3.3     test303     #
deployed    v3.4     test304     #
deployed    v3.5     test305     #
…
undeployed  v2.27    test227     # Buggy commit deployed, fix missing
…
unaffected  v2.28    test228     # Buggy commit never deployed
unaffecded  v2.29    test229     #

The current implementation isn’t very fast and checking the status for all installations can take up to two minutes. You can use -e prod or -e test to limit output to production or test systems, respectively, which speeds up things a bit.

For changes backported (e.g. via cherry-pick or reimplementation), specify all commit IDs, the ID of the primary fix and those of all backports:

$ tco deploy-status ae0995b93d61 57a4f2df97de8 7125f1fa2a4df
…

The change is considered deployed when any of the given commits is deployed.

Use tco deploy-status --help to see all available options.

EDIT:

This functionality has been extended to the tocco-client repository:

$ tco client-deploy-status -h
Show where specified commit is deployed (tocco-client repo)

Usage: tco client-deploy-status [OPTIONS] <PACKAGE> <REV_SPECS>...

Arguments:
  <PACKAGE>       Package for which to check deployment status
  <REV_SPECS>...  Commit to check if deployed

Use tco client-deploy-status --help to see all available options.

tco config

tco config shows the raw config of an installation as defined in config.yml:

$ tco config master
tocco:
  hsts_secs: '{{ 86400 * 720 }}'
  mail_domains:
    tocco.ch:
  installations:
    toccotest:
      branch: releases/3.5
      db_server: db1.stage.tocco.cust.vshn.net

Shown is the customer and installation config.

You can also show the line numbers to ease finding it in config.yml:

$ tco config -n master
 2073: tocco:
 2074:   hsts_secs: '{{ 86400 * 720 }}'
 2075:   mail_domains:
 2076:     tocco.ch:
 2077:   installations:
 2096:     toccotest:
 2097:       branch: releases/3.5
 2098:       db_server: db1.stage.tocco.cust.vshn.net

Use tco config --help to see all available options.

tco log / tco customer-log

There have already been a number of subcommands which showed which commits were not deployed yet. tco log and tco customer-log do the opposite and show all commits deployed.

tco log shows all commits deployed to an installation. This excludes merge commits and commits only touching other customers:

$ tco log master
commit 852a5e2fc0785eae0ac19c61ac2071c103c0b0b6
Author: John Doe <jdoe2@tocco.ch>
Date:   Fri Mar 31 07:36:59 2023 +0200

    move files to widgetforms

    Refs: TOCDEV-6673, TOCDEV-6967
    Change-Id: Ie3d3b3039b3ecec503668b36bae2619ceb62f1e5
    Reviewed-on: https://git.tocco.ch/c/nice2/+/48411
    Tested-by: Teamcity CI <teamcity@tocco.ch>
    Reviewed-by: Leonard Butz <lbutz@tocco.ch>

commit 53e93e0ede3a431cc314f8908816dcf36daf8b83 (origin/releases/3.1)
Author: Jane Doe <jdoe@tocco.ch>
Date:   Tue Mar 28 16:29:29 2023 +0200

    adjust EvaluateConflictStatusBatchJob for standard

    - check if module 'nice.optional.reservation' exists
    - add method 'hasModule' to ModuleManager

    Refs: TOCDEV-6823

tco customer-log limits the output to customer-specific commits.

Use tco log --help / tco customer-log --help to see all available options.

Args to git log

Some subcommands listing commits call git log to show the result. This includes the new tco log and tco customer-log but also some older subcommands like tco customer-undeployed or prod-undeployed.

All of them now accept additional, positional arguments to be passed to git log.

Show only commits with “BatchJob” in the commit message:

$ tco log master -- --grep BatchJob

Show all commits that add or remove the string “EvaluateConflictStatusBatchJob” within any file:

$ tco log master -- -G EvaluateConflictStatusBatchJob

See also git log(1).

tco memory

tco memory shows memory settings and usage:

$ tco memory
                   |<  <  <  <  SOURCE: ANSIBLE   >  >  >|< SOURCE: STATUS PAGE / JAVA HEAP >
INSTALLATION       |        CONFIGURED     REQUEST       | MAX           USED       % USED
                   | VERSION         HEAP          LIMIT |       TOTAL          FREE

…
test227              v2.27     2.7    1.3    2.7    5.7    1.3    1.2    1.1    0.2   82%
test228              v2.28     2.7    1.3    2.7    5.7    1.3    1.2    0.7    0.4   57%
test229              v2.29     2.7    1.3    2.7    5.7    1.3    1.1    0.9    0.2   69%
test301              v3.1      2.7    1.3    2.7    5.7    1.3    1.1    0.7    0.4   56%
test302              v3.2      2.7    1.3    2.7    5.7    1.3    1.0    0.8    0.2   64%
test303              v3.3      2.7    1.3    2.7    5.7    1.3    1.1    0.9    0.2   69%
test304              v3.4      2.7    1.3    2.7    5.7    1.3    1.3    1.1    0.2   83%
test305              v3.5      2.7    1.3    2.7    5.7    1.3    1.2    0.7    0.5   55%
…

There is also a --csv flag which will print this in a easier-to-process CSV format.

Use tco memory --help to see all available options.