Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f8d892a353 | |||
| ec04c475d9 | |||
| 945b58fc63 | |||
| e8b04c63d3 | |||
| c877dcb6d0 | |||
| 10e53c06d6 | |||
| 244bad2bc0 | |||
| 1523cb92e7 | |||
| 13a89e7944 | |||
| 6d23231570 | |||
| 1b1ddf1682 | |||
| dc7d49c764 | |||
| 4d347aa0d6 |
@@ -1,29 +0,0 @@
|
||||
name: Sync Compose Directory
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Runs at 2:00 UTC every day; adjust as needed
|
||||
- cron: "0 2 * * *"
|
||||
workflow_dispatch: # allows manual trigger
|
||||
|
||||
jobs:
|
||||
sync-compose:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Step 1: Checkout the repo
|
||||
- name: Checkout benedikta-ovos
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Sync compose from ovos-docker
|
||||
run: |
|
||||
# Make the sync script executable
|
||||
chmod +x ./update-sync-ovos-compose.sh
|
||||
# Run the script
|
||||
./update-sync-ovos-compose.sh
|
||||
|
||||
- name: Commit & push changes
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
add: "compose"
|
||||
message: "Update compose/ from ovos-docker:dev"
|
||||
push: true
|
||||
@@ -0,0 +1,173 @@
|
||||
name: Renovate PR Deployment
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types: [closed]
|
||||
branches:
|
||||
- main
|
||||
|
||||
env:
|
||||
HC_VAULT_VERSION: "1.18.0"
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
if: |
|
||||
github.event.pull_request.merged == true &&
|
||||
github.event.pull_request.user.login == 'renovate-bot' &&
|
||||
startsWith(github.event.pull_request.head.ref, 'renovate/docker-compose')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Vault
|
||||
uses: cpanato/vault-installer@main
|
||||
with:
|
||||
version: ${{ env.HC_VAULT_VERSION }}
|
||||
|
||||
- name: Detect Renovate update type
|
||||
id: detect-update
|
||||
env:
|
||||
PR_BODY: ${{ github.event.pull_request.body }}
|
||||
run: |
|
||||
echo "PR body: $PR_BODY"
|
||||
|
||||
if echo "$PR_BODY" | grep -qE 'Update Type: (patch|minor|major|digest)'; then
|
||||
echo "update=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "update=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Stop if update not patch/minor/major/digest
|
||||
if: steps.detect-update.outputs.update != 'true'
|
||||
run: |
|
||||
echo "::warning::This PR does not involve patch/minor/major/digest update. Skipping deployment."
|
||||
exit 0
|
||||
|
||||
- name: Get changed services from docker-compose.yml
|
||||
id: services
|
||||
run: |
|
||||
echo "Getting services from main and ${{ github.ref_name }}"
|
||||
|
||||
# Dynamically find all docker-compose YAML files (root + compose folder)
|
||||
COMPOSE_FILES=($(find . -maxdepth 2 -type f -name 'docker-compose*.yml' | sort))
|
||||
|
||||
echo "Found Compose files:"
|
||||
printf '%s\n' "${COMPOSE_FILES[@]}"
|
||||
|
||||
# Temp files to store all services
|
||||
touch services_main_all.txt services_head_all.txt
|
||||
|
||||
for f in "${COMPOSE_FILES[@]}"; do
|
||||
echo "Processing $f"
|
||||
|
||||
# Create a safe filename by replacing slashes with underscores
|
||||
safe_f=$(echo "$f" | sed 's|[./]|_|g')
|
||||
|
||||
# Fetch main version
|
||||
git show origin/main:"$f" > "main_${safe_f}" 2>/dev/null || touch "main_${safe_f}"
|
||||
cp "$f" "head_${safe_f}"
|
||||
|
||||
# Extract services and append to global list
|
||||
yq '.services | keys | .[]' "main_${safe_f}" >> services_main_all.txt 2>/dev/null || true
|
||||
yq '.services | keys | .[]' "head_${safe_f}" >> services_head_all.txt 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Sort and deduplicate
|
||||
sort -u services_main_all.txt -o services_main_all.txt
|
||||
sort -u services_head_all.txt -o services_head_all.txt
|
||||
|
||||
echo "Creating list of modified services..."
|
||||
touch service_changes.txt
|
||||
|
||||
# Added services
|
||||
comm -13 services_main_all.txt services_head_all.txt | while read service; do
|
||||
echo "$service: added" >> service_changes.txt
|
||||
done
|
||||
|
||||
# Modified services (parallelized)
|
||||
comm -12 services_main_all.txt services_head_all.txt | xargs -n1 -P4 -I{} bash -c '
|
||||
service="{}"
|
||||
modified=0
|
||||
for f in "${COMPOSE_FILES[@]}"; do
|
||||
safe_f=$(echo "$f" | sed "s|[./]|_|g")
|
||||
yq ".services[\"$service\"]" "main_${safe_f}" > tmp_main.yml 2>/dev/null || continue
|
||||
yq ".services[\"$service\"]" "head_${safe_f}" > tmp_head.yml 2>/dev/null || continue
|
||||
if ! diff -q tmp_main.yml tmp_head.yml > /dev/null; then
|
||||
modified=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [[ $modified -eq 1 ]]; then
|
||||
echo "$service: modified" >> service_changes.txt
|
||||
fi
|
||||
'
|
||||
|
||||
echo "Detected service changes:"
|
||||
cat service_changes.txt
|
||||
|
||||
if [[ -z $(cat service_changes.txt) ]]; then
|
||||
echo "watchtower" > service_changes.txt
|
||||
echo "Placeholder:"
|
||||
cat service_changes.txt
|
||||
fi
|
||||
|
||||
mod_svcs=$(cut -d':' -f1 service_changes.txt | sort | uniq | tr '\n' ' ' | sed 's/ *$//')
|
||||
echo "docker_svc_list<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$mod_svcs" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: List of Services for (Re)Deployment
|
||||
run: |
|
||||
echo -e "${{ steps.services.outputs.docker_svc_list }}"
|
||||
|
||||
- name: Get list of Compose files
|
||||
id: compose_file_list
|
||||
run: |
|
||||
compose_list=$(find . -type f -name "docker-compose*.yml" \
|
||||
-a ! -name "*windows*" \
|
||||
-a ! -name "*gui*" \
|
||||
-a ! -name "*macos*" \
|
||||
-a ! -name "*hivemind*" \
|
||||
-a ! -name "*server*" \
|
||||
| sed -e ':a;N;$!ba;s/[\r\n]/ /g')
|
||||
|
||||
echo "compose_list=$compose_list" >> "$GITHUB_OUTPUT"
|
||||
echo "Compose files: $compose_list"
|
||||
|
||||
- name: Generate .env file for Docker Compose
|
||||
run: |
|
||||
vault kv get -format=json benedikta-docker/env | jq -r '.data.data' | jq -r 'keys[] as $k | "\($k)='\''\(.[$k])'\''"' > .env
|
||||
|
||||
- name: Gotify Notification
|
||||
uses: eikendev/gotify-action@master
|
||||
with:
|
||||
gotify_api_base: "${{ secrets.GOTIFY_URL }}"
|
||||
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||
notification_title: "GITEA: [RENOVATE] Docker Compose Deployment @ Rikku"
|
||||
notification_message: "Starting Docker Compose run..."
|
||||
|
||||
- name: Docker Compose Deployment
|
||||
uses: cssnr/stack-deploy-action@v1.4.0
|
||||
with:
|
||||
mode: compose
|
||||
file: ${{ steps.compose_file_list.outputs.compose_list }}
|
||||
name: "ovosmisc"
|
||||
host: 192.168.1.250
|
||||
user: ovos
|
||||
ssh_key: ${{ secrets.BDIKTA_GITEA_PRIVATE_SSH_KEY }}
|
||||
args: --remove-orphans ${{ steps.services.outputs.docker_svc_list }}
|
||||
env_file: ".env"
|
||||
# registry_host: 'ghcr.io'
|
||||
# registry_user: TrezOne
|
||||
# registry_pass: ${{ secrets.GHCR_LOGIN_TOKEN }}
|
||||
summary: true
|
||||
|
||||
- name: Gotify Notification
|
||||
uses: eikendev/gotify-action@master
|
||||
with:
|
||||
gotify_api_base: "${{ secrets.GOTIFY_URL }}"
|
||||
gotify_app_token: "${{ secrets.RUNNER_GOTIFY_TOKEN }}"
|
||||
notification_title: "GITEA: [RENOVATE] Docker Compose Deployment @ Rikku"
|
||||
notification_message: "Deployment completed successfully."
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Renovate
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0/30 * * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
renovate:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Renovate Run
|
||||
env:
|
||||
DOCKER_HOST: tcp://dockerproxy:2375
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e RENOVATE_PLATFORM=gitea \
|
||||
-e RENOVATE_ENDPOINT=https://git.trez.wtf/api/v1 \
|
||||
-e RENOVATE_TOKEN=${{ secrets.RENOVATE_BOT_TOKEN }} \
|
||||
-e LOG_LEVEL=debug \
|
||||
-e RENOVATE_GITHUB_COM_TOKEN=${{ secrets.RENOVATE_GITHUB_TOKEN }} \
|
||||
-e RENOVATE_CONFIG_FILE=renovate.json \
|
||||
--volumes-from ${{ env.JOB_CONTAINER_NAME }} \
|
||||
-w ${GITHUB_WORKSPACE} \
|
||||
renovate/renovate:41.97.7-full
|
||||
@@ -113,25 +113,6 @@ services:
|
||||
restart: always
|
||||
ports:
|
||||
- 9001:9001
|
||||
portracker:
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
- SYS_ADMIN
|
||||
container_name: portracker
|
||||
environment:
|
||||
DATABASE_PATH: /data/portracker.db
|
||||
DEBUG: false
|
||||
DOCKER_HOST: tcp://dockerproxy:2375
|
||||
PORT: 4999
|
||||
image: mostafawahied/portracker:latest
|
||||
pid: "host"
|
||||
ports:
|
||||
- 4999:4999
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
- apparmor:unconfined
|
||||
volumes:
|
||||
- portracker-data:/data
|
||||
signoz-logspout:
|
||||
command: signoz://192.168.1.254:8082
|
||||
container_name: signoz-logspout
|
||||
|
||||
+3
-58
@@ -1,60 +1,5 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": [
|
||||
"config:recommended"
|
||||
],
|
||||
"prHourlyLimit": 2,
|
||||
"prConcurrentLimit": 5,
|
||||
"dependencyDashboard": true,
|
||||
"labels": [
|
||||
"dependencies",
|
||||
"renovate"
|
||||
],
|
||||
"schedule": [
|
||||
"before 6am on monday"
|
||||
],
|
||||
"branchNameStrict": true,
|
||||
"branchPrefix": "renovate/",
|
||||
"branchTopic": "{{service}}/{{depName}}",
|
||||
"commitMessageAction": "Update",
|
||||
"commitMessageTopic": "{{service}}/{{depName}}",
|
||||
"docker": {
|
||||
"fileMatch": [
|
||||
"docker-compose.*\\.yml$",
|
||||
"compose/.*\\.yml$"
|
||||
],
|
||||
"pinDigests": true
|
||||
},
|
||||
"packageRules": [
|
||||
{
|
||||
"matchManagers": ["docker"],
|
||||
"groupName": "docker-updates",
|
||||
"groupSlug": "docker-updates"
|
||||
},
|
||||
{
|
||||
"matchManagers": ["docker"],
|
||||
"matchUpdateTypes": ["patch"],
|
||||
"automerge": true,
|
||||
"automergeType": "branch",
|
||||
"automergeStrategy": "squash",
|
||||
"minimumReleaseAge": "3 days"
|
||||
},
|
||||
{
|
||||
"matchManagers": ["docker"],
|
||||
"matchUpdateTypes": ["major", "minor"],
|
||||
"automerge": false
|
||||
},
|
||||
{
|
||||
"matchManagers": ["github-actions"],
|
||||
"matchPackageNames": [
|
||||
"actions/checkout",
|
||||
"supplypike/setup-bin"
|
||||
],
|
||||
"allowedVersions": "^4.0.0",
|
||||
"groupName": "github-actions (pinned to v4)"
|
||||
}
|
||||
],
|
||||
"semanticCommits": "enabled",
|
||||
"commitMessagePrefix": "🔧 ",
|
||||
"rebaseWhen": "behind-base-branch"
|
||||
}
|
||||
"extends": ["local>trez/renovate-config"],
|
||||
"ignorePaths": ["ovos-compose/**"]
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Config
|
||||
OVOS_DOCKER_DIR="../ovos-docker"
|
||||
OVOS_REMOTE="ovos-docker-local"
|
||||
SPLIT_BRANCH="compose-split"
|
||||
PREFIX="compose"
|
||||
|
||||
# Clone ovos-docker if missing
|
||||
if [ ! -d "$OVOS_DOCKER_DIR/.git" ]; then
|
||||
echo "Cloning ovos-docker..."
|
||||
git clone https://github.com/OpenVoiceOS/ovos-docker.git "$OVOS_DOCKER_DIR"
|
||||
fi
|
||||
|
||||
# Update ovos-docker
|
||||
echo "Updating ovos-docker..."
|
||||
cd "$OVOS_DOCKER_DIR"
|
||||
git fetch origin
|
||||
git checkout dev
|
||||
git pull origin dev
|
||||
|
||||
# Create split branch
|
||||
echo "Splitting compose/ directory..."
|
||||
git branch -D "$SPLIT_BRANCH" 2>/dev/null || true
|
||||
git subtree split --prefix=$PREFIX origin/dev -b "$SPLIT_BRANCH"
|
||||
|
||||
# Go back to benedikta-ovos
|
||||
cd - >/dev/null
|
||||
|
||||
# Add remote if not exists
|
||||
if ! git remote | grep -q "$OVOS_REMOTE"; then
|
||||
git remote add "$OVOS_REMOTE" "$OVOS_DOCKER_DIR"
|
||||
fi
|
||||
git fetch "$OVOS_REMOTE"
|
||||
|
||||
# Check if compose/ already exists in benedikta-ovos
|
||||
if [ ! -d "$PREFIX" ]; then
|
||||
echo "Adding compose/ for the first time..."
|
||||
git subtree add --prefix=$PREFIX "$OVOS_REMOTE" "$SPLIT_BRANCH" --squash
|
||||
else
|
||||
echo "Updating existing compose/ directory..."
|
||||
git subtree pull --prefix=$PREFIX "$OVOS_REMOTE" "$SPLIT_BRANCH" --squash
|
||||
fi
|
||||
|
||||
echo "✅ compose/ is synced with ovos-docker:dev"
|
||||
Reference in New Issue
Block a user