Add the short SHA to develop containers.#158
Add the short SHA to develop containers.#158JohnVillalovos wants to merge 1 commit intoLibreBooking:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds the ability to append the LibreBooking short commit SHA to the develop container UI version display, and introduces a GitHub Actions workflow to build the Docker image for pull requests.
Changes:
- Enhance the Docker build to optionally extract the short SHA from the GitHub tarball directory name and append it to the UI footer (and write
build-info.txt). - Document the new build arg (
APP_GH_ADD_SHA) inBUILD.mdand enable it for develop builds. - Add a PR CI workflow and plumb a reusable workflow input (
appAddSha) through the build/publish pipeline.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
Dockerfile |
Downloads the LibreBooking tarball to derive a short SHA and optionally updates the footer version string. |
BUILD.md |
Documents and wires APP_GH_ADD_SHA for develop vs release builds. |
.github/workflows/build_pull_request.yml |
New workflow to build the image on pull_request. |
.github/workflows/build_image_develop.yml |
Enables SHA appending for scheduled/manual develop image builds via reusable workflow input. |
.github/workflows/build_and_publish.yml |
Adds appAddSha workflow_call input and passes it through as APP_GH_ADD_SHA. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f4b2542 to
4818f1a
Compare
4818f1a to
9a530de
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9a530de to
227d180
Compare
|
|
||
| # Get and customize librebooking | ||
| ARG APP_GH_REF | ||
| ARG APP_GH_ADD_SHA=false |
There was a problem hiding this comment.
Argument APP_GH_ADD_SHA is not really needed, for its value depends on the value of argument APP_GH_REF:
| APP_GH_REF | APP_GH_ADD_SHA |
|---|---|
| refs/tags/* | false |
| refs/heads/develop | true |
There was a problem hiding this comment.
I did that at first but I have plans at some point to move development to the main branch. So I didn't want to embed the logic of deciding if something is a development versus release based on the name.
I thought it would be better to be explicit.
It seems like APP_GH_REF passes values like v4.1.0 and develop. Does it use values like refs/heads/develop?
There was a problem hiding this comment.
Argument APP_GH_REF always contains the refs/* path.
Henceforth argument APP_GH_ADD_SHA can be derived as follows:
- APP_GH_REF starts with refs/tags -> this is a release and APP_GH_ADD_SHA = false
- APP_GH_REF starts with refs/heads -> this is the "development" version and APP_GH_ADD_SHA = true
If you are OK with the above, then you can drop the APP_GH_ADD_SHA argument
| uses: ./.github/workflows/build_and_publish.yml | ||
| with: | ||
| appGitRefs: develop | ||
| appAddSha: true |
There was a problem hiding this comment.
The value of appAddSha can be derived from appGitRefs:
| appGitrefs | appAddSha |
|---|---|
| develop | true |
| v* | false |
There was a problem hiding this comment.
I did that at first but I have plans at some point to move development to the main branch. So I didn't want to embed the logic of deciding if something is a development versus release based on the name.
I thought it would be better to be explicit.
There was a problem hiding this comment.
Adapt, based on your final decision regarding Dockerfile after my last comment
227d180 to
7f0bb2a
Compare
JohnVillalovos
left a comment
There was a problem hiding this comment.
Thanks for the feedback. I will work on incorporating that into the next version
| uses: ./.github/workflows/build_and_publish.yml | ||
| with: | ||
| appGitRefs: develop | ||
| appAddSha: true |
There was a problem hiding this comment.
I did that at first but I have plans at some point to move development to the main branch. So I didn't want to embed the logic of deciding if something is a development versus release based on the name.
I thought it would be better to be explicit.
|
|
||
| # Get and customize librebooking | ||
| ARG APP_GH_REF | ||
| ARG APP_GH_ADD_SHA=false |
There was a problem hiding this comment.
I did that at first but I have plans at some point to move development to the main branch. So I didn't want to embed the logic of deciding if something is a development versus release based on the name.
I thought it would be better to be explicit.
It seems like APP_GH_REF passes values like v4.1.0 and develop. Does it use values like refs/heads/develop?
7f0bb2a to
79a5d67
Compare
79a5d67 to
f1d6a46
Compare
|
As said, I don't know github actions, but I looked at the shell script parts. Looks good to me. |
| --show-error \ | ||
| --location ${LB_TARBALL_URL} \ | ||
| | sed -nE 's/.*filename="?([^";]+)"?.*/\1/p' \ | ||
| | tail -n1); \ |
There was a problem hiding this comment.
Why do you need to tail ?
I believe that you only get 1 line
| --location ${LB_TARBALL_URL} \ | ||
| | sed -nE 's/.*filename="?([^";]+)"?.*/\1/p' \ | ||
| | tail -n1); \ | ||
| echo TARBALL_FILENAME ${TARBALL_FILENAME}; \ |
There was a problem hiding this comment.
No need to print the value of TARBALL_FILENAME.
Looks like a "debug" ...
| | sed -nE 's/.*filename="?([^";]+)"?.*/\1/p' \ | ||
| | tail -n1); \ | ||
| echo TARBALL_FILENAME ${TARBALL_FILENAME}; \ | ||
| LB_SHORT_SHA=$(echo $TARBALL_FILENAME | sed -E 's/.*-g([0-9a-f]+)\.tar\.gz/\1/'); \ |
There was a problem hiding this comment.
I would add the | sed -E 's/.*-g([0-9a-f]+)\.tar\.gz/\1/' to the previous long pipe statement, so that the hash is done in one shot
| LB_SHORT_SHA=$(echo $TARBALL_FILENAME | sed -E 's/.*-g([0-9a-f]+)\.tar\.gz/\1/'); \ | ||
| if [ -n "${LB_SHORT_SHA}" ]; then \ | ||
| printf '%s\n' "${LB_SHORT_SHA}" > /var/www/html/config/version-suffix.txt; \ | ||
| else \ |
There was a problem hiding this comment.
I would drop the else part of the if block
This is taking advantage of the ability to put a value in
config/version-suffix.txtLibreBooking/librebooking#1093 added that feature