scripts/app_manager: Add subcommand to manipulate tags
This will allow to:
- retrieve the last known tag for an application
- determine the next tag for an application (be it known or not)
- current list of tags of an application
This will raise when:
- providing both --next-tag and --last-tag for an application
- listing tags for an unknown application
- retrieving the last tag on an unknown application
Note that this also updates the pre-commit config to align it with the usual python module and actually run a pass on it that my configuration did not do so far (as a separated commit).
Sample cli help message:
$ app_manager tag --help
Usage: app_manager.py tag [OPTIONS] COMMAND [ARGS]...
Manipulate application tag, for example either determine the last tag or
compute the next one. Without any parameters this lists the current
application tags.
Options:
--help Show this message and exit.
Commands:
latest
list
next
Sample use cases:
# new app tag
$ docker run -v $PWD:/src --user 1000 -it build-deps tag next swh-core
refs/tags/swh-core-20230118.1
# list tags on unknown app -> raise
$ docker run -v $PWD:/src --user 1000 -it build-deps tag list swh-core
...
ValueError: No tag to display for application 'swh-core'
# List last tag on unknown app -> raise
$ docker run -v $PWD:/src --user 1000 -it build-deps tag latest swh-core
...
ValueError: No tag to display for application 'swh-core'
# List tags from known apps
$ docker run -v $PWD:/src --user 1000 -it build-deps tag list swh-loader-package
swh-loader-package-20221026.1
swh-loader-package-20221020.1
swh-loader-package-20220926.1
swh-loader-package-20220921.1
swh-loader-package-20220914.1
swh-loader-package-20220909.1
swh-loader-package-20220908.1
# List last known tag from a known app
$ docker run -v $PWD:/src --user 1000 -it build-deps tag latest swh-loader-package
refs/tags/swh-loader-package-20221026.1
# List next tag from a known app (it will increment the increment if already packaged
# during the day)
$ docker run -v $PWD:/src --user 1000 -it build-deps tag next swh-loader-package
refs/tags/swh-loader-package-20230118.1
Edited by Antoine R. Dumont