-
Notifications
You must be signed in to change notification settings - Fork 1.9k
workflows: fix release process #11637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| # Upload an APT repo in two phases so Release metadata only becomes visible | ||
| # after the referenced package indexes and pool files are already uploaded. | ||
|
|
||
| SOURCE_DIR=${1:?Usage: sync-apt-repo-to-s3.sh <source-dir> <s3-destination>} | ||
| DESTINATION=${2:?Usage: sync-apt-repo-to-s3.sh <source-dir> <s3-destination>} | ||
|
|
||
| if [[ ! -d "$SOURCE_DIR" ]]; then | ||
| echo "ERROR: missing source dir: $SOURCE_DIR" | ||
| exit 1 | ||
| fi | ||
|
|
||
| SOURCE_DIR=$(realpath "$SOURCE_DIR") | ||
|
|
||
| aws s3 sync "$SOURCE_DIR" "$DESTINATION" \ | ||
| --delete \ | ||
| --follow-symlinks \ | ||
| --no-progress \ | ||
| --exclude "dists/*/InRelease" \ | ||
| --exclude "dists/*/Release" \ | ||
| --exclude "dists/*/Release.gpg" | ||
|
Comment on lines
+21
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Yes, excluded objects are skipped from deletion when using aws s3 sync with both --delete and --exclude. Citations:
🏁 Script executed: cat -n packaging/sync-apt-repo-to-s3.shRepository: fluent/fluent-bit Length of output: 1387 Excluded metadata won't be deleted; removed suites leave stale Phase 1 excludes Suggested fix (metadata sync with include filters + delete)-while IFS= read -r metadata_file; do
- relative_path=${metadata_file#"$SOURCE_DIR"/}
- aws s3 cp "$metadata_file" "$DESTINATION/$relative_path" --no-progress
-done < <(find "$DIST_DIR" -type f \( -name "InRelease" -o -name "Release" -o -name "Release.gpg" \) | sort)
+aws s3 sync "$DIST_DIR" "$DESTINATION/dists" \
+ --delete \
+ --no-progress \
+ --exclude "*" \
+ --include "*/InRelease" \
+ --include "*/Release" \
+ --include "*/Release.gpg"🤖 Prompt for AI Agents |
||
|
|
||
| DIST_DIR="$SOURCE_DIR/dists" | ||
| if [[ ! -d "$DIST_DIR" ]]; then | ||
| echo "ERROR: missing dists dir in source: $DIST_DIR" | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+17
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move repository preflight checks before the destructive sync step. Line 17 runs a Suggested fix SOURCE_DIR=$(realpath "$SOURCE_DIR")
+DIST_DIR="$SOURCE_DIR/dists"
+if [[ ! -d "$DIST_DIR" ]]; then
+ echo "ERROR: missing dists dir in source: $DIST_DIR"
+ exit 1
+fi
+
+mapfile -t METADATA_FILES < <(
+ find "$DIST_DIR" -type f \( -name "InRelease" -o -name "Release" -o -name "Release.gpg" \) | sort
+)
+if [[ ${`#METADATA_FILES`[@]} -eq 0 ]]; then
+ echo "ERROR: no APT metadata files found under: $DIST_DIR"
+ exit 1
+fi
+
aws s3 sync "$SOURCE_DIR" "$DESTINATION" \
--delete \
--follow-symlinks \
--no-progress \
--exclude "dists/*/InRelease" \
--exclude "dists/*/Release" \
--exclude "dists/*/Release.gpg"
-
-DIST_DIR="$SOURCE_DIR/dists"
-if [[ ! -d "$DIST_DIR" ]]; then
- echo "ERROR: missing dists dir in source: $DIST_DIR"
- exit 1
-fi🤖 Prompt for AI Agents |
||
|
|
||
| while IFS= read -r metadata_file; do | ||
| relative_path=${metadata_file#"$SOURCE_DIR"/} | ||
| aws s3 cp "$metadata_file" "$DESTINATION/$relative_path" --no-progress | ||
| done < <(find "$DIST_DIR" -type f \( -name "InRelease" -o -name "Release" -o -name "Release.gpg" \) | sort) | ||
Uh oh!
There was an error while loading. Please reload this page.