-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
chore(scripts/run-docker): implement dry run simulation to skip launching container if no packages would have been built #24168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
twaik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
|
And you likely meant |
I do like that name better for this also. I will change it to that. |
95c0d08 to
e804ff8
Compare
867df14 to
8b4db25
Compare
8b4db25 to
de575be
Compare
de575be to
bc81ea6
Compare
|
Ok, now I've made sort of another version that's based on agnostic-apollo's request to try using I believe I have incorporated most of the requests into this version, and while it probably needs more changes, I would be interested in knowing whether this version is changing in the right direction. |
221b5c1 to
5f77f5a
Compare
| if: ${{ steps.build-info.outputs.skip-building != 'true' }} | ||
| env: | ||
| DOCKER_BUILD: ${{ steps.build-info.outputs.docker-build }} | ||
| TERMUX_DOCKER__CONTAINER_EXEC_COMMAND__PRE_CHECK_IF_WILL_BUILD_PACKAGES: "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that this would be the appropriate place to enable this in CI.
I have tested this on my own GitHub Actions in this run, on the ecl package, which has TERMUX_PKG_EXCLUDED_ARCHES="i686, x86_64":
https://github.com/robertkirkman/termux-packages/actions/runs/16082984132/job/45390315328
It is working. What happens in practice is, for the i686 and x86_64 jobs, the "build" workflow step very quickly completes without building anything, but showing a green success mark, not red failed or gray skipped, and an artifact does upload. However, what is in the artifact is just nothing except a .placeholder file, which is empty, and a built_termux-main_packages.txt file, which contains the list of packages that would have been built if the build were not skipped, in this test "ecl".
@twaik do you think this is proper behavior to happen, or should it be adjusted to be different in any way?
049f908 to
01fa00e
Compare
|
Looks fine from my side otherwise, I'll leave any testing to you. |
01fa00e to
6ca3ee9
Compare
|
since twaik opened the original issue, I would be interested in review from twaik about the current version before merging, because the version originally approved has changed so completely that it's not recognizable anymore |
6ca3ee9 to
d718f4c
Compare
…hing container if no packages would have been built - Fixes termux#24116 - adds a new script to `scripts/bin`, `build-package-dry-run-simulation.sh`, which is used to test whether the entire `build-package.sh` command would have both proceeded beyond this point, https://github.com/termux/termux-packages/blob/040710f4927fc42cb74a85911e42da0a3f2e1f39/scripts/build/termux_step_start_build.sh#L13-L16 - and also proceeded beyond this point, https://github.com/termux/termux-packages/blob/040710f4927fc42cb74a85911e42da0a3f2e1f39/scripts/build/termux_step_start_build.sh#L42-L47 - or if it would have skipped all packages in the list of packages to build without building anything. - if the build would have continued or an unknown situation occurs, zero is returned, but if all packages in the list of packages to build would have been skipped, 85 (`C_EX__NOOP`) is returned. - if an error handled by this script, such as a syntax error in the `-a` argument or the package name argument list occurs, a similar error message to what `build-package.sh` would have printed is shown, and 1 is returned. - in `run-docker.sh`, the command passed to `run-docker.sh` is run in `build-package-dry-run-simulation.sh` before doing anything else only if the command passed has `build-package.sh` in its first argument, and only continues if a zero value is returned by `build-package-dry-run-simulation.sh`, which indicates either that at least one package will be built, or that the passed command is empty or not `build-package.sh`.
d718f4c to
4343f98
Compare
|
It seems like twaik might be taking a break, and I believe this is ready, so I will merge this in 24 hours if no problems are found. |
Fixes [CI]: worker should perform package skip BEFORE docker image is being pulled. #24116
adds a new script to
scripts/bin,build-package-dry-run-simulation.sh, which is used to test whether the entirebuild-package.shcommand would have both proceeded beyond this point,termux-packages/scripts/build/termux_step_start_build.sh
Lines 13 to 16 in 040710f
termux-packages/scripts/build/termux_step_start_build.sh
Lines 42 to 47 in 040710f
or if it would have skipped all packages in the list of packages to build without building anything.
if the build would have continued or an unknown situation occurs, zero is returned, but if all packages in the list of packages to build would have been skipped, 85 (
C_EX__NOOP) is returned.if an error handled by this script, such as a syntax error in the
-aargument or the package name argument list occurs, a similar error message to whatbuild-package.shwould have printed is shown, and 1 is returned.in
run-docker.sh, the command passed torun-docker.shis run inbuild-package-dry-run-simulation.shbefore doing anything else only if the command passed hasbuild-package.shin its first argument, and only continues if a zero value is returned bybuild-package-dry-run-simulation.sh, which indicates either that at least one package will be built, or that the passed command is empty or notbuild-package.sh.