Docker build: Include time of pull request to calculation of change time

This commit is contained in:
Bernhard Ehlers 2023-09-30 14:04:19 +02:00
parent 8ce745ad14
commit 32538f7d1f

View File

@ -62,9 +62,9 @@ import re
import shlex import shlex
import subprocess import subprocess
import time import time
import dateutil.parser
import dxf import dxf
import requests.exceptions import requests.exceptions
import dateutil.parser
docker_login = {} docker_login = {}
image_info = {} image_info = {}
@ -379,7 +379,8 @@ def needs_rebuild(image, default_repository=None):
rebuild_reason = "Files in docker context more recent than image" rebuild_reason = "Files in docker context more recent than image"
else: else:
# clean git repository: use "git log" to get commit time # clean git repository: use "git log" to get commit time
proc = subprocess.run(["git", "-C", image["dir"], "log", "-n", "1", proc = subprocess.run(["git", "-C", image["dir"], "log",
"--show-pulls", "-n", "1",
"--pretty=tformat:%ct", "--", "."], "--pretty=tformat:%ct", "--", "."],
capture_output=True, capture_output=True,
check=True, check=True,