-
Notifications
You must be signed in to change notification settings - Fork 111
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
build: valid SOURCE_DATE_EPOCH #1520
Open
xnox
wants to merge
2
commits into
chainguard-dev:main
Choose a base branch
from
xnox:valid-source-date-epoch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set the floor of SOURCE_DATE_EPOCH to 1980, as ZIP file format does not support timestamps prior to 1980, meaning zip, jar, egg, wheel all fail to be created or used. Without this fix, if one removes the hand override of SOURCE_DATE_EPOCH from py3-userpath, the build fails: ```console melange build py3-userpath.yaml --arch x86_64 --pipeline-dir ./pipelines/ -k https://packages.wolfi.dev/os/wolfi-signing.rsa.pub -r https://packages.wolfi.dev/os --source-dir ./py3-userpath/ ... 2024/09/27 14:55:33 INFO * Building wheel... name="Python Build" 2024/09/27 14:55:33 WARN Traceback (most recent call last): name="Python Build" 2024/09/27 14:55:33 WARN File "/usr/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in <module> name="Python Build" 2024/09/27 14:55:33 WARN main() name="Python Build" 2024/09/27 14:55:33 WARN File "/usr/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 357, in main name="Python Build" 2024/09/27 14:55:33 WARN json_out["return_val"] = hook(**hook_input["kwargs"]) name="Python Build" 2024/09/27 14:55:33 WARN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name="Python Build" 2024/09/27 14:55:33 WARN File "/usr/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 271, in build_wheel name="Python Build" 2024/09/27 14:55:33 WARN return _build_backend().build_wheel( name="Python Build" 2024/09/27 14:55:33 WARN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name="Python Build" 2024/09/27 14:55:33 WARN File "/tmp/build-env-u9wepgmk/lib/python3.12/site-packages/hatchling/build.py", line 58, in build_wheel name="Python Build" 2024/09/27 14:55:33 WARN return os.path.basename(next(builder.build(directory=wheel_directory, versions=['standard']))) name="Python Build" 2024/09/27 14:55:33 WARN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name="Python Build" 2024/09/27 14:55:33 WARN File "/tmp/build-env-u9wepgmk/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 155, in build name="Python Build" 2024/09/27 14:55:33 WARN artifact = version_api[version](directory, **build_data) name="Python Build" 2024/09/27 14:55:33 WARN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name="Python Build" 2024/09/27 14:55:33 WARN File "/tmp/build-env-u9wepgmk/lib/python3.12/site-packages/hatchling/builders/wheel.py", line 476, in build_standard name="Python Build" 2024/09/27 14:55:33 WARN record = archive.add_file(included_file) name="Python Build" 2024/09/27 14:55:33 WARN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name="Python Build" 2024/09/27 14:55:33 WARN File "/tmp/build-env-u9wepgmk/lib/python3.12/site-packages/hatchling/builders/wheel.py", line 98, in add_file name="Python Build" 2024/09/27 14:55:33 WARN zip_info = zipfile.ZipInfo(relative_path, cast(TIME_TUPLE, self.time_tuple)) name="Python Build" 2024/09/27 14:55:33 WARN ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ name="Python Build" 2024/09/27 14:55:33 WARN File "/usr/lib/python3.12/zipfile/__init__.py", line 398, in __init__ name="Python Build" 2024/09/27 14:55:33 WARN raise ValueError('ZIP does not support timestamps before 1980') name="Python Build" 2024/09/27 14:55:33 WARN ValueError: ZIP does not support timestamps before 1980 name="Python Build" 2024/09/27 14:55:33 INFO name="Python Build" 2024/09/27 14:55:33 INFO ERROR Backend subprocess exited when trying to invoke build_wheel name="Python Build" 2024/09/27 14:55:33 ERRO ERROR: failed to build package. the build environment has been preserved: 2024/09/27 14:55:33 INFO workspace dir: /tmp/melange-workspace-1020228742 2024/09/27 14:55:33 INFO guest dir: /tmp/melange-guest-609671933 2024/09/27 14:55:33 ERRO failed to build package: unable to run package py3-userpath pipeline: unable to run pipeline: exit status 1 ``` With this fix inplace it just builds correctly. This will remove many custom overrides of SOURCE_DATE_EPOCH in wolfi-dev/os, and prevent any developer hitting such pitfall. This is similar to what was done in NixOS, Debian, Python and probably other projects. In Wolfi this will fix building brand new packages, and building things directly with melange/wolfictl outside of pipelines and makefiles. See for example NixOS/nixpkgs#89794
Once this is in wolfictl, we will be able to eliminate
At least that many lines of yaml, from wolfi (and often 3x that because of a comment, and environment: block, and human having had spent time writing that). |
imjasonh
reviewed
Sep 27, 2024
imjasonh
previously approved these changes
Sep 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set the floor of SOURCE_DATE_EPOCH to 1980, as ZIP file format does
not support timestamps prior to 1980, meaning zip, jar, egg, wheel all
fail to be created or used.
Without this fix, if one removes the hand override of SOURCE_DATE_EPOCH from py3-userpath, the build fails:
With this fix inplace it just builds correctly. This will remove many
custom overrides of SOURCE_DATE_EPOCH in wolfi-dev/os, and prevent any
developer hitting such pitfall.
This is similar to what was done in NixOS, Debian, Python and probably
other projects.
In Wolfi this will fix building brand new packages, and building
things directly with melange/wolfictl outside of pipelines and
makefiles.
See for example NixOS/nixpkgs#89794