Testing openbuild-keep.txt file with include folder

This commit is contained in:
2025-10-06 22:12:42 +02:00
parent f341d80dec
commit 9ae603bfc9
2 changed files with 29 additions and 43 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# Files and folders to include in Flux-oss mirror # Files and folders to include in Flux-openbuild mirror
# Lines starting with '#' are comments # Lines starting with '#' are comments
# --- Top-level open-source docs --- # --- Top-level open-source docs ---
+27 -41
View File
@@ -1,54 +1,40 @@
name: Sync public mirror - name: Sync files using .gitea/workflows/openbuild-keep.txt (debug)
on:
push:
branches: [ main ]
jobs:
sync:
runs-on: ubuntu-latest
container: node:20-alpine
steps:
- name: Install tools
run: apk add --no-cache git rsync openssh-client bash
- name: Checkout private repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare SSH
env:
SSH_KEY: ${{ secrets.PUBLIC_REPO_SSH_KEY }}
run: | run: |
set -euo pipefail set -euo pipefail
mkdir -p ~/.ssh set -x
echo "$SSH_KEY" > ~/.ssh/id_sync
chmod 600 ~/.ssh/id_sync
printf 'Host 192.168.1.15\n HostName 192.168.1.15\n Port 22\n User git\n IdentityFile ~/.ssh/id_sync\n IdentitiesOnly yes\n' >> ~/.ssh/config
ssh-keyscan -p 22 192.168.1.15 >> ~/.ssh/known_hosts
- name: Clone public repo KEEP_FILE=".gitea/workflows/openbuild-keep.txt" # <- change if you use another name
run: git clone --depth 1 ssh://git@192.168.1.15:22/Bausager/Flux-openbuild.git /tmp/public INCLUDE_FILE="$(pwd)/.oss-include.rsync"
- name: Sync files using .gitea/workflows/openbuild-keep.txt # Show what exists in the source
run: | echo "== Source tree (top) =="
set -euo pipefail ls -la
KEEP_FILE=".gitea/workflows/openbuild-keep.txt" echo "== Source include/* (2 levels) =="
INCLUDE_FILE="$(pwd)/.openbuild-include.rsync" find include -maxdepth 2 -type f -print 2>/dev/null || true
# Build rsync include file
: > "$INCLUDE_FILE" : > "$INCLUDE_FILE"
echo "+ */" >> "$INCLUDE_FILE" echo "## Generated from $KEEP_FILE" >> "$INCLUDE_FILE"
echo "+ */" >> "$INCLUDE_FILE" # allow directory descent
# Always include the directory entry itself when using /** patterns
echo "+ include/" >> "$INCLUDE_FILE" # safe even if not present
while IFS= read -r line; do while IFS= read -r line; do
line="${line%%#*}"; line="$(echo "$line" | xargs || true)" line="${line%%#*}"
line="$(echo "$line" | xargs || true)"
[ -z "$line" ] && continue [ -z "$line" ] && continue
case "$line" in case "$line" in
!*) echo "- ${line#!}";; !*) echo "- ${line#!}" >> "$INCLUDE_FILE" ;;
*) echo "+ $line";; *) echo "+ $line" >> "$INCLUDE_FILE" ;;
esac esac
done >> "$INCLUDE_FILE" done < "$KEEP_FILE"
echo "- *" >> "$INCLUDE_FILE"
rsync -a --delete --prune-empty-dirs \ echo "- *" >> "$INCLUDE_FILE" # exclude everything else
echo "== Rsync include rules =="
cat "$INCLUDE_FILE"
rsync -av --delete --prune-empty-dirs \
--exclude '.git/' \ --exclude '.git/' \
--include-from="$INCLUDE_FILE" \ --include-from="$INCLUDE_FILE" \
./ /tmp/public/ ./ /tmp/public/