Skip to content

Commit

Permalink
Merge pull request #1916 from camptocamp/backport/1915-to-master
Browse files Browse the repository at this point in the history
[Backport master] Print version only of pre-installed application and c2cciutils
  • Loading branch information
sbrunner authored Sep 9, 2024
2 parents 4e014ba + 87a1cbb commit 17a0da9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 31 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ jobs:

steps:
- run: docker system prune --all --force
- run: dpkg -l
- run: pip install pyOpenSSL --upgrade
- run: python3 -m pip freeze

- uses: actions/checkout@v4
with:
Expand Down
21 changes: 3 additions & 18 deletions c2cciutils/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,18 +456,15 @@ class K8SConfiguration(TypedDict, total=False):


PRINT_VERSIONS_VERSIONS_DEFAULT = [
{"name": "c2cciutils", "cmd": ["c2cciutils", "--version"]},
{"name": "python", "cmd": ["python3", "--version"]},
{"name": "pip", "cmd": ["python3", "-m", "pip", "--version"]},
{"name": "twine", "cmd": ["twine", "--version"]},
{"name": "node", "prefix": "node ", "cmd": ["node", "--version"]},
{"name": "npm", "prefix": "npm ", "cmd": ["npm", "--version"]},
{"name": "make", "cmd": ["make", "--version"], "prefix": "make "},
{"name": "make", "cmd": ["make", "--version"]},
{"name": "docker", "cmd": ["docker", "--version"]},
{"name": "docker compose", "cmd": ["docker", "compose", "version"]},
{"name": "java", "cmd": ["java", "-version"]},
{"name": "kubectl", "cmd": ["kubectl", "version"]},
{"name": "helm", "cmd": ["helm", "version"]},
{"name": "helm", "cmd": ["helm", "version"], "prefix": "HELM: "},
]
""" Default value of the field path 'Print versions versions' """

Expand Down Expand Up @@ -582,10 +579,6 @@ class PrintVersions(TypedDict, total=False):
Print versions versions.
default:
- cmd:
- c2cciutils
- --version
name: c2cciutils
- cmd:
- python3
- --version
Expand All @@ -596,10 +589,6 @@ class PrintVersions(TypedDict, total=False):
- pip
- --version
name: pip
- cmd:
- twine
- --version
name: twine
- cmd:
- node
- --version
Expand All @@ -614,7 +603,6 @@ class PrintVersions(TypedDict, total=False):
- make
- --version
name: make
prefix: 'make '
- cmd:
- docker
- --version
Expand All @@ -628,14 +616,11 @@ class PrintVersions(TypedDict, total=False):
- java
- -version
name: java
- cmd:
- kubectl
- version
name: kubectl
- cmd:
- helm
- version
name: helm
prefix: 'HELM: '
"""


Expand Down
7 changes: 2 additions & 5 deletions c2cciutils/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,18 +451,15 @@
"title": "Print versions versions",
"type": "array",
"default": [
{ "name": "c2cciutils", "cmd": ["c2cciutils", "--version"] },
{ "name": "python", "cmd": ["python3", "--version"] },
{ "name": "pip", "cmd": ["python3", "-m", "pip", "--version"] },
{ "name": "twine", "cmd": ["twine", "--version"] },
{ "name": "node", "prefix": "node ", "cmd": ["node", "--version"] },
{ "name": "npm", "prefix": "npm ", "cmd": ["npm", "--version"] },
{ "name": "make", "cmd": ["make", "--version"], "prefix": "make " },
{ "name": "make", "cmd": ["make", "--version"] },
{ "name": "docker", "cmd": ["docker", "--version"] },
{ "name": "docker compose", "cmd": ["docker", "compose", "version"] },
{ "name": "java", "cmd": ["java", "-version"] },
{ "name": "kubectl", "cmd": ["kubectl", "version"] },
{ "name": "helm", "cmd": ["helm", "version"] }
{ "name": "helm", "cmd": ["helm", "version"], "prefix": "HELM: " }
],
"items": {
"type": "object",
Expand Down
7 changes: 2 additions & 5 deletions c2cciutils/scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ def main() -> None:
print(yaml.dump(c2cciutils.get_config(), default_flow_style=False, Dumper=yaml.SafeDumper))

if args.version:
for pkg in ("c2cciutils", "black", "isort"):
try:
print(f"{pkg} {pkg_resources.get_distribution(pkg).version}")
except pkg_resources.DistributionNotFound:
print(f"{pkg} missing")
version = pkg_resources.get_distribution("c2cciutils").version
print(f"c2cciutils {version}")

if args.ls_files_mime:
for file_name in c2cciutils.get_git_files_mime(args.ls_files_mime):
Expand Down
2 changes: 1 addition & 1 deletion config.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ _C2C CI utils configuration file_
- **Items** _(string)_
- : Must be: `false`.
- <a id="definitions/print_versions"></a>**`print_versions`** _(object)_: The print versions configuration.
- **`versions`** _(array)_: Default: `[{"name": "c2cciutils", "cmd": ["c2cciutils", "--version"]}, {"name": "python", "cmd": ["python3", "--version"]}, {"name": "pip", "cmd": ["python3", "-m", "pip", "--version"]}, {"name": "twine", "cmd": ["twine", "--version"]}, {"name": "node", "prefix": "node ", "cmd": ["node", "--version"]}, {"name": "npm", "prefix": "npm ", "cmd": ["npm", "--version"]}, {"name": "make", "cmd": ["make", "--version"], "prefix": "make "}, {"name": "docker", "cmd": ["docker", "--version"]}, {"name": "docker compose", "cmd": ["docker", "compose", "version"]}, {"name": "java", "cmd": ["java", "-version"]}, {"name": "kubectl", "cmd": ["kubectl", "version"]}, {"name": "helm", "cmd": ["helm", "version"]}]`.
- **`versions`** _(array)_: Default: `[{"name": "python", "cmd": ["python3", "--version"]}, {"name": "pip", "cmd": ["python3", "-m", "pip", "--version"]}, {"name": "node", "prefix": "node ", "cmd": ["node", "--version"]}, {"name": "npm", "prefix": "npm ", "cmd": ["npm", "--version"]}, {"name": "make", "cmd": ["make", "--version"]}, {"name": "docker", "cmd": ["docker", "--version"]}, {"name": "docker compose", "cmd": ["docker", "compose", "version"]}, {"name": "java", "cmd": ["java", "-version"]}, {"name": "helm", "cmd": ["helm", "version"], "prefix": "HELM: "}]`.
- **Items** _(object)_
- **`cmd`** _(array)_: The command that should be used.
- **Items** _(string)_
Expand Down

0 comments on commit 17a0da9

Please sign in to comment.