build: include git-describe version as part of the bot in /ping command#1422
build: include git-describe version as part of the bot in /ping command#1422christolis wants to merge 1 commit intoTogether-Java:developfrom
Conversation
It is uncertain on which version the bot is running in production, and
those with a lack of access to the production infrastructure have almost
no way to get such information.
Expand the "/ping" slash command to actually mention which version it is
running as well as the date on which it was built, more specfifically it
now says:
> Pong! Running on version v1.2.3-g1a2b3c (2026-02-28)
That way we don't have to approach the lucky few folks with access and
badger them with primitive questions. :)
Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>
Zabuzard
left a comment
There was a problem hiding this comment.
the /ping command acts as minimal and simplest introduction for learners.
i would appreciate not cluttering up its code and its unit-test for this feature.
we can add a /version command instead. i like the idea in general but have some doubts whether this will work properly in all environments, on the VPS, with docker and whatnot. so would be great if @marko-radosavljevic or @tj-wazei will review this
|
It's also not something contributor should worry about. Prod is always latest commit on master, unless something is seriously broken. And if something is seriously broken, only people with access to the vps are the ones that can fix it anyway. Dev server is always latest commit on dev, CI/CD is automatic, so everything happens on push. You can see successful deployment by passing gh actions on merge. Nobody pushes or does to these branches otherwise, they are protected. I don't want to add unnecessary confusion and noise to beginners, and we never had issues with version confusion in 5 years of the project lifecycle. We can have a /version command, I guess. Should be easy to implement, and I will give my review to make sure it works reliably in our environment. |
|
As Marko has said, the bot is always going to be based on master as a merge is a deployment, unless something goes wrong. Regardless of if we should implement this or not, the solution is not implemented in the best way. We shouldn't be doing this in Gradle and instead in the CI/CD process. My preferred approach would look something like this: Inside steps:
publish:
image: eclipse-temurin:25-jdk
environment:
REGISTRY_USER:
from_secret: REGISTRY_USER
REGISTRY_PASSWORD:
from_secret: REGISTRY_PASSWORD
BRANCH_NAME: ${CI_COMMIT_BRANCH}
commands:
- echo ${CI_COMMIT_BRANCH}
- echo "git.commit=${CI_COMMIT_SHA}" > application/src/main/resources/version.properties # add this line
- ./gradlew jib
Then when you're creating your Properties props = new Properties();
try (InputStream is = Application.class.getResourceAsStream("/version.properties")) {
props.load(is);
}
...
String ref = props.getProperty("git.commit"); |
It is uncertain on which version the bot is running in production, and those with a lack of access to the production infrastructure have almost no way to get such information.
Expand the "/ping" slash command to actually mention which version it is running as well as the date on which it was built, more specfifically it now says:
That way we don't have to approach the lucky few folks with access and badger them with primitive questions. :)