15 Commits

Author SHA1 Message Date
francwa 6701a4b392 infra: added Renovate bot 2025-12-22 12:50:59 +01:00
francwa 68372405d6 fix: downgraded upload-artifact action to v3 from v4 2025-12-22 12:13:50 +01:00
francwa f1ea0de247 fix: fixed indentation error 2025-12-22 12:04:47 +01:00
francwa 974d008825 feat: finalized CI/CD pipeline setup 2025-12-22 11:59:36 +01:00
francwa 8a87d94e6d fix: use docker image for trivy vulnerability scanner
CI/CD Awesome Pipeline / Test (push) Successful in 1m23s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Failing after 5m9s
2025-12-22 11:38:35 +01:00
francwa ec99a501fc fix! added directive to Dockerfile 2025-12-22 11:37:48 +01:00
francwa c256b26601 fix: fixed vulnerability scanner issue in CI/CD pipeline
CI/CD Awesome Pipeline / Test (push) Successful in 48s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Failing after 6m18s
2025-12-22 10:59:34 +01:00
francwa 56a3c1257d infra: added trivy vulnerability scanner to CI/CD
CI/CD Awesome Pipeline / Test (push) Successful in 1m36s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Failing after 7m10s
2025-12-22 10:01:52 +01:00
francwa 79d23f936a fix: fixed typo 2025-12-22 09:40:43 +01:00
francwa f02e916d33 fix: fixed config gathering in ci.yml
CI/CD Awesome Pipeline / Test (push) Successful in 1m34s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Failing after 14m19s
2025-12-22 09:16:55 +01:00
francwa 4e64c83c4b fix: updated build and push CI/CD configuration
CI/CD Awesome Pipeline / Test (push) Successful in 1m4s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Failing after 2m32s
2025-12-22 08:45:31 +01:00
francwa 07cae9abd1 chore: bump version 0.1.5 → 0.1.6
CI/CD Awesome Pipeline / Test (push) Successful in 1m23s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Successful in 1m4s
2025-12-21 13:54:02 +01:00
francwa 21b2dffc37 fix: added gitea token 2025-12-21 13:53:49 +01:00
francwa 2d1055cccf chore: bump version 0.1.4 → 0.1.5
CI/CD Awesome Pipeline / Test (push) Successful in 40s
CI/CD Awesome Pipeline / Build & Push to Registry (push) Failing after 20s
2025-12-21 13:01:37 +01:00
francwa fdb2447862 debug: tired 2025-12-21 13:01:23 +01:00
7 changed files with 126 additions and 38 deletions
+50 -24
View File
@@ -2,11 +2,10 @@ name: CI/CD Awesome Pipeline
on: on:
push: push:
branches: [main]
tags: tags:
- 'v*.*.*' - 'v*.*.*'
pull_request:
branches: [main] workflow_dispatch:
env: env:
REGISTRY_URL: ${{ vars.REGISTRY_URL || 'gitea.iswearihadsomethingforthis.net' }} REGISTRY_URL: ${{ vars.REGISTRY_URL || 'gitea.iswearihadsomethingforthis.net' }}
@@ -30,33 +29,60 @@ jobs:
name: Build & Push to Registry name: Build & Push to Registry
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: test needs: test
if: contains(github.ref, 'refs/tags/v')
steps:
- name: Debug ref
run: |
echo "github.ref = ${{ github.ref }}"
echo "GITHUB_REF = $GITHUB_REF"
steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Load config from Makefile - name: Load config from Makefile
id: config id: config
run: | run: make -s _ci-dump-config >> $GITHUB_OUTPUT
eval "$(make _ci-image-name)"
echo "image_name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
- name: Extract version from tag - name: 🏷️ Docker Metadata (Tags & Labels)
id: version id: meta
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT uses: docker/metadata-action@v5
with:
images: gitea.iswearihadsomethingforthis.net/francwa/${{ steps.config.outputs.image_name }}
tags: |
# Tagged (v1.2.3)
type=semver,pattern={{ version }}
# Latest
type=raw,value=latest,enable={{ is_default_branch }}
- name: Build production image - name: Login to Gitea Registry
run: make build uses: docker/login-action@v3
with:
registry: gitea.iswearihadsomethingforthis.net
username: ${{ gitea.actor }}
password: ${{ secrets.G1T34_TOKEN }}
- name: Tag and push to registry - name: Build and push
run: | id: docker_build
docker tag ${{ steps.config.outputs.image_name }}:latest ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USER }}/${{ steps.config.outputs.image_name }}:${{ steps.version.outputs.version }} uses: docker/build-push-action@v5
docker tag ${{ steps.config.outputs.image_name }}:latest ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USER }}/${{ steps.config.outputs.image_name }}:latest with:
echo "${{ secrets.GITEA_TOKEN }}" | docker login ${{ env.REGISTRY_URL }} -u ${{ env.REGISTRY_USER }} --password-stdin context: .
docker push ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USER }}/${{ steps.config.outputs.image_name }}:${{ steps.version.outputs.version }} file: ./brain/Dockerfile
docker push ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USER }}/${{ steps.config.outputs.image_name }}:latest push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PYTHON_VERSION=${{ steps.config.outputs.python_version }}
PYTHON_VERSION_SHORT=${{ steps.config.outputs.python_version_short }}
RUNNER=${{ steps.config.outputs.runner }}
- name: 🛡️ Run Trivy Vulnerability Scanner
uses: docker://aquasec/trivy:latest
env:
TRIVY_USERNAME: ${{ gitea.actor }}
TRIVY_PASSWORD: ${{ secrets.G1T34_TOKEN }}
# Unset the fake GITHUB_TOKEN injected by Gitea
GITHUB_TOKEN: ""
with:
args: image --format table --output trivy-report.txt --exit-code 0 --ignore-unfixed --severity CRITICAL,HIGH gitea.iswearihadsomethingforthis.net/francwa/${{ steps.config.outputs.image_name }}:latest
- name: 📤 Upload Security Report
uses: actions/upload-artifact@v3
with:
name: security-report
path: trivy-report.txt
retention-days: 7
+22
View File
@@ -0,0 +1,22 @@
name: Renovate Bot
on:
schedule:
# Every Monday 4AM
- cron: '0 4 * * 1'
workflow_dispatch:
jobs:
renovate:
runs-on: ubuntu-latest
steps:
- name: Run Renovate
uses: docker://renovate/renovate:latest
env:
RENOVATE_PLATFORM: "gitea"
RENOVATE_ENDPOINT: "https://gitea.iswearihadsomethingforthis.net/api/v1"
RENOVATE_TOKEN: "${{ secrets.G1T34_TOKEN }}"
RENOVATE_REPOSITORIES: '["${{ gitea.repository }}"]'
RENOVATE_GIT_AUTHOR: "Renovate Bot <renovate@bot.local>"
# Might need a free github token if lots of depencies
# RENOVATE_GITHUB_TOKEN: "${{ secrets.GITHUB_COM_TOKEN }}"
+21 -10
View File
@@ -3,20 +3,19 @@
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
# --- SETTINGS --- # --- SETTINGS ---
CORE_DIR = brain
IMAGE_NAME = agent_media
# renovate: datasource=docker depName=python
PYTHON_VERSION = 3.12.7 PYTHON_VERSION = 3.12.7
PYTHON_VERSION_SHORT = $(shell echo $(PYTHON_VERSION) | cut -d. -f1,2) PYTHON_VERSION_SHORT = $(shell echo $(PYTHON_VERSION) | cut -d. -f1,2)
# Change to 'uv' when ready. # Change to 'uv' when ready.
RUNNER ?= poetry RUNNER ?= poetry
SERVICE_NAME = agent_media
export IMAGE_NAME
export PYTHON_VERSION export PYTHON_VERSION
export PYTHON_VERSION_SHORT export PYTHON_VERSION_SHORT
export RUNNER export RUNNER
export IMAGE_NAME
# --- VARIABLES ---
CORE_DIR = brain
SERVICE_NAME = agent_media
IMAGE_NAME = agent_media
# --- ADAPTERS --- # --- ADAPTERS ---
# UV uses "sync", Poetry uses "install". Both install DEV deps by default. # UV uses "sync", Poetry uses "install". Both install DEV deps by default.
@@ -46,7 +45,7 @@ T = \033[36m
R = \033[0m R = \033[0m
# --- TARGETS --- # --- TARGETS ---
.PHONY: add build build-test check-docker check-runner clean coverage down format help init-dotenv install install-hooks lint logs major minor patch prune ps restart run shell test up update _check_branch _ci-image-name _ci-run-tests .PHONY: add build build-test check-docker check-runner clean coverage down format help init-dotenv install install-hooks lint logs major minor patch prune ps restart run shell test up update _check_branch _ci-dump-config _ci-run-tests _push_tag
# Catch-all for args # Catch-all for args
%: %:
@@ -134,7 +133,7 @@ help:
@echo " $(T)update $(R) Update dependencies." @echo " $(T)update $(R) Update dependencies."
@echo "" @echo ""
@echo "$(G)Versioning:$(R)" @echo "$(G)Versioning:$(R)"
@echo " $(T)major/minor/patch $(R) Bump version." @echo " $(T)major/minor/patch $(R) Bump version and push tag (triggers CI/CD)."
init-dotenv: init-dotenv:
@echo "$(T)🔑 Initializing .env file...$(R)" @echo "$(T)🔑 Initializing .env file...$(R)"
@@ -187,14 +186,17 @@ logs: check-docker
major: _check_branch major: _check_branch
@echo "$(T)💥 Bumping major...$(R)" @echo "$(T)💥 Bumping major...$(R)"
SKIP=all $(BUMP_CMD) major SKIP=all $(BUMP_CMD) major
@$(MAKE) -s _push_tag
minor: _check_branch minor: _check_branch
@echo "$(T)✨ Bumping minor...$(R)" @echo "$(T)✨ Bumping minor...$(R)"
SKIP=all $(BUMP_CMD) minor SKIP=all $(BUMP_CMD) minor
@$(MAKE) -s _push_tag
patch: _check_branch patch: _check_branch
@echo "$(T)🚀 Bumping patch...$(R)" @echo "$(T)🚀 Bumping patch...$(R)"
SKIP=all $(BUMP_CMD) patch SKIP=all $(BUMP_CMD) patch
@$(MAKE) -s _push_tag
prune: check-docker prune: check-docker
@echo "$(T)🗑️ Pruning Docker resources...$(R)" @echo "$(T)🗑️ Pruning Docker resources...$(R)"
@@ -237,8 +239,12 @@ _check_branch:
echo "❌ Error: not on the main branch"; exit 1; \ echo "❌ Error: not on the main branch"; exit 1; \
fi fi
_ci-image-name: _ci-dump-config:
@echo "IMAGE_NAME=$(IMAGE_NAME)" @echo "image_name=$(IMAGE_NAME)"
@echo "python_version=$(PYTHON_VERSION)"
@echo "python_version_short=$(PYTHON_VERSION_SHORT)"
@echo "runner=$(RUNNER)"
@echo "service_name=$(SERVICE_NAME)"
_ci-run-tests: build-test _ci-run-tests: build-test
@echo "$(T)🧪 Running tests in Docker...$(R)" @echo "$(T)🧪 Running tests in Docker...$(R)"
@@ -247,3 +253,8 @@ _ci-run-tests: build-test
-e TMDB_API_KEY \ -e TMDB_API_KEY \
$(IMAGE_NAME):test pytest $(IMAGE_NAME):test pytest
@echo "✅ Tests passed." @echo "✅ Tests passed."
_push_tag:
@echo "$(T)📦 Pushing tag...$(R)"
git push --tags
@echo "✅ Tag pushed. Check CI for build status."
+1 -1
View File
@@ -1,5 +1,5 @@
[tool.bumpversion] [tool.bumpversion]
current_version = "0.1.4" current_version = "0.1.6"
parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)" parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
serialize = ["{major}.{minor}.{patch}"] serialize = ["{major}.{minor}.{patch}"]
search = "{current_version}" search = "{current_version}"
+3 -2
View File
@@ -1,5 +1,6 @@
# Dockerfile for Agent Media # syntax=docker/dockerfile:1
# Multi-stage build for smaller image size # check=skip=InvalidDefaultArgInFrom
ARG PYTHON_VERSION ARG PYTHON_VERSION
ARG PYTHON_VERSION_SHORT ARG PYTHON_VERSION_SHORT
ARG RUNNER ARG RUNNER
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "agent-media" name = "agent-media"
version = "0.1.4" version = "0.1.6"
description = "AI agent for managing a local media library" description = "AI agent for managing a local media library"
authors = ["Francwa <francois.hodiaumont@gmail.com>"] authors = ["Francwa <francois.hodiaumont@gmail.com>"]
readme = "README.md" readme = "README.md"
+28
View File
@@ -0,0 +1,28 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":disableRateLimiting",
":semanticCommits"
],
"labels": ["dependencies", "renovate"],
"packageRules": [
{
"matchLanguages": ["python"],
"matchUpdateTypes": ["minor", "patch"],
"groupName": "all non-major python dependencies",
"groupSlug": "all-minor-patch-python"
}
],
"regexManagers": [
{
"description": "Update Docker variables in the Makefile",
"fileMatch": ["^Makefile$"],
"matchStrings": [
"# renovate: datasource=(?<datasource>.*?) depName=(?<depName>.*?)( versioning=(?<versioning>.*?))?\\s[A-Z_]+_VERSION [?:]?= (?<currentValue>.*)"
]
}
]
}