cleanups
This commit is contained in:
1 parent
fb5f01d291
commit
7168bc4683
10 files changed
+370
-72
No files matched your search
@@ -151,8 +151,22 @@ cp -f "$DEB_FILE" "$AGENT_DEB_FILE" "$DATA_DIR/packages/deb/"
|
||||
cp -f "$RPM_FILE" "$AGENT_RPM_FILE" "$DATA_DIR/packages/rpm/x86_64/"
|
||||
cp -f "$SUSE_RPM_FILE" "$SUSE_AGENT_RPM_FILE" "$DATA_DIR/packages/suse/x86_64/"
|
||||
|
||||
log "updating aptly internal repository"
|
||||
aptly -config="$APTLY_CONF" repo add -force-replace package-builder "$DEB_FILE" "$AGENT_DEB_FILE" >/dev/null
|
||||
# Retention is per product, not per file pool: keep ten RustProxy versions and
|
||||
# ten Docker Agent versions in each Linux package family by default.
|
||||
package_retention=${PACKAGE_RETENTION:-10}
|
||||
prune_package_files "$DATA_DIR/packages/deb" "${PACKAGE_NAME}_*.deb" "$package_retention"
|
||||
prune_package_files "$DATA_DIR/packages/deb" 'rustproxy-docker-agent_*.deb' "$package_retention"
|
||||
prune_package_files "$DATA_DIR/packages/rpm/x86_64" "${PACKAGE_NAME}-*.x86_64.rpm" "$package_retention" 'rustproxy-docker-agent-*.x86_64.rpm'
|
||||
prune_package_files "$DATA_DIR/packages/rpm/x86_64" 'rustproxy-docker-agent-*.x86_64.rpm' "$package_retention"
|
||||
prune_package_files "$DATA_DIR/packages/suse/x86_64" "${PACKAGE_NAME}-*.x86_64.rpm" "$package_retention" 'rustproxy-docker-agent-*.x86_64.rpm'
|
||||
prune_package_files "$DATA_DIR/packages/suse/x86_64" 'rustproxy-docker-agent-*.x86_64.rpm' "$package_retention"
|
||||
|
||||
log "updating aptly internal repository from retained DEB packages"
|
||||
# Make the mutable local repo match the retained raw DEB pool exactly. Existing
|
||||
# snapshots are immutable and remain valid until the new snapshot is published.
|
||||
aptly -config="$APTLY_CONF" repo remove package-builder "$PACKAGE_NAME" >/dev/null 2>&1 || true
|
||||
aptly -config="$APTLY_CONF" repo remove package-builder rustproxy-docker-agent >/dev/null 2>&1 || true
|
||||
aptly -config="$APTLY_CONF" repo add -force-replace package-builder "$DATA_DIR/packages/deb" >/dev/null
|
||||
SNAPSHOT="linux-${VERSION}-${SHORT_SHA}-$(date +%s)"
|
||||
aptly -config="$APTLY_CONF" snapshot create "$SNAPSHOT" from repo package-builder >/dev/null
|
||||
|
||||
@@ -174,6 +188,18 @@ APT_PUBLIC="$DATA_DIR/aptly/public"
|
||||
gpg --batch --verify "$APT_PUBLIC/dists/$REPO_DISTRIBUTION/Release.gpg" "$APT_PUBLIC/dists/$REPO_DISTRIBUTION/Release" >/dev/null 2>&1 \
|
||||
|| fatal "APT Release signature verification failed"
|
||||
|
||||
# The new snapshot is now live. Older Linux snapshots are no longer needed;
|
||||
# removing them lets aptly reclaim unreferenced pool objects.
|
||||
while IFS= read -r old_snapshot; do
|
||||
[[ -n "$old_snapshot" && "$old_snapshot" != "$SNAPSHOT" ]] || continue
|
||||
if ! aptly -config="$APTLY_CONF" snapshot drop "$old_snapshot" >/dev/null 2>&1; then
|
||||
log "WARN: could not drop old aptly snapshot $old_snapshot"
|
||||
fi
|
||||
done < <(aptly -config="$APTLY_CONF" snapshot list -raw | grep '^linux-' || true)
|
||||
if ! aptly -config="$APTLY_CONF" db cleanup >/dev/null 2>&1; then
|
||||
log "WARN: aptly database cleanup failed"
|
||||
fi
|
||||
|
||||
mkdir -p "$RELEASE_DIR/apt" "$RELEASE_DIR/rpm/x86_64" "$RELEASE_DIR/suse/x86_64" "$RELEASE_DIR/opnsense" "$RELEASE_DIR/freebsd"
|
||||
CURRENT_TARGET=""
|
||||
if [[ -L "$REPOSITORY/current" ]]; then
|
||||
@@ -190,9 +216,21 @@ if [[ -n "$CURRENT_TARGET" ]]; then
|
||||
done
|
||||
fi
|
||||
|
||||
rsync -a --delete "$APT_PUBLIC"/ "$RELEASE_DIR/apt"/
|
||||
rsync -a --delete "$DATA_DIR/packages/rpm"/ "$RELEASE_DIR/rpm"/
|
||||
rsync -a --delete "$DATA_DIR/packages/suse"/ "$RELEASE_DIR/suse"/
|
||||
if [[ -n "$CURRENT_TARGET" && -d "$CURRENT_TARGET/apt" ]]; then
|
||||
rsync -a --delete --link-dest="$CURRENT_TARGET/apt/" "$APT_PUBLIC"/ "$RELEASE_DIR/apt"/
|
||||
else
|
||||
rsync -a --delete "$APT_PUBLIC"/ "$RELEASE_DIR/apt"/
|
||||
fi
|
||||
if [[ -n "$CURRENT_TARGET" && -d "$CURRENT_TARGET/rpm" ]]; then
|
||||
rsync -a --delete --link-dest="$CURRENT_TARGET/rpm/" "$DATA_DIR/packages/rpm"/ "$RELEASE_DIR/rpm"/
|
||||
else
|
||||
rsync -a --delete "$DATA_DIR/packages/rpm"/ "$RELEASE_DIR/rpm"/
|
||||
fi
|
||||
if [[ -n "$CURRENT_TARGET" && -d "$CURRENT_TARGET/suse" ]]; then
|
||||
rsync -a --delete --link-dest="$CURRENT_TARGET/suse/" "$DATA_DIR/packages/suse"/ "$RELEASE_DIR/suse"/
|
||||
else
|
||||
rsync -a --delete "$DATA_DIR/packages/suse"/ "$RELEASE_DIR/suse"/
|
||||
fi
|
||||
for rpm_root in "$RELEASE_DIR/rpm/x86_64" "$RELEASE_DIR/suse/x86_64"; do
|
||||
rm -rf "$rpm_root/repodata"
|
||||
createrepo_c --update "$rpm_root" >/dev/null
|
||||
|
||||
Reference in new issue
Block a user