redhat-developer / odo

odo - Developer-focused CLI for fast & iterative container-based application development on Podman and Kubernetes. Implementation of the open Devfile standard.
https://odo.dev
Apache License 2.0
788 stars 243 forks source link

Display Git commit ID in output of `odo` commands where the version is shown #7074

Closed rm3l closed 1 year ago

rm3l commented 1 year ago

What type of PR is this: /kind task

What does this PR do / why we need it: To help with troubleshooting, this PR appends the Git commit ID next to the odo version in the output of commands where the version is shown. This currently includes:

Furthermore, the Git commit ID displayed is enriched with the current state of the working tree, like -dirty if the working tree has local changes. This will help quickly understand the version and help troubleshoot commands that run in CI for example.

Example:

Before With the changes here
``` $ asdf exec odo deploy __ / \__ Running the application in Deploy mode using my-nodejs-app Devfile \__/ \ Namespace: default / \__/ odo version: v3.14.0 \__/ ``` ``` $ odo deploy __ / \__ Running the application in Deploy mode using the "my-nodejs-app" Devfile \__/ \ Namespace: default / \__/ odo version: v3.14.0 (6721c668b-dirty) \__/ ```

Which issue(s) this PR fixes: Fixes #6131

PR acceptance criteria:

How to test changes / Special notes to the reviewer:

netlify[bot] commented 1 year ago

Deploy Preview for odo-docusaurus-preview canceled.

Name Link
Latest commit 3c06ce04d59a1181135f27084db0fef8cb66d5bf
Latest deploy log https://app.netlify.com/sites/odo-docusaurus-preview/deploys/64f88aebdf7b170008df0474
odo-robot[bot] commented 1 year ago

OpenShift Unauthenticated Tests on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

NoCluster Tests on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

Unit Tests on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

Validate Tests on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

Kubernetes Tests on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

Windows Tests (OCP) on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

OpenShift Tests on commit 3328de7069fcb8744aba0aa2f42e3062149d4a6d finished successfully. View logs: TXT HTML

odo-robot[bot] commented 1 year ago

Kubernetes Docs Tests on commit adc96994d9a393c19999fc1247529a9fa088c816 finished successfully. View logs: TXT HTML

rm3l commented 1 year ago

In CI, we can see that the working tree has local changes, which is weird to me. I'm looking into this..

  [odo]   __
  [odo]  /  \__     Initializing a new component
  [odo]  \__/  \    
  [odo]  /  \__/    odo version: v3.14.0 (6721c668b-dirty)
  [odo]  \__/
  [odo] 
  [odo]  •  Downloading devfile "go:latest"  ...
  [odo] I0906 09:05:22.048551   11880 registry.go:5
sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

rm3l commented 1 year ago

In CI, we can see that the working tree has local changes, which is weird to me. I'm looking into this..

  [odo]   __
  [odo]  /  \__     Initializing a new component
  [odo]  \__/  \    
  [odo]  /  \__/    odo version: v3.14.0 (6721c668b-dirty)
  [odo]  \__/
  [odo] 
  [odo]  •  Downloading devfile "go:latest"  ...
  [odo] I0906 09:05:22.048551   11880 registry.go:5

Ok, the problem is that after cloning odo in CI, we are copying the local repo of odo to a temporary directory before running the tests. For the repo in the temporary directory not to be marked as dirty, the Git index needs to be refreshed (either manually or using other Git commands that can auto-refresh it), but that should not be an issue for the doc automation tests here. 3c06ce0 (#7074) just ignores the Git commit ID when comparing the outputs.

/hold cancel