Closed unext-wendong closed 8 months ago
Thank you for the report. Do you have this issue with a build from source?
I wonder if this is an issue with a shallow clone of the repo in a workflow. There are cases in general (not specific to this project) where the full history or the tags need to be pulled in separately for a build process to understand its version correctly.
With locally built docker image, the version string looks correct:
packager version v3.0.1-6bff14f359-debug
There are three parts in the string: <tag>-<commit-hash>-<build-type>
.
I think you are correct, that the tag and commit hash are missing because of the way the repo is being checked out in the docker build Github Workflow.
For the tag part, it might be worth trying the fetch-tags: true
input of actions/checkout@v4
to see if it makes any difference. From the doc, it should fetch the tag associated with the first commit at least.
For the commit hash, in case of Github Workflow, it's available in the GITHUB_SHA
variable. Someone will need to figure out how to pass that from the workflow to the build script.
The build type though is currently hardcoded as debug in the Dockerfile, and can be updated easily.
I'm testing a fix in my fork. So far, it's working for the release binaries on GitHub but not Docker.
I ran the same git commands from the workflow logs locally in a fresh folder, to check out the release from my fork. When I do that, the version generator script works. Those same steps in GitHub didn't work.
I'm struggling to come up with a theory that explains the difference in results.
Ah, my git commands were the same, but my Docker commands were different. According to the logs, the action docker/build-push-action
appears to be checking out source from git
itself instead of trusting what was already checked out. We can fix this in the action config. It appears that we needed both this and the fetch-tags
config on actions/checkout
.
My testing release on my fork is still in progress, but I see the fix working in the logs already. I added some debug info to the version script to be able to verify this quickly during a build:
#12 22.01 Found version tag: v3.0.4
#12 22.01 Version hash: f52052a
#12 22.01 Final output: v3.0.4-f52052a
Note that I made two fake releases from my fork to get this far, v3.0.3 and v3.0.4. But the next official release from here, which will contain this fix, is v3.0.3.
System info
Operating System: macOS Ventura 13.2.1 (Apple Silicon) Shaka Packager Version: v3.0.1
It might be an issue specific to the docker build. https://hub.docker.com/r/google/shaka-packager/tags Tag: v3.0.0 and v3.0.1
Issue and steps to reproduce the problem
Packager Command:
What is the expected result?
Like back in tag v2.5.1:
What happens instead? Getting this output:
Note
Note that this version string is also included in all the manifest files generated.