Compare commits
18
Commits
99b3024671
..
1.1.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31eb812f09 | ||
|
|
0889443933 | ||
|
|
917d8c6ebd | ||
|
|
05107b21bc | ||
|
|
b1ba0fb582 | ||
|
|
24c45a928c | ||
|
|
0f76a3aa0a | ||
|
|
ec24e591f6 | ||
|
|
572922791c | ||
|
|
e79e2d9b86 | ||
|
|
4ae6a71afc | ||
|
|
aa7fd7c3fb | ||
|
|
43e843a82b | ||
|
|
d264ce6762 | ||
|
|
094a71df0f | ||
|
|
d2e9b9afd4 | ||
|
|
707ffef786 | ||
|
|
d720aa4b1d |
No files matched your search
+46
-210
@@ -6,7 +6,8 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 6 * * 1"
|
# Saturday 05:00 UTC: 06:00 in Paris in winter, 07:00 in summer (Gitea runs cron in UTC).
|
||||||
|
- cron: "0 5 * * 6"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-scan:
|
build-and-scan:
|
||||||
@@ -18,19 +19,22 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
|
- name: Get shared actions
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
repository: labeex/cicdeex
|
||||||
|
ref: 1.1.0
|
||||||
|
token: ${{ secrets.CICDEEX_TOKEN }}
|
||||||
|
path: .cicdeex
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Scan for secrets
|
- name: Scan for secrets
|
||||||
run: |
|
uses: ./.cicdeex/secret-scan
|
||||||
# docker cp, not a build COPY: a repo's own .dockerignore would otherwise
|
|
||||||
# silently give an empty, falsely-clean scan.
|
|
||||||
CID=$(docker create zricethezav/gitleaks:v8.30.1 detect --source=/repo --no-banner -v)
|
|
||||||
docker cp . "$CID:/repo"
|
|
||||||
docker start -a "$CID"
|
|
||||||
STATUS=$?
|
|
||||||
docker rm "$CID" > /dev/null
|
|
||||||
exit $STATUS
|
|
||||||
|
|
||||||
- name: Lint Dockerfile with hadolint
|
- name: Lint Dockerfile with hadolint
|
||||||
run: docker run --rm -i hadolint/hadolint:v2.15.1-alpine hadolint --failure-threshold error - < docker/Dockerfile
|
uses: ./.cicdeex/hadolint
|
||||||
|
with:
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
|
||||||
- name: Build Docker image
|
- name: Build Docker image
|
||||||
run: |
|
run: |
|
||||||
@@ -62,211 +66,43 @@ jobs:
|
|||||||
- name: Scan with Trivy (critical - blocking)
|
- name: Scan with Trivy (critical - blocking)
|
||||||
id: trivy_critical
|
id: trivy_critical
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
uses: ./.cicdeex/trivy
|
||||||
docker run --rm \
|
with:
|
||||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
image: instameex:ci
|
||||||
--add-host=dockerhost:host-gateway \
|
|
||||||
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'
|
||||||
run: |
|
uses: ./.cicdeex/remediate
|
||||||
if [ "${{ github.event_name }}" != "schedule" ]; then
|
with:
|
||||||
echo "::error::CRITICAL vulnerabilities found, failing the build."
|
push-token: ${{ secrets.CI_PUSH_TOKEN }}
|
||||||
exit 1
|
dockerfile: docker/Dockerfile
|
||||||
fi
|
from-pattern: "^FROM python:.* AS base$"
|
||||||
|
|
||||||
echo "Scheduled scan found CRITICAL vulnerabilities — attempting an automatic apk upgrade + rescan."
|
|
||||||
|
|
||||||
# Add an apk upgrade right after the base stage's FROM
|
|
||||||
sed -i '/^FROM python:.* AS base$/a RUN apk upgrade --no-cache' docker/Dockerfile
|
|
||||||
docker build -f docker/Dockerfile -t instameex:remediated .
|
|
||||||
|
|
||||||
if docker run --rm \
|
|
||||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
|
||||||
--add-host=dockerhost:host-gateway \
|
|
||||||
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."
|
|
||||||
|
|
||||||
BRANCH="auto/cve-fix-$(date +%Y%m%d)-$(echo "${{ github.sha }}" | cut -c1-7)"
|
|
||||||
git config user.name "instameex-ci"
|
|
||||||
git config user.email "[email protected]"
|
|
||||||
git checkout -b "$BRANCH"
|
|
||||||
git add docker/Dockerfile
|
|
||||||
git commit -m "Auto-remediate CRITICAL CVE via apk upgrade"
|
|
||||||
git config --unset-all http.https://git.djeex.fr/.extraheader || true
|
|
||||||
git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/instameex.git" "HEAD:$BRANCH"
|
|
||||||
|
|
||||||
PR_JSON=$(curl -s -X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$(jq -n --arg head "$BRANCH" '{title: "🔒 Auto: remediate CRITICAL CVE via apk upgrade", head: $head, base: "main", body: "Opened automatically by the scheduled CVE scan. An `apk upgrade --no-cache` cleared the CRITICAL Trivy finding(s) in a rebuild — review the diff and merge to publish the fix."}')" \
|
|
||||||
"https://git.djeex.fr/api/v1/repos/Djeex/instameex/pulls")
|
|
||||||
echo "PR API response: $(echo "$PR_JSON" | jq -r '.html_url // .message // "unknown"')"
|
|
||||||
else
|
|
||||||
echo "::error::apk upgrade does not clear the CRITICAL finding(s) — no automatic fix available, needs manual review."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Scan with Trivy (high - informative)
|
- name: Scan with Trivy (high - informative)
|
||||||
run: |
|
uses: ./.cicdeex/trivy
|
||||||
docker run --rm \
|
with:
|
||||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
image: instameex:ci
|
||||||
--add-host=dockerhost:host-gateway \
|
severity: HIGH
|
||||||
aquasec/trivy:0.76.2 image --exit-code 0 --severity HIGH instameex:ci
|
exit-code: "0"
|
||||||
|
|
||||||
- name: Publish tagged image
|
- name: Publish tagged image
|
||||||
|
id: publish
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
run: |
|
uses: ./.cicdeex/publish
|
||||||
BEFORE="${{ github.event.before }}"
|
with:
|
||||||
if [ -n "$BEFORE" ] && [ "$BEFORE" != "0000000000000000000000000000000000000000" ] && git cat-file -e "$BEFORE" 2>/dev/null; then
|
image: instameex:ci
|
||||||
BASE_REF="$BEFORE"
|
paths: '^(VERSION|main\.py|requirements\.txt)$|^(docker|src)/'
|
||||||
else
|
push-token: ${{ secrets.CI_PUSH_TOKEN }}
|
||||||
BASE_REF="HEAD~1"
|
registry-token: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
fi
|
github-mirror: "true"
|
||||||
CHANGED=$(git diff --name-only "$BASE_REF" "${{ github.sha }}")
|
github-token: ${{ secrets.GH_TOKEN }}
|
||||||
echo "Changed files:"
|
release-banner: |-
|
||||||
echo "$CHANGED"
|
> [!NOTE]
|
||||||
|
>⚠️ _This is an heavily vibe-coded proof of concept — do not expose it to the internet — use it at your own risk._
|
||||||
|
|
||||||
if ! echo "$CHANGED" | grep -qE '^(VERSION|main\.py|requirements\.txt)$|^(docker|src)/'; then
|
- name: Notify failures
|
||||||
echo "No container-relevant file changed, skipping publish."
|
if: always()
|
||||||
exit 0
|
uses: ./.cicdeex/notify
|
||||||
fi
|
with:
|
||||||
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
if echo "$CHANGED" | grep -qE '^VERSION$'; then
|
status: ${{ job.status }}
|
||||||
echo "VERSION was manually edited in this push, using it as-is."
|
|
||||||
else
|
|
||||||
echo "VERSION untouched but container files changed, auto-bumping the build number (Z)."
|
|
||||||
OLD_VERSION=$(tr -d '[:space:]' < VERSION)
|
|
||||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$OLD_VERSION"
|
|
||||||
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
|
|
||||||
echo "$NEW_VERSION" > VERSION
|
|
||||||
|
|
||||||
git config user.name "instameex-ci"
|
|
||||||
git config user.email "[email protected]"
|
|
||||||
git add VERSION
|
|
||||||
git commit -m "Bump build version to $NEW_VERSION [skip ci]"
|
|
||||||
|
|
||||||
git config --unset-all http.https://git.djeex.fr/.extraheader || true
|
|
||||||
|
|
||||||
git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/instameex.git" HEAD:main
|
|
||||||
fi
|
|
||||||
|
|
||||||
VERSION=$(tr -d '[:space:]' < VERSION)
|
|
||||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
|
||||||
MINOR_TAG="${MAJOR}.${MINOR}"
|
|
||||||
|
|
||||||
IMAGE=git.djeex.fr/djeex/instameex
|
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.djeex.fr -u Djeex --password-stdin
|
|
||||||
|
|
||||||
# Retag the already-built, already-scanned image — never rebuild for publish,
|
|
||||||
# so what ships is byte-for-byte what Trivy just scanned.
|
|
||||||
docker tag instameex:ci "$IMAGE:latest"
|
|
||||||
docker tag instameex:ci "$IMAGE:$MINOR_TAG"
|
|
||||||
docker tag instameex:ci "$IMAGE:$VERSION"
|
|
||||||
docker push "$IMAGE:latest"
|
|
||||||
docker push "$IMAGE:$MINOR_TAG"
|
|
||||||
docker push "$IMAGE:$VERSION"
|
|
||||||
|
|
||||||
GHCR_IMAGE=ghcr.io/djeex/instameex
|
|
||||||
echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u Djeex --password-stdin
|
|
||||||
|
|
||||||
docker tag instameex:ci "$GHCR_IMAGE:latest"
|
|
||||||
docker tag instameex:ci "$GHCR_IMAGE:$MINOR_TAG"
|
|
||||||
docker tag instameex:ci "$GHCR_IMAGE:$VERSION"
|
|
||||||
docker push "$GHCR_IMAGE:latest"
|
|
||||||
docker push "$GHCR_IMAGE:$MINOR_TAG"
|
|
||||||
docker push "$GHCR_IMAGE:$VERSION"
|
|
||||||
|
|
||||||
TRIGGER_MSG=$(git log -1 --format=%s "${{ github.sha }}")
|
|
||||||
PR_NUM=$(echo "$TRIGGER_MSG" | grep -oE '#[0-9]+' | head -1 | tr -d '#' || true)
|
|
||||||
|
|
||||||
CATEGORY="🔧 Maintenance"
|
|
||||||
CHANGE_TITLE="$TRIGGER_MSG"
|
|
||||||
|
|
||||||
if [ -n "$PR_NUM" ]; then
|
|
||||||
PR_JSON=$(curl -s -H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
|
|
||||||
"https://git.djeex.fr/api/v1/repos/Djeex/instameex/pulls/$PR_NUM")
|
|
||||||
PR_TITLE=$(echo "$PR_JSON" | jq -r '.title // empty' 2>/dev/null || true)
|
|
||||||
LABELS=$(echo "$PR_JSON" | jq -r '.labels[]?.name' 2>/dev/null || true)
|
|
||||||
|
|
||||||
if [ -n "$PR_TITLE" ]; then
|
|
||||||
CHANGE_TITLE="$PR_TITLE"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if echo "$LABELS" | grep -qx 'bug'; then
|
|
||||||
CATEGORY="⚠️ Hotfix"
|
|
||||||
elif echo "$LABELS" | grep -qx 'major'; then
|
|
||||||
CATEGORY="💥 Breaking change"
|
|
||||||
elif echo "$LABELS" | grep -qx 'minor'; then
|
|
||||||
CATEGORY="✨ Update"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
REPO_URL="https://git.djeex.fr/Djeex/instameex"
|
|
||||||
COMMIT_LIST=$(git log --no-merges --format="- %s ([%h](${REPO_URL}/commit/%H))" "$BASE_REF".."${{ github.sha }}")
|
|
||||||
|
|
||||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
|
||||||
SOURCE_LINE="[${SHORT_SHA}](${REPO_URL}/commit/${{ github.sha }})"
|
|
||||||
if [ -n "$PR_NUM" ]; then
|
|
||||||
SOURCE_LINE="[#${PR_NUM}](${REPO_URL}/pulls/${PR_NUM}) · ${SOURCE_LINE}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
NOTE_BANNER=$(printf '> [!NOTE]\n>⚠️ _This is an heavily vibe-coded proof of concept — do not expose it to the internet — use it at your own risk._')
|
|
||||||
|
|
||||||
BODY=$(cat <<EOF
|
|
||||||
${NOTE_BANNER}
|
|
||||||
|
|
||||||
## Changelog
|
|
||||||
|
|
||||||
### ${CATEGORY}
|
|
||||||
${CHANGE_TITLE}
|
|
||||||
|
|
||||||
**Source:** ${SOURCE_LINE}
|
|
||||||
**Image:** \`${IMAGE}:${VERSION}\`
|
|
||||||
|
|
||||||
**Commits:**
|
|
||||||
${COMMIT_LIST}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
JSON_PAYLOAD=$(jq -n \
|
|
||||||
--arg tag "v$VERSION" \
|
|
||||||
--arg name "v$VERSION" \
|
|
||||||
--arg body "$BODY" \
|
|
||||||
'{tag_name: $tag, name: $name, target_commitish: "main", body: $body}')
|
|
||||||
|
|
||||||
curl -s -o /dev/null -w "Release API response: %{http_code}\n" -X POST \
|
|
||||||
-H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$JSON_PAYLOAD" \
|
|
||||||
"https://git.djeex.fr/api/v1/repos/Djeex/instameex/releases"
|
|
||||||
|
|
||||||
MIRROR_NOTICE="_This github repo is a mirror of https://git.djeex.fr/Djeex/instameex. You'll find full package, PR, history and release note there._"
|
|
||||||
GH_BODY=$(printf '%s\n\n%s' "$MIRROR_NOTICE" "$BODY")
|
|
||||||
|
|
||||||
GH_JSON_PAYLOAD=$(jq -n \
|
|
||||||
--arg tag "v$VERSION" \
|
|
||||||
--arg name "v$VERSION" \
|
|
||||||
--arg body "$GH_BODY" \
|
|
||||||
--arg sha "${{ github.sha }}" \
|
|
||||||
'{tag_name: $tag, name: $name, target_commitish: $sha, body: $body}')
|
|
||||||
|
|
||||||
GH_STATUS=0
|
|
||||||
for i in 1 2 3 4 5; do
|
|
||||||
GH_STATUS=$(curl -s -o /tmp/gh_release.json -w "%{http_code}" -X POST \
|
|
||||||
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "$GH_JSON_PAYLOAD" \
|
|
||||||
"https://api.github.com/repos/Djeex/instameex/releases")
|
|
||||||
if [ "$GH_STATUS" = "201" ]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "GitHub Release attempt $i failed (HTTP $GH_STATUS) — mirror may not have synced this commit yet, retrying in 15s..."
|
|
||||||
sleep 15
|
|
||||||
done
|
|
||||||
echo "GitHub Release API response: $GH_STATUS"
|
|
||||||
if [ "$GH_STATUS" != "201" ]; then
|
|
||||||
cat /tmp/gh_release.json 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1@sha256:572cebbc2b15e6f84c077742952674889cb63cd5e9b80abdffcbe587b6f19183
|
||||||
|
|
||||||
# ---- Stage 1: compile libultrahdr (ultrahdr_app) --------------------------
|
# ---- Stage 1: compile libultrahdr (ultrahdr_app) --------------------------
|
||||||
FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf AS uhdr-build
|
FROM alpine:3.24.4@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf AS uhdr-build
|
||||||
@@ -18,7 +18,7 @@ RUN cmake -G "Unix Makefiles" -DUHDR_WRITE_XMP=ON \
|
|||||||
&& cmake --build libultrahdr/build -j"$(nproc)"
|
&& cmake --build libultrahdr/build -j"$(nproc)"
|
||||||
|
|
||||||
# ---- Stage 2: runtime -------------------------------------------------------
|
# ---- Stage 2: runtime -------------------------------------------------------
|
||||||
FROM python:3.14.10-alpine@sha256:5862d971d1f0ae26b258cefa4e893556b1d3aba81bd2ff30888704ad378bab67 AS base
|
FROM python:3.15.2-alpine@sha256:0f9552bb28711333da16915ec146f5e6bb44a7fdac9ced15dc17c2e0206346dd AS base
|
||||||
|
|
||||||
# apk upgrade pulls Alpine security fixes released after the base image was built.
|
# apk upgrade pulls Alpine security fixes released after the base image was built.
|
||||||
RUN apk upgrade --no-cache \
|
RUN apk upgrade --no-cache \
|
||||||
|
|||||||
@@ -27,4 +27,4 @@ fi
|
|||||||
echo -e "[✓] Required tools found: ultrahdr_app, exiftool"
|
echo -e "[✓] Required tools found: ultrahdr_app, exiftool"
|
||||||
|
|
||||||
echo -e "[~] Starting Instameex web server..."
|
echo -e "[~] Starting Instameex web server..."
|
||||||
exec gunicorn --bind 0.0.0.0:5000 --workers 1 --threads 4 --timeout 120 main:app
|
exec gunicorn --no-control-socket --bind 0.0.0.0:5000 --workers 1 --threads 4 --timeout 120 main:app
|
||||||
+1
-51
@@ -1,54 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": ["config:recommended", "docker:pinDigests"],
|
"extends": ["local>labeex/renovateex"]
|
||||||
"timezone": "Europe/Paris",
|
|
||||||
"minimumReleaseAge": "3 days",
|
|
||||||
"labels": ["bot"],
|
|
||||||
"vulnerabilityAlerts": {
|
|
||||||
"addLabels": ["bug"]
|
|
||||||
},
|
|
||||||
"customManagers": [
|
|
||||||
{
|
|
||||||
"customType": "regex",
|
|
||||||
"description": "Docker images pinned in CI 'docker run' / 'docker create' commands",
|
|
||||||
"managerFilePatterns": ["/^\\.gitea/workflows/.+\\.ya?ml$/"],
|
|
||||||
"matchStrings": [
|
|
||||||
"(?<depName>(?:zricethezav/gitleaks|hadolint/hadolint|aquasec/trivy)):(?<currentValue>v?\\d+\\.\\d+\\.\\d+(?:-[a-z]+)?)"
|
|
||||||
],
|
|
||||||
"datasourceTemplate": "docker"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"packageRules": [
|
|
||||||
{
|
|
||||||
"matchManagers": ["custom.regex"],
|
|
||||||
"pinDigests": false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchManagers": ["pip_requirements"],
|
|
||||||
"minimumReleaseAge": "7 days"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchManagers": ["pip_requirements"],
|
|
||||||
"matchUpdateTypes": ["patch", "minor"],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchManagers": ["dockerfile"],
|
|
||||||
"matchUpdateTypes": ["patch"],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchManagers": ["dockerfile"],
|
|
||||||
"matchUpdateTypes": ["pin", "digest"],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchUpdateTypes": ["major"],
|
|
||||||
"addLabels": ["major"]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"matchUpdateTypes": ["minor"],
|
|
||||||
"addLabels": ["minor"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
Flask==3.1.3
|
Flask==3.1.3
|
||||||
gunicorn==23.0.0
|
gunicorn==27.0.1
|
||||||
Pillow==13.0.0
|
Pillow==13.0.0
|
||||||
numpy==2.5.4
|
numpy==2.5.5
|
||||||
tifffile==2026.11.12
|
tifffile==2026.11.16
|
||||||
Reference in new issue
Block a user