Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(health): add cryostatVersion #650

Merged
merged 4 commits into from
Aug 19, 2021

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Aug 19, 2021

Fixes #649

Depends on cryostatio/cryostat-web#241

$ https :8181/health
HTTP/1.1 200 OK
content-encoding: gzip
content-length: 117
content-type: application/json

{
    "cryostatVersion": "v2.0.0-SNAPSHOT-188-ga975bef7",
    "dashboardAvailable": false,
    "datasourceAvailable": false
}

@andrewazores andrewazores added the feat New feature or request label Aug 19, 2021
@andrewazores andrewazores requested a review from ebaron August 19, 2021 02:17
@andrewazores
Copy link
Member Author

Huh, the git describe run by maven-exec-plugin exits with a 128 status code in the CI runner. Any idea why that is?

@ebaron
Copy link
Member

ebaron commented Aug 19, 2021

That is odd. What about trying git rev-parse --short HEAD? (https://stackoverflow.com/a/949391)

@andrewazores
Copy link
Member Author

andrewazores commented Aug 19, 2021

That could work, but it just gives the shortened hash of the current commit - I was hoping to get the name of the tag pointing to the current commit, if any, which git describe does do (ex. v2.0.0-SNAPSHOT-189-gcad25f27 on this branch, but if you check out a tag then it just outputs the tag name).

In particular, I wanted the human-readable tag name output because I think this will end up displayed somewhere in -web. But the short hash is probably good enough.

@andrewazores
Copy link
Member Author

andrewazores commented Aug 19, 2021

Ah, I think the problem with describe is probably because of the way that the actions/checkout@v2 goes about cloning the repo and pulling the PR branch.

$ git init foo
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /tmp/tmp.o2Q4MzzzXf/foo/.git/
$ cd foo
$ git describe
fatal: No names found, cannot describe anything.
$ echo $?
128

Looks like there are no tags present, so describe prints out that error and exits with the 128 status.

@andrewazores
Copy link
Member Author

Looks like that worked. I'm putting together a small -web PR as well that goes with this, so I'll update this PR with a commit to update the web-client submodule as well after that is ready and merged in the -web side.

@github-actions
Copy link
Contributor

🎉 Great news! Looks like all the dependencies have been resolved:

💡 To add or remove a dependency please update this issue/PR description.

Brought to you by Dependent Issues (:robot: ). Happy coding!

pom.xml Outdated Show resolved Hide resolved
Copy link
Member

@ebaron ebaron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With your feature branch checked out, I get this:

$ git describe --dirty --long --always
v0.20.0-209-gc4ed02f8

Kinda weird, but maybe not an issue in practice.

@andrewazores
Copy link
Member Author

Hmm, there should be a more recent "ancestor" tag than v0.20.0. What if you do a git fetch --tags upstream (or whatever you have named the remote)? I see:

$ git describe --dirty --long --always
v2.0.0-SNAPSHOT-192-gc4ed02f8

@andrewazores
Copy link
Member Author

If I check out that v2.0.0-SNAPSHOT tag specifically rather than this feature branch, then the output is v2.0.0-SNAPSHOT-0-g0a4045cf, which I think looks pretty good. It's a very precise description that this is exactly the commit with that named tag.

@ebaron
Copy link
Member

ebaron commented Aug 19, 2021

That did the trick. I see the same now.

@andrewazores andrewazores merged commit c83f085 into cryostatio:main Aug 19, 2021
@andrewazores andrewazores deleted the resource-vcs-version branch August 19, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build should include git tag/hash as resource
2 participants