Reproduce image incuding its Debian archives date

This commit is contained in:
Alex Pyrgiotis 2025-02-06 14:25:29 +02:00
parent e1b5a1140a
commit cbdd7d7fff
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -140,16 +140,18 @@ def diffoci_diff(runtime, source, local_target, platform=None):
) )
def build_image(tag, use_cache=False, platform=None, runtime=None): def build_image(tag, use_cache=False, platform=None, runtime=None, date=None):
"""Build the Dangerzone container image with a special tag.""" """Build the Dangerzone container image with a special tag."""
platform_args = [] if not platform else ["--platform", platform] platform_args = [] if not platform else ["--platform", platform]
runtime_args = [] if not runtime else ["--runtime", runtime] runtime_args = [] if not runtime else ["--runtime", runtime]
date_args = [] if not date else ["--debian-archive-date", date]
run( run(
"python3", "python3",
"./install/common/build-image.py", "./install/common/build-image.py",
"--no-save", "--no-save",
"--use-cache", "--use-cache",
str(use_cache), str(use_cache),
*date_args,
*platform_args, *platform_args,
*runtime_args, *runtime_args,
"--tag", "--tag",
@ -199,6 +201,11 @@ def parse_args():
action="store_true", action="store_true",
help="Skip checking if the source image tag contains the current Git commit", help="Skip checking if the source image tag contains the current Git commit",
) )
parser.add_argument(
"--debian-archive-date",
default=None,
help="Use a specific Debian snapshot archive, by its date",
)
return parser.parse_args() return parser.parse_args()
@ -221,7 +228,13 @@ def main():
tag = f"reproduce-{commit}" tag = f"reproduce-{commit}"
target = f"{IMAGE_NAME}:{tag}" target = f"{IMAGE_NAME}:{tag}"
logger.info(f"Building container image and tagging it as '{target}'") logger.info(f"Building container image and tagging it as '{target}'")
build_image(tag, args.use_cache, args.platform, args.runtime) build_image(
tag,
args.use_cache,
args.platform,
args.runtime,
args.debian_archive_date,
)
logger.info( logger.info(
f"Ensuring that source image '{args.source}' is semantically identical with" f"Ensuring that source image '{args.source}' is semantically identical with"