Skip to content

build: include git-describe version as part of the bot in /ping command#1422

Draft
christolis wants to merge 1 commit intoTogether-Java:developfrom
christolis:feat/git-version
Draft

build: include git-describe version as part of the bot in /ping command#1422
christolis wants to merge 1 commit intoTogether-Java:developfrom
christolis:feat/git-version

Conversation

@christolis
Copy link
Member

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. :)

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>
Copy link
Member

@Zabuzard Zabuzard left a comment

Choose a reason for hiding this comment

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

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

@marko-radosavljevic
Copy link
Contributor

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. ☺️ ❤️

@tj-wazei
Copy link
Contributor

tj-wazei commented Mar 6, 2026

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 .woodpecker.yml update the publish block:

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

${CI_COMMIT_SHA} is automatically provided by Woodpecker.

Then when you're creating your /version slash command or when the bot is loading:

Properties props = new Properties();
try (InputStream is = Application.class.getResourceAsStream("/version.properties")) {
    props.load(is);
}
...
String ref = props.getProperty("git.commit");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants