mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-19 20:09:07 +02:00
* [infrastructure] Restrict the FreeBSD port job to stable releases The port scripts picked the target version by scraping the GitHub tags page and only dropped tags containing "rc". A canary tag such as v0.81.0-canary.pr-8098.1 sorts above the latest stable release, so the job tried to package a prerelease, and the page only lists ten tags, so a run of prereleases could leave no candidate at all. Both scripts now share one helper that reads the tags API, keeps MAJOR.MINOR.PATCH versions only, and rejects an explicitly requested prerelease. Go proxy downloads fail instead of hashing an error page. The job moves out of the release workflow into its own, so it runs on pushes to main, on release tags, and on pull requests that touch the scripts or the workflow itself. Prerelease tags skip the job, and a stable tag is packaged directly rather than whatever happens to be the latest release at the time. * [infrastructure] Keep the FreeBSD port job in the release workflow A separate workflow would rename the check and detach the job from the release run, so the job stays in release.yml behind a small trigger job that decides when it runs: pushes to main, stable release tags, and pull requests that touch the port scripts or the workflow. Prerelease tags and other branches skip it. Tags are now listed with git ls-remote, which returns every tag in one call and needs neither a token nor pagination, and the Go module proxy downloads are limited to HTTPS like the other fetches. * [infrastructure] Address Sonar findings in the FreeBSD port helper Read the version into a local and return explicitly from is_stable_version. * [infrastructure] Address review findings in the FreeBSD port job Only a full vMAJOR.MINOR.PATCH tag starts the port job, so a tag like v1.2 skips it instead of failing in the resolver. The diff detection steps use a glob array rather than parsing ls, and quote GITHUB_OUTPUT. A failed tag listing now stops the issue body script instead of writing an incomplete changelog, and a bare "v" argument is rejected rather than treated as a request for the latest release.
119 lines
3.5 KiB
Bash
Executable File
119 lines
3.5 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# FreeBSD Port Issue Body Generator for NetBird
|
|
#
|
|
# This script generates the issue body content for submitting a FreeBSD port update
|
|
# to the FreeBSD Bugzilla at https://bugs.freebsd.org/bugzilla/
|
|
#
|
|
# Usage: ./freebsd-port-issue-body.sh [old_version] [new_version]
|
|
# Example: ./freebsd-port-issue-body.sh 0.56.0 0.59.1
|
|
#
|
|
# If no versions are provided, the script will:
|
|
# - Fetch OLD version from the FreeBSD ports GitHub mirror (current version in ports tree)
|
|
# - Fetch NEW version from the latest stable NetBird release tag on GitHub
|
|
#
|
|
# Prerelease versions (canary, rc, ...) are rejected: the port only tracks
|
|
# stable releases.
|
|
|
|
set -e
|
|
|
|
# shellcheck source=release_files/freebsd-port-lib.sh
|
|
source "$(dirname "${BASH_SOURCE[0]}")/freebsd-port-lib.sh"
|
|
|
|
OLD_VERSION="${1:-}"
|
|
NEW_VERSION="${2:-}"
|
|
|
|
if [[ -z "$OLD_VERSION" ]]; then
|
|
OLD_VERSION=$(fetch_current_ports_version)
|
|
echo "Detected OLD version from FreeBSD ports: $OLD_VERSION" >&2
|
|
fi
|
|
|
|
if [[ -z "$NEW_VERSION" ]]; then
|
|
NEW_VERSION=$(resolve_target_version "")
|
|
echo "Detected NEW version from GitHub: $NEW_VERSION" >&2
|
|
else
|
|
NEW_VERSION=$(resolve_target_version "$NEW_VERSION")
|
|
fi
|
|
|
|
if [[ "$OLD_VERSION" = "$NEW_VERSION" ]]; then
|
|
echo "Warning: OLD and NEW versions are the same ($OLD_VERSION). Port may already be up to date." >&2
|
|
fi
|
|
|
|
echo "" >&2
|
|
|
|
OUTPUT_DIR="${OUTPUT_DIR:-.}"
|
|
|
|
fetch_releases_between_versions() {
|
|
echo "Fetching release history from GitHub..." >&2
|
|
|
|
local tags
|
|
tags=$(fetch_stable_tags) || return 1
|
|
|
|
# List the stable releases after OLD up to and including NEW
|
|
echo "$tags" | \
|
|
while read -r ver; do
|
|
if [[ "$(printf '%s\n' "$OLD_VERSION" "$ver" | sort -V | head -n1)" = "$OLD_VERSION" ]] && \
|
|
[[ "$(printf '%s\n' "$ver" "$NEW_VERSION" | sort -V | head -n1)" = "$ver" ]] && \
|
|
[[ "$ver" != "$OLD_VERSION" ]]; then
|
|
echo "$ver"
|
|
fi
|
|
done
|
|
return 0
|
|
}
|
|
|
|
generate_changelog_section() {
|
|
local releases
|
|
releases=$(fetch_releases_between_versions) || return 1
|
|
|
|
echo "Changelogs:"
|
|
if [[ -n "$releases" ]]; then
|
|
echo "$releases" | while read -r ver; do
|
|
echo "https://github.com/${GITHUB_REPO}/releases/tag/v${ver}"
|
|
done
|
|
else
|
|
echo "https://github.com/${GITHUB_REPO}/releases/tag/v${NEW_VERSION}"
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
OUTPUT_FILE="${OUTPUT_DIR}/netbird-${NEW_VERSION}-issue.txt"
|
|
|
|
# Built before the heredoc: a failing substitution inside it would not stop the script.
|
|
CHANGELOG=$(generate_changelog_section)
|
|
|
|
cat << EOT > "$OUTPUT_FILE"
|
|
BUGZILLA ISSUE DETAILS
|
|
======================
|
|
|
|
Severity: Affects Some People
|
|
|
|
Summary: security/netbird: Update to ${NEW_VERSION}
|
|
|
|
Description:
|
|
------------
|
|
security/netbird: Update ${OLD_VERSION} => ${NEW_VERSION}
|
|
|
|
${CHANGELOG}
|
|
|
|
Commit log:
|
|
https://github.com/${GITHUB_REPO}/compare/v${OLD_VERSION}...v${NEW_VERSION}
|
|
EOT
|
|
|
|
echo "========================================="
|
|
echo "Issue body saved to: ${OUTPUT_FILE}"
|
|
echo "========================================="
|
|
echo ""
|
|
cat "$OUTPUT_FILE"
|
|
echo ""
|
|
echo "========================================="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Go to https://bugs.freebsd.org/bugzilla/ and login"
|
|
echo "2. Click 'Report an update or defect to a port'"
|
|
echo "3. Fill in:"
|
|
echo " - Severity: Affects Some People"
|
|
echo " - Summary: security/netbird: Update to ${NEW_VERSION}"
|
|
echo " - Description: Copy content from ${OUTPUT_FILE}"
|
|
echo "4. Attach diff file: netbird-${NEW_VERSION}.diff"
|
|
echo "5. Submit the bug report"
|