Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2e9b9afd4 | ||
|
|
707ffef786 | ||
|
|
99b3024671 | ||
|
|
2594dacdcf | ||
|
|
554de3f041 | ||
|
|
fc16ed0e89 | ||
|
|
d9b03108de | ||
|
|
f8dd834419 | ||
|
|
b494404088 | ||
|
|
6fa5b0e333 | ||
|
|
548ccc0dbe | ||
|
|
a4e3e36249 | ||
|
|
82792375a2 | ||
|
|
6d810b76cf | ||
|
|
7378de15ec | ||
|
|
93d448140e | ||
|
|
8e4378539d | ||
|
|
5233594685 | ||
|
|
657dfdef6b | ||
|
|
9300430550 | ||
|
|
8c4afd98d9 |
No files matched your search
@@ -66,7 +66,7 @@ jobs:
|
|||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
||||||
--add-host=dockerhost:host-gateway \
|
--add-host=dockerhost:host-gateway \
|
||||||
aquasec/trivy:0.74.0 image --exit-code 1 --severity CRITICAL instameex:ci
|
aquasec/trivy:0.76.2 image --exit-code 1 --severity CRITICAL instameex:ci
|
||||||
|
|
||||||
- name: Handle CRITICAL findings
|
- name: Handle CRITICAL findings
|
||||||
if: steps.trivy_critical.outcome == 'failure'
|
if: steps.trivy_critical.outcome == 'failure'
|
||||||
@@ -85,7 +85,7 @@ jobs:
|
|||||||
if docker run --rm \
|
if docker run --rm \
|
||||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
||||||
--add-host=dockerhost:host-gateway \
|
--add-host=dockerhost:host-gateway \
|
||||||
aquasec/trivy:0.74.0 image --exit-code 1 --severity CRITICAL instameex:remediated; then
|
aquasec/trivy:0.76.2 image --exit-code 1 --severity CRITICAL instameex:remediated; then
|
||||||
echo "apk upgrade clears the CRITICAL finding(s) — opening a PR for review."
|
echo "apk upgrade clears the CRITICAL finding(s) — opening a PR for review."
|
||||||
|
|
||||||
BRANCH="auto/cve-fix-$(date +%Y%m%d)-$(echo "${{ github.sha }}" | cut -c1-7)"
|
BRANCH="auto/cve-fix-$(date +%Y%m%d)-$(echo "${{ github.sha }}" | cut -c1-7)"
|
||||||
@@ -113,7 +113,7 @@ jobs:
|
|||||||
docker run --rm \
|
docker run --rm \
|
||||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
||||||
--add-host=dockerhost:host-gateway \
|
--add-host=dockerhost:host-gateway \
|
||||||
aquasec/trivy:0.74.0 image --exit-code 0 --severity HIGH instameex:ci
|
aquasec/trivy:0.76.2 image --exit-code 0 --severity HIGH instameex:ci
|
||||||
|
|
||||||
- name: Publish tagged image
|
- name: Publish tagged image
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
|||||||
+10
-5
@@ -1,23 +1,28 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
# ---- Stage 1: compile libultrahdr (ultrahdr_app) --------------------------
|
# ---- Stage 1: compile libultrahdr (ultrahdr_app) --------------------------
|
||||||
FROM alpine:3.21 AS uhdr-build
|
FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf AS uhdr-build
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
git cmake make g++ nasm pkgconf libjpeg-turbo-dev
|
git cmake make g++ nasm pkgconf libjpeg-turbo-dev
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
# Pin to a commit once you've confirmed it works for you — HEAD can move.
|
# Pinned to an exact commit (v2.0.2 + fixes) for reproducible, auditable builds.
|
||||||
RUN git clone --depth 1 https://github.com/google/libultrahdr.git
|
ARG UHDR_COMMIT=c6fd15cdb2d05d3aaed84b817e4c4a274a4ce600
|
||||||
|
RUN git init libultrahdr \
|
||||||
|
&& git -C libultrahdr fetch --depth 1 https://github.com/google/libultrahdr.git "$UHDR_COMMIT" \
|
||||||
|
&& git -C libultrahdr checkout --detach FETCH_HEAD
|
||||||
|
|
||||||
RUN cmake -G "Unix Makefiles" -DUHDR_WRITE_XMP=ON \
|
RUN cmake -G "Unix Makefiles" -DUHDR_WRITE_XMP=ON \
|
||||||
-S libultrahdr -B libultrahdr/build \
|
-S libultrahdr -B libultrahdr/build \
|
||||||
&& cmake --build libultrahdr/build -j"$(nproc)"
|
&& cmake --build libultrahdr/build -j"$(nproc)"
|
||||||
|
|
||||||
# ---- Stage 2: runtime -------------------------------------------------------
|
# ---- Stage 2: runtime -------------------------------------------------------
|
||||||
FROM python:3.11-alpine AS base
|
FROM python:3.14.10-alpine@sha256:5862d971d1f0ae26b258cefa4e893556b1d3aba81bd2ff30888704ad378bab67 AS base
|
||||||
|
|
||||||
RUN apk add --no-cache exiftool libjpeg-turbo libstdc++
|
# apk upgrade pulls Alpine security fixes released after the base image was built.
|
||||||
|
RUN apk upgrade --no-cache \
|
||||||
|
&& apk add --no-cache exiftool libjpeg-turbo libstdc++
|
||||||
|
|
||||||
COPY --from=uhdr-build /build/libultrahdr/build/ultrahdr_app /usr/local/bin/ultrahdr_app
|
COPY --from=uhdr-build /build/libultrahdr/build/ultrahdr_app /usr/local/bin/ultrahdr_app
|
||||||
RUN chmod +x /usr/local/bin/ultrahdr_app
|
RUN chmod +x /usr/local/bin/ultrahdr_app
|
||||||
|
|||||||
+15
-1
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:recommended"],
|
"extends": ["config:recommended", "docker:pinDigests"],
|
||||||
"timezone": "Europe/Paris",
|
"timezone": "Europe/Paris",
|
||||||
|
"minimumReleaseAge": "3 days",
|
||||||
"labels": ["bot"],
|
"labels": ["bot"],
|
||||||
"vulnerabilityAlerts": {
|
"vulnerabilityAlerts": {
|
||||||
"addLabels": ["bug"]
|
"addLabels": ["bug"]
|
||||||
@@ -18,6 +19,14 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchManagers": ["custom.regex"],
|
||||||
|
"pinDigests": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchManagers": ["pip_requirements"],
|
||||||
|
"minimumReleaseAge": "7 days"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"matchManagers": ["pip_requirements"],
|
"matchManagers": ["pip_requirements"],
|
||||||
"matchUpdateTypes": ["patch", "minor"],
|
"matchUpdateTypes": ["patch", "minor"],
|
||||||
@@ -28,6 +37,11 @@
|
|||||||
"matchUpdateTypes": ["patch"],
|
"matchUpdateTypes": ["patch"],
|
||||||
"automerge": true
|
"automerge": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"matchManagers": ["dockerfile"],
|
||||||
|
"matchUpdateTypes": ["pin", "digest"],
|
||||||
|
"automerge": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"matchUpdateTypes": ["major"],
|
"matchUpdateTypes": ["major"],
|
||||||
"addLabels": ["major"]
|
"addLabels": ["major"]
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
Flask==3.1.3
|
Flask==3.1.3
|
||||||
gunicorn==23.0.0
|
gunicorn==23.0.0
|
||||||
Pillow==13.0.0
|
Pillow==13.0.0
|
||||||
numpy==2.4.6
|
numpy==2.5.4
|
||||||
tifffile==2026.3.3
|
tifffile==2026.11.12
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
"""End-to-end: runs the real ultrahdr_app + exiftool (present in the Docker
|
||||||
|
image, skipped elsewhere) to catch regressions from dependency or base image
|
||||||
|
updates that the mocked unit tests cannot see."""
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
import pytest
|
||||||
|
import tifffile
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
from app import assembler
|
||||||
|
|
||||||
|
pytestmark = pytest.mark.skipif(
|
||||||
|
bool(assembler.check_dependencies()) or not shutil.which("exiftool"),
|
||||||
|
reason="ultrahdr_app/exiftool not installed",
|
||||||
|
)
|
||||||
|
|
||||||
|
SIZE = 128
|
||||||
|
|
||||||
|
|
||||||
|
def gradient():
|
||||||
|
"""A horizontal ramp 0..1 with a bright highlight block, as float values."""
|
||||||
|
ramp = np.tile(np.linspace(0.05, 1.0, SIZE, dtype=np.float32), (SIZE, 1))
|
||||||
|
img = np.stack([ramp, ramp, ramp], axis=-1)
|
||||||
|
return img
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def sdr(tmp_path):
|
||||||
|
arr = (np.clip(gradient() ** (1 / 2.2), 0, 1) * 255).astype(np.uint8)
|
||||||
|
path = tmp_path / "sdr.jpg"
|
||||||
|
Image.fromarray(arr).save(path, "JPEG", quality=95)
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def hdr_tiff(tmp_path):
|
||||||
|
hdr = gradient()
|
||||||
|
hdr[:32, :32] *= 3.0 # highlight brighter than SDR white
|
||||||
|
path = tmp_path / "hdr.tif"
|
||||||
|
tifffile.imwrite(path, hdr.astype(np.float32), photometric="rgb")
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def assert_valid_ultrahdr(out, log):
|
||||||
|
assert out.exists() and out.stat().st_size > 0
|
||||||
|
with Image.open(out) as img:
|
||||||
|
assert img.format == "JPEG" and img.size == (SIZE, SIZE)
|
||||||
|
assert "Validation report" in log # gain map found and readable
|
||||||
|
assert "XMP-hdrgm:GainMapMax" in log
|
||||||
|
|
||||||
|
|
||||||
|
def test_tiff_pipeline_produces_ultrahdr_jpeg(tmp_path, sdr, hdr_tiff):
|
||||||
|
out = tmp_path / "out.jpg"
|
||||||
|
ok, log, warning = assembler.run(sdr, hdr_tiff, out)
|
||||||
|
assert ok, log
|
||||||
|
assert_valid_ultrahdr(out, log)
|
||||||
|
assert warning is False # GainMapMin must not be negative (Instagram rejects it)
|
||||||
|
|
||||||
|
|
||||||
|
def test_jpeg_pipeline_round_trip(tmp_path, sdr, hdr_tiff):
|
||||||
|
first = tmp_path / "first.jpg"
|
||||||
|
ok, log, _ = assembler.run(sdr, hdr_tiff, first)
|
||||||
|
assert ok, log
|
||||||
|
second = tmp_path / "second.jpg"
|
||||||
|
ok, log, warning = assembler.run(sdr, first, second) # existing gain-map JPEG as HDR input
|
||||||
|
assert ok, log
|
||||||
|
assert_valid_ultrahdr(second, log)
|
||||||
|
assert warning is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_invalid_hdr_jpeg_fails_cleanly(tmp_path, sdr):
|
||||||
|
not_hdr = tmp_path / "plain.jpg"
|
||||||
|
shutil.copy(sdr, not_hdr) # a JPEG without any gain map
|
||||||
|
ok, log, warning = assembler.run(sdr, not_hdr, tmp_path / "out.jpg")
|
||||||
|
assert ok is False and warning is False
|
||||||
|
assert log.splitlines()[-1].startswith("Error:")
|
||||||
Reference in new issue
Block a user