Version string verbosity #1748

Closed
opened 2026-04-06 02:21:07 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @strump on 2/11/2023

Build script doesn't produce version string if no git history is available.

Steps to reproduce:

  1. Clone repo with no history (Mogenius.com does this): git clone --depth 1 https://github.com/dani-garcia/vaultwarden.git
  2. Build docker image: docker build --build-arg DB=sqlite -f docker/amd64/Dockerfile -t vaultwarden:local .
  3. Run it: docker run -it --rm vaultwarden:local

Actual result: no version information in output

/--------------------------------------------------------------------\
|                        Starting Vaultwarden                        |
|--------------------------------------------------------------------|
| This is an *unofficial* Bitwarden implementation, DO NOT use the   |
| official channels to report bugs/features, regardless of client.   |
| Send usage/configuration questions or feature requests to:         |
|   https://vaultwarden.discourse.group/                             |
| Report suspected bugs/issues in the software itself at:            |
|   https://github.com/dani-garcia/vaultwarden/issues/new            |
\--------------------------------------------------------------------/

After this PR:

/--------------------------------------------------------------------\
|                        Starting Vaultwarden                        |
|             Version main-7d7da921 2023-02-11 17:27:10              |
|--------------------------------------------------------------------|
| This is an *unofficial* Bitwarden implementation, DO NOT use the   |
| official channels to report bugs/features, regardless of client.   |
| Send usage/configuration questions or feature requests to:         |
|   https://vaultwarden.discourse.group/                             |
| Report suspected bugs/issues in the software itself at:            |
|   https://github.com/dani-garcia/vaultwarden/issues/new            |
\--------------------------------------------------------------------/

Description:

  • Last tag is now optional.
  • Timestamp is added to version string.

Four types of version string are generated in build.rs:

  1. Main branch + last tag → {last_tag}-{rev_short} {commit_time}
  2. Main branch → main-{rev_short} {commit_time}
  3. Non-main branch + last tag → {last_tag}-{rev_short} ({branch}) {commit_time}
  4. Non-main branch → {rev_short} ({branch}) {commit_time}
*Originally created by @strump on 2/11/2023* Build script doesn't produce version string if no git history is available. **Steps to reproduce:** 1. Clone repo with **no history** (Mogenius.com does this): `git clone --depth 1 https://github.com/dani-garcia/vaultwarden.git` 2. Build docker image: `docker build --build-arg DB=sqlite -f docker/amd64/Dockerfile -t vaultwarden:local .` 3. Run it: `docker run -it --rm vaultwarden:local` **Actual result**: no version information in output ``` /--------------------------------------------------------------------\ | Starting Vaultwarden | |--------------------------------------------------------------------| | This is an *unofficial* Bitwarden implementation, DO NOT use the | | official channels to report bugs/features, regardless of client. | | Send usage/configuration questions or feature requests to: | | https://vaultwarden.discourse.group/ | | Report suspected bugs/issues in the software itself at: | | https://github.com/dani-garcia/vaultwarden/issues/new | \--------------------------------------------------------------------/ ``` **After this PR:** ``` /--------------------------------------------------------------------\ | Starting Vaultwarden | | Version main-7d7da921 2023-02-11 17:27:10 | |--------------------------------------------------------------------| | This is an *unofficial* Bitwarden implementation, DO NOT use the | | official channels to report bugs/features, regardless of client. | | Send usage/configuration questions or feature requests to: | | https://vaultwarden.discourse.group/ | | Report suspected bugs/issues in the software itself at: | | https://github.com/dani-garcia/vaultwarden/issues/new | \--------------------------------------------------------------------/ ``` **Description:** * Last tag is now optional. * Timestamp is added to version string. Four types of version string are generated in build.rs: 1. Main branch + last tag → `{last_tag}-{rev_short} {commit_time}` 2. Main branch → `main-{rev_short} {commit_time}` 3. Non-main branch + last tag → `{last_tag}-{rev_short} ({branch}) {commit_time}` 4. Non-main branch → `{rev_short} ({branch}) {commit_time}`
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#1748