diff --git a/.github/scripts/download_packages.sh b/.github/scripts/download_packages.sh index 3291c085..31855edf 100755 --- a/.github/scripts/download_packages.sh +++ b/.github/scripts/download_packages.sh @@ -5,6 +5,22 @@ REPO="documentdb/documentdb" OUT_DIR="out" DOCUMENTDB_VERSION="${DOCUMENTDB_VERSION:-latest}" SUITE="${SUITE:-stable}" +# stable keeps its original paths; latest gets its own pools so each suite indexes only its release. +case "$SUITE" in + stable) + CHANNEL_PATH="" + PACKAGES_DIR="out/packages" + RELEASE_INFO="out/packages/release-info.json" ;; + latest) + CHANNEL_PATH="/latest" + # Nothing links to a direct-download mirror of latest, so its assets are only staged. + PACKAGES_DIR=$(mktemp -d) + RELEASE_INFO="out/packages/release-info-latest.json" ;; + *) + echo "Error: SUITE must be stable or latest (got '$SUITE')" + exit 1 ;; +esac +DEB_POOL_ROOT="pool${CHANNEL_PATH}" COMPONENTS="${COMPONENTS:-main}" ORIGIN="${ORIGIN:-DocumentDB}" DESCRIPTION="${DESCRIPTION:-DocumentDB APT and YUM Repository}" @@ -30,14 +46,14 @@ GOT_DEB=0 GOT_RPM=0 DEB_POOL="out/deb/pool/${COMPONENTS}" # Debian/Ubuntu pools -DEB_POOL_DEB11="out/deb/pool/deb11" -DEB_POOL_DEB12="out/deb/pool/deb12" -DEB_POOL_DEB13="out/deb/pool/deb13" -DEB_POOL_UBUNTU22="out/deb/pool/ubuntu22" -DEB_POOL_UBUNTU24="out/deb/pool/ubuntu24" +DEB_POOL_DEB11="out/deb/${DEB_POOL_ROOT}/deb11" +DEB_POOL_DEB12="out/deb/${DEB_POOL_ROOT}/deb12" +DEB_POOL_DEB13="out/deb/${DEB_POOL_ROOT}/deb13" +DEB_POOL_UBUNTU22="out/deb/${DEB_POOL_ROOT}/ubuntu22" +DEB_POOL_UBUNTU24="out/deb/${DEB_POOL_ROOT}/ubuntu24" # RPM pools -RPM_POOL_RHEL8="out/rpm/rhel8" -RPM_POOL_RHEL9="out/rpm/rhel9" +RPM_POOL_RHEL8="out/rpm${CHANNEL_PATH}/rhel8" +RPM_POOL_RHEL9="out/rpm${CHANNEL_PATH}/rhel9" DEB_DISTS="dists/${SUITE}" # AMD64 directories @@ -241,7 +257,7 @@ for asset in data.get('assets', []): comp=$(deb_component_for "$filename") [ -z "$comp" ] && continue claim_package "$comp" "$filename" || continue - wget -q -P out/packages "$download_url" || { + wget -q -P "$PACKAGES_DIR" "$download_url" || { echo "::error::Download failed: $filename" exit 1 } @@ -251,7 +267,7 @@ for asset in data.get('assets', []): # The distro prefix disambiguates release assets; it is not part of # the package name and must not survive into the pool. clean_name=$(echo "$filename" | sed -E 's/^(deb1[123]|ubuntu2[24]\.04)-//') - cp "out/packages/$filename" "$pool/$clean_name" + cp "$PACKAGES_DIR/$filename" "$pool/$clean_name" sign_deb_package "$pool/$clean_name" added=$((added + 1)) ;; @@ -277,7 +293,7 @@ for asset in data.get('assets', []): *) continue ;; esac if [ "$downloaded" -eq 0 ]; then - wget -q -P out/packages "$download_url" || { + wget -q -P "$PACKAGES_DIR" "$download_url" || { echo "::error::Download failed: $filename" exit 1 } @@ -286,7 +302,7 @@ for asset in data.get('assets', []): fi mkdir -p "$dest" echo " Adding to ${t}: $filename -> $clean_name" - cp "out/packages/$filename" "$dest/$clean_name" + cp "$PACKAGES_DIR/$filename" "$dest/$clean_name" added=$((added + 1)) done ;; @@ -294,7 +310,7 @@ for asset in data.get('assets', []): # Non-package assets (SHA256SUMS, manifest.txt, ...) are mirrored only # for the primary release, which is what the site links to. if [ "$tag" = "$PRIMARY_TAG" ]; then - wget -q -P out/packages "$download_url" || { + wget -q -P "$PACKAGES_DIR" "$download_url" || { echo "::error::Download failed: $filename" exit 1 } @@ -307,6 +323,8 @@ for asset in data.get('assets', []): done rm -f "$RELEASES_JSON" "$SEEN_FILE" +# PACKAGES_DIR is the published out/packages for stable and a mktemp staging dir otherwise. +[ "$SUITE" = stable ] || rm -rf "$PACKAGES_DIR" # release-info.json describes the primary release only: it is the "what is the # current version" feed for the site, not an inventory of the pool. @@ -327,7 +345,7 @@ output = { } for asset in data.get('assets', [])] } print(json.dumps(output, indent=2)) -" > out/packages/release-info.json +" > "$RELEASE_INFO" echo "Successfully processed packages from $REPO" echo "GOT_DEB=$GOT_DEB, GOT_RPM=$GOT_RPM" @@ -345,120 +363,120 @@ if [ "$GOT_DEB" = "1" ]; then echo "Building APT repository with active and retired compatibility components..." pushd out/deb >/dev/null - if [ -d "pool/ubuntu22" ] && [ "$(ls -A pool/ubuntu22/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/ubuntu22" ] && [ "$(ls -A ${DEB_POOL_ROOT}/ubuntu22/*.deb 2>/dev/null)" ]; then mkdir -p "${DEB_DISTS_COMPONENTS_AMD64}" "${DEB_DISTS_COMPONENTS_ARM64}" - dpkg-scanpackages --arch amd64 pool/ubuntu22/ > "${DEB_DISTS_COMPONENTS_AMD64}/Packages" - dpkg-scanpackages --arch arm64 pool/ubuntu22/ > "${DEB_DISTS_COMPONENTS_ARM64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/ubuntu22/ > "${DEB_DISTS_COMPONENTS_AMD64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/ubuntu22/ > "${DEB_DISTS_COMPONENTS_ARM64}/Packages" gzip -k -f "${DEB_DISTS_COMPONENTS_AMD64}/Packages" "${DEB_DISTS_COMPONENTS_ARM64}/Packages" fi - if [ -d "pool/deb11" ] && [ "$(ls -A pool/deb11/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/deb11" ] && [ "$(ls -A ${DEB_POOL_ROOT}/deb11/*.deb 2>/dev/null)" ]; then mkdir -p "${DEB_DISTS_DEB11_AMD64}" "${DEB_DISTS_DEB11_ARM64}" - dpkg-scanpackages --arch amd64 pool/deb11/ > "${DEB_DISTS_DEB11_AMD64}/Packages" - dpkg-scanpackages --arch arm64 pool/deb11/ > "${DEB_DISTS_DEB11_ARM64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/deb11/ > "${DEB_DISTS_DEB11_AMD64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/deb11/ > "${DEB_DISTS_DEB11_ARM64}/Packages" gzip -k -f "${DEB_DISTS_DEB11_AMD64}/Packages" "${DEB_DISTS_DEB11_ARM64}/Packages" fi - if [ -d "pool/deb12" ] && [ "$(ls -A pool/deb12/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/deb12" ] && [ "$(ls -A ${DEB_POOL_ROOT}/deb12/*.deb 2>/dev/null)" ]; then mkdir -p "${DEB_DISTS_DEB12_AMD64}" "${DEB_DISTS_DEB12_ARM64}" - dpkg-scanpackages --arch amd64 pool/deb12/ > "${DEB_DISTS_DEB12_AMD64}/Packages" - dpkg-scanpackages --arch arm64 pool/deb12/ > "${DEB_DISTS_DEB12_ARM64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/deb12/ > "${DEB_DISTS_DEB12_AMD64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/deb12/ > "${DEB_DISTS_DEB12_ARM64}/Packages" gzip -k -f "${DEB_DISTS_DEB12_AMD64}/Packages" "${DEB_DISTS_DEB12_ARM64}/Packages" fi - if [ -d "pool/deb13" ] && [ "$(ls -A pool/deb13/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/deb13" ] && [ "$(ls -A ${DEB_POOL_ROOT}/deb13/*.deb 2>/dev/null)" ]; then mkdir -p "${DEB_DISTS_DEB13_AMD64}" "${DEB_DISTS_DEB13_ARM64}" - dpkg-scanpackages --arch amd64 pool/deb13/ > "${DEB_DISTS_DEB13_AMD64}/Packages" - dpkg-scanpackages --arch arm64 pool/deb13/ > "${DEB_DISTS_DEB13_ARM64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/deb13/ > "${DEB_DISTS_DEB13_AMD64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/deb13/ > "${DEB_DISTS_DEB13_ARM64}/Packages" gzip -k -f "${DEB_DISTS_DEB13_AMD64}/Packages" "${DEB_DISTS_DEB13_ARM64}/Packages" fi - if [ -d "pool/ubuntu22" ] && [ "$(ls -A pool/ubuntu22/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/ubuntu22" ] && [ "$(ls -A ${DEB_POOL_ROOT}/ubuntu22/*.deb 2>/dev/null)" ]; then mkdir -p "${DEB_DISTS_UBUNTU22_AMD64}" "${DEB_DISTS_UBUNTU22_ARM64}" - dpkg-scanpackages --arch amd64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_AMD64}/Packages" - dpkg-scanpackages --arch arm64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_ARM64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/ubuntu22/ > "${DEB_DISTS_UBUNTU22_AMD64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/ubuntu22/ > "${DEB_DISTS_UBUNTU22_ARM64}/Packages" gzip -k -f "${DEB_DISTS_UBUNTU22_AMD64}/Packages" "${DEB_DISTS_UBUNTU22_ARM64}/Packages" fi - if [ -d "pool/ubuntu24" ] && [ "$(ls -A pool/ubuntu24/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/ubuntu24" ] && [ "$(ls -A ${DEB_POOL_ROOT}/ubuntu24/*.deb 2>/dev/null)" ]; then mkdir -p "${DEB_DISTS_UBUNTU24_AMD64}" "${DEB_DISTS_UBUNTU24_ARM64}" - dpkg-scanpackages --arch amd64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_AMD64}/Packages" - dpkg-scanpackages --arch arm64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_ARM64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/ubuntu24/ > "${DEB_DISTS_UBUNTU24_AMD64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/ubuntu24/ > "${DEB_DISTS_UBUNTU24_ARM64}/Packages" gzip -k -f "${DEB_DISTS_UBUNTU24_AMD64}/Packages" "${DEB_DISTS_UBUNTU24_ARM64}/Packages" fi # Create deb11 component (Debian 11 Bullseye) - if [ -d "pool/deb11" ] && [ "$(ls -A pool/deb11/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/deb11" ] && [ "$(ls -A ${DEB_POOL_ROOT}/deb11/*.deb 2>/dev/null)" ]; then # AMD64 packages mkdir -p "${DEB_DISTS_DEB11_AMD64}" echo "Scanning Debian 11 AMD64 packages for deb11 component" - dpkg-scanpackages --arch amd64 pool/deb11/ > "${DEB_DISTS_DEB11_AMD64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/deb11/ > "${DEB_DISTS_DEB11_AMD64}/Packages" gzip -k -f "${DEB_DISTS_DEB11_AMD64}/Packages" # ARM64 packages mkdir -p "${DEB_DISTS_DEB11_ARM64}" echo "Scanning Debian 11 ARM64 packages for deb11 component" - dpkg-scanpackages --arch arm64 pool/deb11/ > "${DEB_DISTS_DEB11_ARM64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/deb11/ > "${DEB_DISTS_DEB11_ARM64}/Packages" gzip -k -f "${DEB_DISTS_DEB11_ARM64}/Packages" fi # Create deb12 component (Debian 12 Bookworm) - if [ -d "pool/deb12" ] && [ "$(ls -A pool/deb12/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/deb12" ] && [ "$(ls -A ${DEB_POOL_ROOT}/deb12/*.deb 2>/dev/null)" ]; then # AMD64 packages mkdir -p "${DEB_DISTS_DEB12_AMD64}" echo "Scanning Debian 12 AMD64 packages for deb12 component" - dpkg-scanpackages --arch amd64 pool/deb12/ > "${DEB_DISTS_DEB12_AMD64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/deb12/ > "${DEB_DISTS_DEB12_AMD64}/Packages" gzip -k -f "${DEB_DISTS_DEB12_AMD64}/Packages" # ARM64 packages mkdir -p "${DEB_DISTS_DEB12_ARM64}" echo "Scanning Debian 12 ARM64 packages for deb12 component" - dpkg-scanpackages --arch arm64 pool/deb12/ > "${DEB_DISTS_DEB12_ARM64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/deb12/ > "${DEB_DISTS_DEB12_ARM64}/Packages" gzip -k -f "${DEB_DISTS_DEB12_ARM64}/Packages" fi # Create deb13 component (Debian 13 Trixie) - if [ -d "pool/deb13" ] && [ "$(ls -A pool/deb13/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/deb13" ] && [ "$(ls -A ${DEB_POOL_ROOT}/deb13/*.deb 2>/dev/null)" ]; then # AMD64 packages mkdir -p "${DEB_DISTS_DEB13_AMD64}" echo "Scanning Debian 13 AMD64 packages for deb13 component" - dpkg-scanpackages --arch amd64 pool/deb13/ > "${DEB_DISTS_DEB13_AMD64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/deb13/ > "${DEB_DISTS_DEB13_AMD64}/Packages" gzip -k -f "${DEB_DISTS_DEB13_AMD64}/Packages" # ARM64 packages mkdir -p "${DEB_DISTS_DEB13_ARM64}" echo "Scanning Debian 13 ARM64 packages for deb13 component" - dpkg-scanpackages --arch arm64 pool/deb13/ > "${DEB_DISTS_DEB13_ARM64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/deb13/ > "${DEB_DISTS_DEB13_ARM64}/Packages" gzip -k -f "${DEB_DISTS_DEB13_ARM64}/Packages" fi # Create ubuntu22 component (Ubuntu 22.04 Jammy) - if [ -d "pool/ubuntu22" ] && [ "$(ls -A pool/ubuntu22/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/ubuntu22" ] && [ "$(ls -A ${DEB_POOL_ROOT}/ubuntu22/*.deb 2>/dev/null)" ]; then # AMD64 packages mkdir -p "${DEB_DISTS_UBUNTU22_AMD64}" echo "Scanning Ubuntu 22.04 AMD64 packages for ubuntu22 component" - dpkg-scanpackages --arch amd64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_AMD64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/ubuntu22/ > "${DEB_DISTS_UBUNTU22_AMD64}/Packages" gzip -k -f "${DEB_DISTS_UBUNTU22_AMD64}/Packages" # ARM64 packages mkdir -p "${DEB_DISTS_UBUNTU22_ARM64}" echo "Scanning Ubuntu 22.04 ARM64 packages for ubuntu22 component" - dpkg-scanpackages --arch arm64 pool/ubuntu22/ > "${DEB_DISTS_UBUNTU22_ARM64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/ubuntu22/ > "${DEB_DISTS_UBUNTU22_ARM64}/Packages" gzip -k -f "${DEB_DISTS_UBUNTU22_ARM64}/Packages" fi # Create ubuntu24 component (Ubuntu 24.04 Noble) - if [ -d "pool/ubuntu24" ] && [ "$(ls -A pool/ubuntu24/*.deb 2>/dev/null)" ]; then + if [ -d "${DEB_POOL_ROOT}/ubuntu24" ] && [ "$(ls -A ${DEB_POOL_ROOT}/ubuntu24/*.deb 2>/dev/null)" ]; then # AMD64 packages mkdir -p "${DEB_DISTS_UBUNTU24_AMD64}" echo "Scanning Ubuntu 24.04 AMD64 packages for ubuntu24 component" - dpkg-scanpackages --arch amd64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_AMD64}/Packages" + dpkg-scanpackages --arch amd64 ${DEB_POOL_ROOT}/ubuntu24/ > "${DEB_DISTS_UBUNTU24_AMD64}/Packages" gzip -k -f "${DEB_DISTS_UBUNTU24_AMD64}/Packages" # ARM64 packages mkdir -p "${DEB_DISTS_UBUNTU24_ARM64}" echo "Scanning Ubuntu 24.04 ARM64 packages for ubuntu24 component" - dpkg-scanpackages --arch arm64 pool/ubuntu24/ > "${DEB_DISTS_UBUNTU24_ARM64}/Packages" + dpkg-scanpackages --arch arm64 ${DEB_POOL_ROOT}/ubuntu24/ > "${DEB_DISTS_UBUNTU24_ARM64}/Packages" gzip -k -f "${DEB_DISTS_UBUNTU24_ARM64}/Packages" fi @@ -523,13 +541,13 @@ if [ "$GOT_RPM" = "1" ]; then # Adjust RPM pool paths if we're in the wrong directory after APT processing if [[ "$PWD" == */out/deb ]]; then - RHEL8_POOL="../rpm/rhel8" - RHEL9_POOL="../rpm/rhel9" - MAIN_POOL="../rpm/main" + RHEL8_POOL="../rpm${CHANNEL_PATH}/rhel8" + RHEL9_POOL="../rpm${CHANNEL_PATH}/rhel9" + MAIN_POOL="../rpm${CHANNEL_PATH}/main" else RHEL8_POOL="$RPM_POOL_RHEL8" RHEL9_POOL="$RPM_POOL_RHEL9" - MAIN_POOL="out/rpm/main" + MAIN_POOL="out/rpm${CHANNEL_PATH}/main" fi for POOL in "$RHEL8_POOL" "$RHEL9_POOL"; do @@ -583,7 +601,7 @@ fi echo "Package repository setup complete!" echo "" echo "Repository URLs:" -echo " APT: https://documentdb.io/deb stable ubuntu24" -echo " YUM: https://documentdb.io/rpm/rhel9" +echo " APT: https://documentdb.io/deb ${SUITE} ubuntu24" +echo " YUM: https://documentdb.io/rpm${CHANNEL_PATH}/rhel9" echo " Retired URLs retain empty metadata for package-manager compatibility." echo " Browse: https://documentdb.io/packages/" diff --git a/.github/scripts/smoke_test_package_repository.sh b/.github/scripts/smoke_test_package_repository.sh index 2dc6cbc8..cb357e1f 100644 --- a/.github/scripts/smoke_test_package_repository.sh +++ b/.github/scripts/smoke_test_package_repository.sh @@ -6,14 +6,27 @@ PORT="${PACKAGE_REPOSITORY_PORT:-8099}" NETWORK="documentdb-package-test-$$" SERVER_NAME="documentdb-package-repo-$$" -if ! ls out/deb/pool/ubuntu24/documentdb_*_all.deb >/dev/null 2>&1; then - echo "::error::out/deb/pool/ubuntu24 has no documentdb meta package." - exit 1 -fi -if ! ls out/rpm/rhel9/documentdb-*.noarch.rpm >/dev/null 2>&1; then - echo "::error::out/rpm/rhel9 has no documentdb meta package." - exit 1 -fi +for pool in out/deb/pool/ubuntu24 out/deb/pool/latest/ubuntu24; do + if ! ls "$pool"/documentdb_*_all.deb >/dev/null 2>&1; then + echo "::error::$pool has no documentdb meta package." + exit 1 + fi +done +for pool in out/rpm/rhel9 out/rpm/latest/rhel9; do + if ! ls "$pool"/documentdb-*.noarch.rpm >/dev/null 2>&1; then + echo "::error::$pool has no documentdb meta package." + exit 1 + fi +done + +# Each channel must offer exactly the release its own feed names. +meta_version() { + python3 -c 'import json, re, sys; print(next(m[1] for a in json.load(open(sys.argv[1]))["assets"] if (m := re.fullmatch(r"ubuntu24\.04-documentdb_([^_]+)_all\.deb", a["name"]))))' "$1" +} +STABLE_VERSION=$(meta_version out/packages/release-info.json) +LATEST_VERSION=$(meta_version out/packages/release-info-latest.json) +CHANNELS="stable=${STABLE_VERSION} latest=${LATEST_VERSION}" +echo "Expecting $CHANNELS" cleanup() { docker rm -f "$SERVER_NAME" >/dev/null 2>&1 || true @@ -40,12 +53,17 @@ docker exec "$SERVER_NAME" \ wget -q -O /dev/null "http://127.0.0.1:${PORT}/rpm/rhel8/repodata/repomd.xml" docker exec "$SERVER_NAME" \ wget -q -O /dev/null "http://127.0.0.1:${PORT}/rpm/main/repodata/repomd.xml" +docker exec "$SERVER_NAME" \ + wget -q -O /dev/null "http://127.0.0.1:${PORT}/deb/dists/latest/Release" +docker exec "$SERVER_NAME" \ + wget -q -O /dev/null "http://127.0.0.1:${PORT}/rpm/latest/rhel9/repodata/repomd.xml" echo "::group::APT dependency resolution" docker run --rm --network "$NETWORK" \ -e DOCUMENTDB_REPOSITORY_HOST="$SERVER_NAME" \ -e DOCUMENTDB_REPOSITORY_PORT="$PORT" \ -e DOCUMENTDB_REPOSITORY_SIGNED="$SIGN" \ + -e DOCUMENTDB_CHANNELS="$CHANNELS" \ ubuntu:24.04 bash -c ' set -euo pipefail export DEBIAN_FRONTEND=noninteractive @@ -59,28 +77,41 @@ docker run --rm --network "$NETWORK" \ if [ "$DOCUMENTDB_REPOSITORY_SIGNED" = true ]; then curl -fsSL "http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/documentdb-archive-keyring.gpg" \ | gpg --dearmor -o /usr/share/keyrings/documentdb.gpg - echo "deb [signed-by=/usr/share/keyrings/documentdb.gpg] http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/deb stable ubuntu24" \ - > /etc/apt/sources.list.d/documentdb.list - else - echo "deb [trusted=yes] http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/deb stable ubuntu24" \ - > /etc/apt/sources.list.d/documentdb.list fi - apt-get update -qq - for major in 17 18; do - apt-get install -s "documentdb-${major}" > "/tmp/apt-${major}.txt" - for pkg in "documentdb-${major}" documentdb-common documentdb-gateway documentdb-postgresql-tools; do - grep -q "Inst ${pkg} " "/tmp/apt-${major}.txt" || { - echo "APT PG${major} plan is missing ${pkg}" + for channel in $DOCUMENTDB_CHANNELS; do + suite=${channel%%=*} + version=${channel#*=} + if [ "$DOCUMENTDB_REPOSITORY_SIGNED" = true ]; then + echo "deb [signed-by=/usr/share/keyrings/documentdb.gpg] http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/deb ${suite} ubuntu24" \ + > /etc/apt/sources.list.d/documentdb.list + else + echo "deb [trusted=yes] http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/deb ${suite} ubuntu24" \ + > /etc/apt/sources.list.d/documentdb.list + fi + + apt-get update -qq + offered=$(apt-cache madison documentdb-18 | cut -d"|" -f2 | tr -d " " | sort -u | paste -sd" ") + if [ "$offered" != "$version" ]; then + echo "APT ${suite} offers documentdb-18 \"${offered}\"; expected only ${version}" + exit 1 + fi + for major in 17 18; do + apt-get install -s "documentdb-${major}" > "/tmp/apt-${major}.txt" + for pkg in "documentdb-${major}" documentdb-common documentdb-gateway documentdb-postgresql-tools; do + grep -q "Inst ${pkg} " "/tmp/apt-${major}.txt" || { + echo "APT ${suite} PG${major} plan is missing ${pkg}" + cat "/tmp/apt-${major}.txt" + exit 1 + } + done + grep -q "Inst postgresql-${major}-documentdb " "/tmp/apt-${major}.txt" || { + echo "APT ${suite} PG${major} plan is missing its extension package" cat "/tmp/apt-${major}.txt" exit 1 } done - grep -q "Inst postgresql-${major}-documentdb " "/tmp/apt-${major}.txt" || { - echo "APT PG${major} plan is missing its extension package" - cat "/tmp/apt-${major}.txt" - exit 1 - } + echo "APT ${suite} offers documentdb-18 ${offered}" done if [ "$DOCUMENTDB_REPOSITORY_SIGNED" = true ]; then @@ -100,6 +131,7 @@ docker run --rm --network "$NETWORK" \ -e DOCUMENTDB_REPOSITORY_HOST="$SERVER_NAME" \ -e DOCUMENTDB_REPOSITORY_PORT="$PORT" \ -e DOCUMENTDB_REPOSITORY_SIGNED="$SIGN" \ + -e DOCUMENTDB_CHANNELS="$CHANNELS" \ rockylinux/rockylinux:9 bash -c ' set -euo pipefail dnf install -y -q dnf-plugins-core >/dev/null 2>&1 @@ -108,33 +140,46 @@ docker run --rm --network "$NETWORK" \ dnf config-manager --set-enabled crb dnf -qy module disable postgresql >/dev/null 2>&1 - { - echo "[documentdb]" - echo "name=DocumentDB" - echo "baseurl=http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/rpm/rhel9" - echo "enabled=1" - if [ "$DOCUMENTDB_REPOSITORY_SIGNED" = true ]; then - echo "gpgcheck=1" - echo "gpgkey=http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/documentdb-archive-keyring.gpg" - else - echo "gpgcheck=0" - fi - } > /etc/yum.repos.d/documentdb.repo + for channel in $DOCUMENTDB_CHANNELS; do + name=${channel%%=*} + version=${channel#*=} + path=rpm/rhel9 + [ "$name" = stable ] || path="rpm/${name}/rhel9" + # A repo id per channel keeps dnf from reusing the previous channel metadata. + { + echo "[documentdb-${name}]" + echo "name=DocumentDB" + echo "baseurl=http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/${path}" + echo "enabled=1" + if [ "$DOCUMENTDB_REPOSITORY_SIGNED" = true ]; then + echo "gpgcheck=1" + echo "gpgkey=http://${DOCUMENTDB_REPOSITORY_HOST}:${DOCUMENTDB_REPOSITORY_PORT}/documentdb-archive-keyring.gpg" + else + echo "gpgcheck=0" + fi + } > /etc/yum.repos.d/documentdb.repo - for major in 17 18; do - dnf install --assumeno "documentdb-${major}" > "/tmp/dnf-${major}.txt" 2>&1 || true - if grep -qE "^Error|nothing provides|Problem:" "/tmp/dnf-${major}.txt"; then - echo "DNF could not resolve documentdb-${major}:" - cat "/tmp/dnf-${major}.txt" + offered=$(dnf -q repoquery --qf "%{version}" documentdb-18 | sort -u | paste -sd" ") + if [ "$offered" != "$version" ]; then + echo "DNF ${path} offers documentdb-18 \"${offered}\"; expected only ${version}" exit 1 fi - for pkg in "documentdb-${major}" documentdb-common documentdb-gateway documentdb-postgresql-tools "postgresql${major}-documentdb"; do - grep -q "$pkg" "/tmp/dnf-${major}.txt" || { - echo "DNF PG${major} plan is missing ${pkg}" + for major in 17 18; do + dnf install --assumeno "documentdb-${major}" > "/tmp/dnf-${major}.txt" 2>&1 || true + if grep -qE "^Error|nothing provides|Problem:" "/tmp/dnf-${major}.txt"; then + echo "DNF ${path} could not resolve documentdb-${major}:" cat "/tmp/dnf-${major}.txt" exit 1 - } + fi + for pkg in "documentdb-${major}" documentdb-common documentdb-gateway documentdb-postgresql-tools "postgresql${major}-documentdb"; do + grep -q "$pkg" "/tmp/dnf-${major}.txt" || { + echo "DNF ${path} PG${major} plan is missing ${pkg}" + cat "/tmp/dnf-${major}.txt" + exit 1 + } + done done + echo "DNF ${path} offers documentdb-18 ${offered}" done { diff --git a/.github/scripts/verify_package_inventory.py b/.github/scripts/verify_package_inventory.py index b9ad1efb..02c70de7 100644 --- a/.github/scripts/verify_package_inventory.py +++ b/.github/scripts/verify_package_inventory.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Verify that the published pools contain only the selected release assets.""" +"""Verify that each channel's pools contain only that channel's release assets.""" import json import re @@ -7,7 +7,12 @@ ROOT = Path("out") -RELEASE_INFO = ROOT / "packages" / "release-info.json" +# Channel -> (its release feed, its directory below deb/pool, deb/dists and rpm); stable keeps the original paths. +CHANNELS = { + "stable": (ROOT / "packages" / "release-info.json", ""), + "latest": (ROOT / "packages" / "release-info-latest.json", "latest"), +} +NESTED_CHANNELS = {subdir for _, subdir in CHANNELS.values() if subdir} DEB_PREFIXES = { "deb11-": "deb11", @@ -32,154 +37,167 @@ def fail(message: str) -> None: raise SystemExit(message) -if not RELEASE_INFO.exists(): - fail(f"Missing {RELEASE_INFO}") - -release = json.loads(RELEASE_INFO.read_text()) -asset_names = { - asset["name"] - for asset in release.get("assets", []) - if isinstance(asset, dict) and isinstance(asset.get("name"), str) -} -package_assets = { - name - for name in asset_names - if (name.endswith(".deb") and "dbgsym" not in name) - or ( - name.endswith(".rpm") - and "debuginfo" not in name - and "debugsource" not in name - ) -} - -downloaded = { - path.name - for path in (ROOT / "packages").iterdir() - if path.suffix in {".deb", ".rpm"} -} -if downloaded != package_assets: - fail( - "Direct package mirror does not match release assets.\n" - f"Missing: {sorted(package_assets - downloaded)}\n" - f"Unexpected: {sorted(downloaded - package_assets)}" - ) - -expected_deb: dict[str, set[str]] = {} -for name in sorted(package_assets): - if not name.endswith(".deb"): - continue - match = next( - ((prefix, component) for prefix, component in DEB_PREFIXES.items() if name.startswith(prefix)), - None, - ) - if match is None: - fail(f"Unrecognized DEB release asset: {name}") - prefix, component = match - expected_deb.setdefault(component, set()).add(name.removeprefix(prefix)) - -deb_pool_root = ROOT / "deb" / "pool" -actual_deb_components = { - path.name for path in deb_pool_root.iterdir() if path.is_dir() -} if deb_pool_root.exists() else set() -if actual_deb_components != set(expected_deb): - fail( - "APT components do not match the selected release.\n" - f"Expected: {sorted(expected_deb)}\n" - f"Actual: {sorted(actual_deb_components)}" - ) - -for component, expected in expected_deb.items(): - actual = {path.name for path in (deb_pool_root / component).glob("*.deb")} - if actual != expected: +def verify(channel: str, release_info: Path, subdir: str) -> None: + # The latest channel nests below stable's directories, so stable must not count it as its own. + ignored = set() if subdir else NESTED_CHANNELS + + if not release_info.exists(): + fail(f"Missing {release_info}") + + release = json.loads(release_info.read_text()) + asset_names = { + asset["name"] + for asset in release.get("assets", []) + if isinstance(asset, dict) and isinstance(asset.get("name"), str) + } + package_assets = { + name + for name in asset_names + if (name.endswith(".deb") and "dbgsym" not in name) + or ( + name.endswith(".rpm") + and "debuginfo" not in name + and "debugsource" not in name + ) + } + + # Only stable keeps a direct-download mirror. + if not subdir: + downloaded = { + path.name + for path in (ROOT / "packages").iterdir() + if path.suffix in {".deb", ".rpm"} + } + if downloaded != package_assets: + fail( + "Direct package mirror does not match release assets.\n" + f"Missing: {sorted(package_assets - downloaded)}\n" + f"Unexpected: {sorted(downloaded - package_assets)}" + ) + + expected_deb: dict[str, set[str]] = {} + for name in sorted(package_assets): + if not name.endswith(".deb"): + continue + match = next( + ((prefix, component) for prefix, component in DEB_PREFIXES.items() if name.startswith(prefix)), + None, + ) + if match is None: + fail(f"Unrecognized DEB release asset: {name}") + prefix, component = match + expected_deb.setdefault(component, set()).add(name.removeprefix(prefix)) + + deb_pool_root = ROOT / "deb" / "pool" / subdir + actual_deb_components = { + path.name for path in deb_pool_root.iterdir() if path.is_dir() + } - ignored if deb_pool_root.exists() else set() + if actual_deb_components != set(expected_deb): fail( - f"APT pool {component} does not match the selected release.\n" - f"Missing: {sorted(expected - actual)}\n" - f"Unexpected: {sorted(actual - expected)}" + "APT components do not match the selected release.\n" + f"Expected: {sorted(expected_deb)}\n" + f"Actual: {sorted(actual_deb_components)}" ) -release_file = ROOT / "deb" / "dists" / "stable" / "Release" -if expected_deb: - if not release_file.exists(): - fail(f"Missing {release_file}") - match = re.search(r"^Components:\s*(.+)$", release_file.read_text(), re.MULTILINE) - components = set(match.group(1).split()) if match else set() - if components != APT_METADATA_COMPONENTS: + for component, expected in expected_deb.items(): + actual = {path.name for path in (deb_pool_root / component).glob("*.deb")} + if actual != expected: + fail( + f"APT pool {component} does not match the selected release.\n" + f"Missing: {sorted(expected - actual)}\n" + f"Unexpected: {sorted(actual - expected)}" + ) + + release_file = ROOT / "deb" / "dists" / channel / "Release" + if expected_deb: + if not release_file.exists(): + fail(f"Missing {release_file}") + match = re.search(r"^Components:\s*(.+)$", release_file.read_text(), re.MULTILINE) + components = set(match.group(1).split()) if match else set() + if components != APT_METADATA_COMPONENTS: + fail( + "APT Release components do not include the compatibility metadata set.\n" + f"Expected: {sorted(APT_METADATA_COMPONENTS)}\n" + f"Actual: {sorted(components)}" + ) + + for component in APT_METADATA_COMPONENTS: + source_component = "ubuntu22" if component == "main" else component + expected_packages = expected_deb.get(source_component, set()) + + for arch in ("amd64", "arm64"): + packages = ROOT / "deb" / "dists" / channel / component / f"binary-{arch}" / "Packages" + packages_gz = packages.with_name("Packages.gz") + if not packages.exists() or not packages_gz.exists(): + fail(f"Missing APT metadata for {component}/{arch}") + + # Full paths, so an index that points into the other channel's pool fails too. + listed = set(re.findall(r"^Filename:\s+(\S+\.deb)$", packages.read_text(), re.MULTILINE)) + expected_for_arch = { + deb_pool_root.relative_to(ROOT / "deb").joinpath(source_component, name).as_posix() + for name in expected_packages + if name.endswith(f"_{arch}.deb") or name.endswith("_all.deb") + } + if listed != expected_for_arch: + fail( + f"APT metadata {component}/{arch} does not match the selected release.\n" + f"Expected: {sorted(expected_for_arch)}\n" + f"Actual: {sorted(listed)}" + ) + + rpm_assets = {name for name in package_assets if name.endswith(".rpm")} + explicit_rpm_pools = {pool for name in rpm_assets if (pool := rpm_pool(name))} + expected_rpm: dict[str, set[str]] = {pool: set() for pool in explicit_rpm_pools} + + for name in rpm_assets: + pool = rpm_pool(name) + if pool: + expected_rpm[pool].add(re.sub(r"^rhel[89]-", "", name)) + elif name.endswith(".noarch.rpm"): + for target in explicit_rpm_pools: + expected_rpm[target].add(name) + else: + fail(f"Unrecognized RPM release asset: {name}") + + rpm_root = ROOT / "rpm" / subdir + actual_rpm_pools = { + path.name + for path in rpm_root.iterdir() + if path.is_dir() + } - ignored if rpm_root.exists() else set() + if actual_rpm_pools != RPM_METADATA_POOLS: fail( - "APT Release components do not include the compatibility metadata set.\n" - f"Expected: {sorted(APT_METADATA_COMPONENTS)}\n" - f"Actual: {sorted(components)}" + "RPM repositories do not include the compatibility metadata set.\n" + f"Expected: {sorted(RPM_METADATA_POOLS)}\n" + f"Actual: {sorted(actual_rpm_pools)}" ) - for component in APT_METADATA_COMPONENTS: - expected_packages = expected_deb.get(component, set()) - if component == "main": - expected_packages = expected_deb.get("ubuntu22", set()) - - for arch in ("amd64", "arm64"): - packages = ROOT / "deb" / "dists" / "stable" / component / f"binary-{arch}" / "Packages" - packages_gz = packages.with_name("Packages.gz") - if not packages.exists() or not packages_gz.exists(): - fail(f"Missing APT metadata for {component}/{arch}") - - listed = set(re.findall(r"^Filename:\s+.*/([^/\s]+\.deb)$", packages.read_text(), re.MULTILINE)) - expected_for_arch = { - name - for name in expected_packages - if name.endswith(f"_{arch}.deb") or name.endswith("_all.deb") - } - if listed != expected_for_arch: - fail( - f"APT metadata {component}/{arch} does not match the selected release.\n" - f"Expected: {sorted(expected_for_arch)}\n" - f"Actual: {sorted(listed)}" - ) - -rpm_assets = {name for name in package_assets if name.endswith(".rpm")} -explicit_rpm_pools = {pool for name in rpm_assets if (pool := rpm_pool(name))} -expected_rpm: dict[str, set[str]] = {pool: set() for pool in explicit_rpm_pools} - -for name in rpm_assets: - pool = rpm_pool(name) - if pool: - expected_rpm[pool].add(re.sub(r"^rhel[89]-", "", name)) - elif name.endswith(".noarch.rpm"): - for target in explicit_rpm_pools: - expected_rpm[target].add(name) - else: - fail(f"Unrecognized RPM release asset: {name}") - -rpm_root = ROOT / "rpm" -actual_rpm_pools = { - path.name - for path in rpm_root.iterdir() - if path.is_dir() -} if rpm_root.exists() else set() -if actual_rpm_pools != RPM_METADATA_POOLS: - fail( - "RPM repositories do not include the compatibility metadata set.\n" - f"Expected: {sorted(RPM_METADATA_POOLS)}\n" - f"Actual: {sorted(actual_rpm_pools)}" + for pool in RPM_POOLS: + expected = expected_rpm.get(pool, set()) + actual = {path.name for path in (rpm_root / pool).glob("*.rpm")} + if actual != expected: + fail( + f"RPM pool {pool} does not match the selected release.\n" + f"Missing: {sorted(expected - actual)}\n" + f"Unexpected: {sorted(actual - expected)}" + ) + if not (rpm_root / pool / "repodata" / "repomd.xml").exists(): + fail(f"Missing RPM metadata for {pool}") + + actual_main = {path.name for path in (rpm_root / "main").glob("*.rpm")} + if actual_main != expected_rpm.get("rhel8", set()): + fail("Legacy RPM main pool does not match the selected release's RHEL 8 pool.") + if not (rpm_root / "main" / "repodata" / "repomd.xml").exists(): + fail("Missing RPM metadata for main") + + print( + f"{channel}: package pools exactly match {release.get('tag_name', 'the selected release')}: " + f"{len(package_assets)} release assets." ) -for pool in RPM_POOLS: - expected = expected_rpm.get(pool, set()) - actual = {path.name for path in (rpm_root / pool).glob("*.rpm")} - if actual != expected: - fail( - f"RPM pool {pool} does not match the selected release.\n" - f"Missing: {sorted(expected - actual)}\n" - f"Unexpected: {sorted(actual - expected)}" - ) - if not (rpm_root / pool / "repodata" / "repomd.xml").exists(): - fail(f"Missing RPM metadata for {pool}") - -actual_main = {path.name for path in (rpm_root / "main").glob("*.rpm")} -if actual_main != expected_rpm.get("rhel8", set()): - fail("Legacy RPM main pool does not match the selected release's RHEL 8 pool.") -if not (rpm_root / "main" / "repodata" / "repomd.xml").exists(): - fail("Missing RPM metadata for main") - -print( - f"Package pools exactly match {release.get('tag_name', 'the selected release')}: " - f"{len(package_assets)} release assets." -) + +for name, (release_info, subdir) in CHANNELS.items(): + try: + verify(name, release_info, subdir) + except SystemExit as error: + raise SystemExit(f"{name} channel: {error}") from None diff --git a/.github/scripts/verify_package_signatures.sh b/.github/scripts/verify_package_signatures.sh index 196cda76..3d1b9e68 100644 --- a/.github/scripts/verify_package_signatures.sh +++ b/.github/scripts/verify_package_signatures.sh @@ -9,7 +9,9 @@ fi for artifact in \ out/documentdb-archive-keyring.gpg \ out/deb/dists/stable/InRelease \ - out/deb/dists/stable/Release.gpg; do + out/deb/dists/stable/Release.gpg \ + out/deb/dists/latest/InRelease \ + out/deb/dists/latest/Release.gpg; do if [ ! -s "$artifact" ]; then echo "::error::Signing is enabled but $artifact is missing or empty." exit 1 @@ -22,10 +24,12 @@ export GNUPGHOME trap 'rm -rf "$GNUPGHOME" "$RPM_DB"' EXIT gpg --batch --import out/documentdb-archive-keyring.gpg -gpg --batch --verify out/deb/dists/stable/InRelease -gpg --batch --verify \ - out/deb/dists/stable/Release.gpg \ - out/deb/dists/stable/Release +for suite in stable latest; do + gpg --batch --verify "out/deb/dists/$suite/InRelease" + gpg --batch --verify \ + "out/deb/dists/$suite/Release.gpg" \ + "out/deb/dists/$suite/Release" +done rpm --dbpath "$RPM_DB" --initdb rpm --dbpath "$RPM_DB" --import out/documentdb-archive-keyring.gpg @@ -34,7 +38,7 @@ verified_rpms=0 while IFS= read -r rpm_file; do rpmkeys --dbpath "$RPM_DB" --checksig --verbose "$rpm_file" verified_rpms=$((verified_rpms + 1)) -done < <(find out/rpm/rhel8 out/rpm/rhel9 -type f -name '*.rpm' | sort) +done < <(find out/rpm/rhel8 out/rpm/rhel9 out/rpm/latest/rhel8 out/rpm/latest/rhel9 -type f -name '*.rpm' | sort) if [ "$verified_rpms" -eq 0 ]; then echo "::error::Signing is enabled but no RPM packages were found to verify." @@ -50,4 +54,4 @@ while IFS= read -r repomd; do gpg --batch --verify "$signature" "$repomd" done < <(find out/rpm -path '*/repodata/repomd.xml' -type f | sort) -echo "Verified APT metadata, $verified_rpms RPM packages, and all RPM repository metadata." +echo "Verified stable and latest APT metadata, $verified_rpms RPM packages, and all RPM repository metadata." diff --git a/.github/workflows/continuous-deployment.yml b/.github/workflows/continuous-deployment.yml index 43d6a017..5c98d970 100644 --- a/.github/workflows/continuous-deployment.yml +++ b/.github/workflows/continuous-deployment.yml @@ -104,8 +104,9 @@ jobs: KEY_ID: ${{ steps.import_gpg.outputs.keyid }} KEY_NAME: ${{ steps.import_gpg.outputs.name }} KEY_EMAIL: ${{ steps.import_gpg.outputs.email }} - # Configure which DocumentDB release to mirror. + # Configure which DocumentDB release each channel mirrors. DOCUMENTDB_VERSION: ${{ vars.DOCUMENTDB_VERSION || 'latest' }} + DOCUMENTDB_LATEST_VERSION: ${{ vars.DOCUMENTDB_LATEST_VERSION || 'latest' }} run: | set -euo pipefail if [ "$SIGN" = 'true' ]; then @@ -123,6 +124,7 @@ jobs: echo "To enable signing, add GPG_PRIVATE_KEY to the repository secrets." fi echo "DOCUMENTDB_VERSION=$DOCUMENTDB_VERSION" >> "$GITHUB_ENV" + echo "DOCUMENTDB_LATEST_VERSION=$DOCUMENTDB_LATEST_VERSION" >> "$GITHUB_ENV" - name: Setup Node.js uses: actions/setup-node@v7 with: @@ -176,9 +178,12 @@ jobs: echo "Only $reference_count reference pages exported - documentation content looks incomplete." exit 1 fi - - name: Download DocumentDB packages from latest release + - name: Download DocumentDB packages for the stable and latest channels if: steps.features.outputs.packages == 'true' - run: .github/scripts/download_packages.sh + run: | + set -euo pipefail + .github/scripts/download_packages.sh + SUITE=latest DOCUMENTDB_VERSION="$DOCUMENTDB_LATEST_VERSION" .github/scripts/download_packages.sh - name: Verify generated package components if: steps.features.outputs.packages == 'true' env: @@ -275,14 +280,18 @@ jobs: # The pool is only meaningful if the meta package is actually in it. # Fail loudly rather than "passing" a repository that has nothing to # resolve. - if ! ls out/deb/pool/ubuntu24/documentdb_*_all.deb >/dev/null 2>&1; then - echo "::error::out/deb/pool/ubuntu24 has no documentdb meta package - the APT pool is incomplete" - exit 1 - fi - if ! ls out/rpm/rhel9/documentdb-*.noarch.rpm >/dev/null 2>&1; then - echo "::error::out/rpm/rhel9 has no documentdb meta package - the RPM pool is incomplete" - exit 1 - fi + for pool in out/deb/pool/ubuntu24 out/deb/pool/latest/ubuntu24; do + if ! ls "$pool"/documentdb_*_all.deb >/dev/null 2>&1; then + echo "::error::$pool has no documentdb meta package - the APT pool is incomplete" + exit 1 + fi + done + for pool in out/rpm/rhel9 out/rpm/latest/rhel9; do + if ! ls "$pool"/documentdb-*.noarch.rpm >/dev/null 2>&1; then + echo "::error::$pool has no documentdb meta package - the RPM pool is incomplete" + exit 1 + fi + done python3 -m http.server 8099 --directory out >/tmp/repo-http.log 2>&1 & HTTP_PID=$! @@ -292,7 +301,7 @@ jobs: sleep 1 done - echo "::group::APT resolution (ubuntu24 component)" + echo "::group::APT resolution (ubuntu24 component, stable and latest suites)" # --network host so the container reaches the runner's http.server. # [trusted=yes] because this local mirror is unsigned when the # deployment runs without a signing key; signature verification is @@ -308,23 +317,25 @@ jobs: | gpg --dearmor -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] https://apt.postgresql.org/pub/repos/apt noble-pgdg main" \ > /etc/apt/sources.list.d/pgdg.list - echo "deb [trusted=yes] http://127.0.0.1:8099/deb stable ubuntu24" \ - > /etc/apt/sources.list.d/documentdb.list - apt-get update -qq - # -s solves the dependency graph and exits non-zero if it cannot. - apt-get install -s documentdb > /tmp/sim.txt - # Resolving is necessary but not sufficient: assert the transaction - # actually pulls the stack, so a meta package that degenerated into - # an empty shell cannot pass. - for pkg in documentdb documentdb-common documentdb-gateway documentdb-postgresql-tools; do - grep -q "Inst $pkg " /tmp/sim.txt || { echo "APT plan is missing $pkg"; cat /tmp/sim.txt; exit 1; } + for suite in stable latest; do + echo "deb [trusted=yes] http://127.0.0.1:8099/deb $suite ubuntu24" \ + > /etc/apt/sources.list.d/documentdb.list + apt-get update -qq + # -s solves the dependency graph and exits non-zero if it cannot. + apt-get install -s documentdb > /tmp/sim.txt + # Resolving is necessary but not sufficient: assert the transaction + # actually pulls the stack, so a meta package that degenerated into + # an empty shell cannot pass. + for pkg in documentdb documentdb-common documentdb-gateway documentdb-postgresql-tools; do + grep -q "Inst $pkg " /tmp/sim.txt || { echo "APT $suite plan is missing $pkg"; cat /tmp/sim.txt; exit 1; } + done + grep -qE "Inst postgresql-1[78]-documentdb " /tmp/sim.txt || { echo "APT $suite plan pulls no extension package"; exit 1; } + echo "APT $suite OK: $(grep -c "^Inst " /tmp/sim.txt) packages in the plan" done - grep -qE "Inst postgresql-1[78]-documentdb " /tmp/sim.txt || { echo "APT plan pulls no extension package"; exit 1; } - echo "APT OK: $(grep -c "^Inst " /tmp/sim.txt) packages in the plan" ' echo "::endgroup::" - echo "::group::DNF resolution (rhel9 pool)" + echo "::group::DNF resolution (rhel9 pool, stable and latest)" docker run --rm --network host -e SIGN="$SIGN" rockylinux/rockylinux:9 bash -c ' set -e dnf install -y -q dnf-plugins-core >/dev/null 2>&1 @@ -332,28 +343,32 @@ jobs: dnf install -y -q epel-release >/dev/null 2>&1 dnf config-manager --set-enabled crb dnf -qy module disable postgresql >/dev/null 2>&1 - if [ "$SIGN" = true ]; then - printf "%s\n" "[documentdb]" "name=DocumentDB" \ - "baseurl=http://127.0.0.1:8099/rpm/rhel9" "enabled=1" \ - "gpgcheck=1" \ - "gpgkey=http://127.0.0.1:8099/documentdb-archive-keyring.gpg" \ - > /etc/yum.repos.d/documentdb.repo - else - printf "%s\n" "[documentdb]" "name=DocumentDB" \ - "baseurl=http://127.0.0.1:8099/rpm/rhel9" "enabled=1" "gpgcheck=0" \ - > /etc/yum.repos.d/documentdb.repo - fi - # --assumeno always exits non-zero (the answer is "no"), so judge the - # transaction it printed rather than the exit code. - dnf install --assumeno documentdb > /tmp/sim.txt 2>&1 || true - if grep -qE "^Error|nothing provides|Problem:" /tmp/sim.txt; then - echo "DNF could not resolve documentdb:"; cat /tmp/sim.txt; exit 1 - fi - for pkg in documentdb-common documentdb-gateway documentdb-postgresql-tools; do - grep -q "$pkg" /tmp/sim.txt || { echo "DNF plan is missing $pkg"; cat /tmp/sim.txt; exit 1; } + for path in rpm/rhel9 rpm/latest/rhel9; do + # A repo id per channel keeps dnf from reusing the previous channel metadata. + repo="documentdb-$(echo "$path" | tr / -)" + if [ "$SIGN" = true ]; then + printf "%s\n" "[$repo]" "name=DocumentDB" \ + "baseurl=http://127.0.0.1:8099/$path" "enabled=1" \ + "gpgcheck=1" \ + "gpgkey=http://127.0.0.1:8099/documentdb-archive-keyring.gpg" \ + > /etc/yum.repos.d/documentdb.repo + else + printf "%s\n" "[$repo]" "name=DocumentDB" \ + "baseurl=http://127.0.0.1:8099/$path" "enabled=1" "gpgcheck=0" \ + > /etc/yum.repos.d/documentdb.repo + fi + # --assumeno always exits non-zero (the answer is "no"), so judge the + # transaction it printed rather than the exit code. + dnf install --assumeno documentdb > /tmp/sim.txt 2>&1 || true + if grep -qE "^Error|nothing provides|Problem:" /tmp/sim.txt; then + echo "DNF $path could not resolve documentdb:"; cat /tmp/sim.txt; exit 1 + fi + for pkg in documentdb-common documentdb-gateway documentdb-postgresql-tools; do + grep -q "$pkg" /tmp/sim.txt || { echo "DNF $path plan is missing $pkg"; cat /tmp/sim.txt; exit 1; } + done + grep -qE "postgresql1[78]-documentdb" /tmp/sim.txt || { echo "DNF $path plan pulls no extension package"; exit 1; } + echo "DNF $path OK" done - grep -qE "postgresql1[78]-documentdb" /tmp/sim.txt || { echo "DNF plan pulls no extension package"; exit 1; } - echo "DNF OK" ' echo "::endgroup::" - name: Upload artifact diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7d1da689..8049d0f1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -96,10 +96,14 @@ jobs: run: | sudo apt-get update sudo apt-get install -y createrepo-c dpkg-dev rpm python3 - - name: Generate repository from v1.0-0 + - name: Generate stable from v1.0-0 and latest from the newest release env: DOCUMENTDB_VERSION: v1.0-0 - run: .github/scripts/download_packages.sh + run: | + set -euo pipefail + .github/scripts/download_packages.sh + # Unpinned, like the deploy while DOCUMENTDB_LATEST_VERSION is unset. + SUITE=latest DOCUMENTDB_VERSION=latest .github/scripts/download_packages.sh - name: Verify release inventory and metadata run: python3 .github/scripts/verify_package_inventory.py - name: Resolve both PostgreSQL majors and retired endpoints diff --git a/PACKAGE-INSTALL.md b/PACKAGE-INSTALL.md index 85c7c198..334fd550 100644 --- a/PACKAGE-INSTALL.md +++ b/PACKAGE-INSTALL.md @@ -2,7 +2,7 @@ Repository-backed installation commands for DocumentDB. -> This repository serves v1.0-0. +> The `stable` channel serves v1.0-0; see [Release channels](#release-channels). ## Clean-host installer @@ -21,11 +21,24 @@ and doesn't upgrade it; to move an existing install to 1.0, see The site serves the `install.sh` attached to the release named in `scripts/publish-installer.mjs`, and the build fails if its SHA256 changes. +## Release channels + +The repository publishes two channels, each signed with the same key and listing only its own +release's packages. The commands on this page use `stable`. + +| Channel | Release | APT source | DNF `baseurl` | +|---|---|---|---| +| `stable` | v1.0-0 | `https://documentdb.io/deb stable ubuntu24` | `https://documentdb.io/rpm/rhel9` | +| `latest` | the newest release | `https://documentdb.io/deb latest ubuntu24` | `https://documentdb.io/rpm/latest/rhel9` | + +Release metadata is at `https://documentdb.io/packages/release-info.json` for `stable` and +`https://documentdb.io/packages/release-info-latest.json` for `latest`. + ## What is published Starting with **v0.116-0**, DocumentDB ships a multi-package layout with a setup wizard and -systemd integration, instead of just a bare PostgreSQL extension package. The website mirrors -the package assets attached to one official release; it does not combine the current release +systemd integration, instead of just a bare PostgreSQL extension package. Each channel mirrors +the package assets attached to one official release; it does not combine that release with stale packages from older releases. This deliberately reduces the hosted package matrix compared with earlier releases so every advertised combination corresponds to the current, first-party-built release. diff --git a/app/services/articleService.ts b/app/services/articleService.ts index 36bbad9b..8f07f284 100644 --- a/app/services/articleService.ts +++ b/app/services/articleService.ts @@ -191,7 +191,7 @@ export const linuxPackagesGuideContent = `# Linux Packages Quick Start Install DocumentDB from the published package repository and get a MongoDB-compatible endpoint on your own host. -The current official release publishes the full stack — extension, gateway, setup wizard and systemd units — for **Ubuntu 24.04 and EL9, on PostgreSQL 17 or 18, amd64 or arm64**. EL9 includes Rocky Linux, AlmaLinux, CentOS Stream, and registered Red Hat Enterprise Linux; [Linux packages installation](/packages?method=packages) supplies the prerequisite command for each family. Starting with v0.116, this is a deliberately smaller prebuilt matrix than earlier releases. The website repository mirrors only the current release assets and does not carry older packages forward to make other targets appear current. +The current official release publishes the full stack — extension, gateway, setup wizard and systemd units — for **Ubuntu 24.04 and EL9, on PostgreSQL 17 or 18, amd64 or arm64**. EL9 includes Rocky Linux, AlmaLinux, CentOS Stream, and registered Red Hat Enterprise Linux; [Linux packages installation](/packages?method=packages) supplies the prerequisite command for each family. Starting with v0.116, this is a deliberately smaller prebuilt matrix than earlier releases. The website repository mirrors only official release assets and does not carry older packages forward to make other targets appear current. **Recommended:** install the complete stack, then create a new private PostgreSQL 18 instance. The commands detect architecture on the Linux host where you run them. For containers or macOS/Windows evaluation, choose [Docker installation](/packages?method=docker). diff --git a/readme.md b/readme.md index ba1a86b9..d463b162 100644 --- a/readme.md +++ b/readme.md @@ -148,7 +148,8 @@ The two optional halves are controlled independently: | --- | --- | --- | --- | | `BUILD_PACKAGES` | Variable | On in `documentdb/documentdb.github.io`, off in forks | Downloads the release `.deb` and `.rpm` assets and builds the APT and YUM repositories | | `GPG_PRIVATE_KEY` | Secret | *unset* | Signs the APT `Release` file and the RPM metadata, and publishes `documentdb-archive-keyring.gpg` | -| `DOCUMENTDB_VERSION` | Variable | `latest` | Release tag the packages are mirrored from | +| `DOCUMENTDB_VERSION` | Variable | `latest` | Release tag the `stable` channel mirrors | +| `DOCUMENTDB_LATEST_VERSION` | Variable | `latest` | Release tag the `latest` channel mirrors | Set `BUILD_PACKAGES` to `true` in your fork if you specifically want to test the packaging path; signing is then skipped unless you also add your own `GPG_PRIVATE_KEY`.