plugins: for_all_repos: Add support for commit/branch

Add corresponding environment variables for the new keys and declare the
existing KAS_REPO_REFSPEC as deprecated in lock-step with the key it
mirrors.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2023-05-30 17:37:02 +02:00
parent 241d03f159
commit 0d268197a4

View File

@ -48,9 +48,19 @@
* ``KAS_REPO_URL``: The URL from which this repository was cloned, or an
empty string if no remote URL was given in the config file.
* ``KAS_REPO_COMMIT``: The commit ID which was checked out for this
repository, or an empty string if no commit was given in the config
file.
* ``KAS_REPO_BRANCH``: The branch which was checked out for this
repository, or an empty string if no branch was given in the config
file.
* ``KAS_REPO_REFSPEC``: The refspec which was checked out for this
repository, or an empty string if no refspec was given in the config
file.
file. This variable is obsolete and will be removed when support for
respec keys is removed as well. Migrate your repos to commit/branch
and use the related variables instead.
"""
import logging
@ -107,6 +117,8 @@ class ForAllReposCommand(Command):
'KAS_REPO_NAME': repo.name,
'KAS_REPO_PATH': repo.path,
'KAS_REPO_URL': '' if repo.operations_disabled else repo.url,
'KAS_REPO_COMMIT': repo.commit or '',
'KAS_REPO_BRANCH': repo.branch or '',
'KAS_REPO_REFSPEC': repo.refspec or '',
}
logging.info('%s$ %s', repo.path, self.command)