Page MenuHomeVyOS Platform

Include commit hash from repos in nightly build release description


It would be helpful to be able to read the commit hashes used during the nightly build.


I am basing my tooling off of the api schemas, which for the nightly build means my tool must be recompiled to support any changes in those schemas.
As it stands now I am estimating the correct commit in the vyos-1x repo to use by looking up when the last successful build of the nightly ISO started, and trying to use that to checkout the correct commit.
If the commit ids were included in the release in some way the guesswork would be gone, knowing for sure I am using the same commit as the build, and would greatly simplify the process.
It would also be a nice increase in accuracy for the historical log of the nightly build releases.

I only need the vyos-1x commit, but for symmetry I also think the vyos-build repos commit should be included.

I think the change in the build actions would be fairly minimal, but since I cant really test any changes I make to the actions I don't want to send a PR that might not work anyway, however this would be my suggestion:

--- vyos-rolling-nightly-build.yml      2024-03-22 09:48:07.068235737 +0000
+++ vyos-rolling-nightly-build-patched.yml      2024-03-22 09:47:41.766813336 +0000
@@ -295,8 +295,10 @@
         run: |
           cd ./vyos-build
           echo "CHANGELOG_COMMIT_build=$(git log --since "${{ env.PREVIOUS_SUCCESS_BUILD_TIMESTAMP }}" --format="%H" --reverse | head -n1)" >> $GITHUB_ENV
+          echo "CHANGELOG_COMMIT_HEAD_build=$(git rev-parse HEAD)" >> $GITHUB_ENV
           cd ../vyos-1x
           echo "CHANGELOG_COMMIT_1x=$(git log --since "${{ env.PREVIOUS_SUCCESS_BUILD_TIMESTAMP }}" --format="%H" --reverse | head -n1)" >> $GITHUB_ENV
+          echo "CHANGELOG_COMMIT_HEAD_1x=$(git rev-parse HEAD)" >> $GITHUB_ENV
           GH_TOKEN: ${{ github.token }}
@@ -339,9 +341,9 @@
         if: ${{ !inputs.SKIP_RELEASE_PUBLISHING }} 
         run: |
           cat <<EOF >
-          ## vyos-1x
+          ## vyos-1x (${{ env.CHANGELOG_COMMIT_HEAD_1x }})
           ${{ steps.generate_changelog_for_vyos-1x.outputs.changelog }}
-          ## vyos-build
+          ## vyos-build (${{ env.CHANGELOG_COMMIT_HEAD_build }})
           ${{ steps.generate-build-changelog.outputs.changelog }}

The format and where the information is displayed is not really important for my use-case, but it being consistent is.


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Documentation update

Event Timeline

Sounds interesting but isn't it enough to query dpkg?

[email protected]:~$ dpkg -l | grep vyos-1x
ii  vyos-1x                              1.5dev0-1208-g946f93778          amd64        VyOS configuration scripts and data

Commit ID would be:

In theory that could work as a workaround as-well, it would be more precise than my current workaround, but would require the build process for my tool to download the iso, spin up a vm, and extract the info.

That all sounds awfully wasteful to both sides just for the commit id, so in that case I would prefer to keep my current, imperfect method which is just a couple commands and best-guess-work. You can see my current method here if more context is needed: (edited the link so it is locked to a commit)