From a9d9039d03bb460daeae9c3b40ae18f5e0710d64 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Hernandez Date: Thu, 3 Nov 2022 16:36:26 +0000 Subject: [PATCH] Remove snapshot logic Signed-off-by: Carlos Rodriguez Hernandez --- .github/actions/build/action.yml | 17 -------------- .github/workflows/main.yml | 5 ---- buildall | 13 ----------- buildone | 12 +++------- buildone_snapshot | 11 --------- mkimage | 6 ----- pushall | 10 -------- pushmanifest | 5 ---- qemu_build | 3 +-- snapshot_id | 40 -------------------------------- 10 files changed, 4 insertions(+), 118 deletions(-) delete mode 100755 buildone_snapshot delete mode 100755 snapshot_id diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index 8755e59..aa5dd36 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -8,13 +8,6 @@ inputs: is_latest: description: The created dist is also latest default: false - build_snapshot: - description: Build snapshot build - default: false -outputs: - snapshot-id: - description: "Created snapshot id if requested to build it" - value: ${{ steps.snapshot-id.outputs.snapshot-id }} runs: using: "composite" steps: @@ -36,21 +29,11 @@ runs: echo "QEMU is not required for platform ${{ inputs.platform }}" fi shell: bash - - name: Build snapshot id - id: snapshot-id - run: | - if ${{ inputs.build_snapshot }} ; then - echo "::set-output name=snapshot-id::$(./snapshot_id)" - fi - shell: bash - name: "Build image" run: | set -x echo Building ${{ inputs.dist }} - ${{ inputs.platform }} sudo -E bash -x buildone "${{ inputs.dist }}" "${{ inputs.platform }}" - if ${{ inputs.build_snapshot }} ; then - sudo -E bash -x buildone_snapshot "${{ inputs.dist }}" "${{ steps.snapshot-id.outputs.snapshot-id }}" "${{ inputs.platform }}" - fi if ${{ inputs.is_latest }} ; then BASENAME=${BASENAME:?Undefined or empty BASENAME} echo "Tagging latest" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 50ed909..41daed1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,6 @@ on: env: BASENAME: bitnami/minideb LATEST: bullseye - DIST_WITH_SNAPSHOT: buster # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" @@ -56,7 +55,6 @@ jobs: dist: "${{ matrix.dist }}" platform: "${{ matrix.arch }}" is_latest: ${{ matrix.dist == env.LATEST }} - build_snapshot: ${{ matrix.dist == env.DIST_WITH_SNAPSHOT }} - name: Push if: github.ref == 'refs/heads/master' env: @@ -69,9 +67,6 @@ jobs: if ${{ matrix.dist == env.LATEST }} ; then bash pushone "latest" "${{ matrix.arch }}" fi - if ${{ matrix.dist == env.DIST_WITH_SNAPSHOT }} ; then - bash pushone "${{ matrix.dist }}-snapshot-${{ steps.build.outputs.snapshot-id }}" "${{ matrix.arch }}" - fi deploy_manifests: runs-on: ubuntu-22.04 diff --git a/buildall b/buildall index b282d06..2cfa7d9 100755 --- a/buildall +++ b/buildall @@ -11,22 +11,9 @@ arch=${1:-"amd64 arm64"} dist="buster bullseye " -dist_with_snapshot="buster" - for a in $arch; do for i in $dist; do ./buildone "$i" "$a" done done -snapshot_id=$(./snapshot_id) -if [ -n "$snapshot_id" ]; then - for a in $arch; do - for i in $dist_with_snapshot; do - ./buildone_snapshot "$i" "$snapshot_id" "$a" - done - - mkdir -p "build/$a" - echo "$snapshot_id" > "build/$a/snapshot_id" - done -fi diff --git a/buildone b/buildone index bdf5554..494d7e9 100755 --- a/buildone +++ b/buildone @@ -44,13 +44,7 @@ log() { build() { DIST=$1 PLATFORM=${2:-amd64} - - debian_snapshot_id=${3:-} - if [ -n "$debian_snapshot_id" ]; then - TAG="${DIST}-snapshot-${debian_snapshot_id}-$PLATFORM" - else - TAG=$DIST-$PLATFORM - fi + TAG=$DIST-$PLATFORM [ -f "debootstrap/$DIST" ] || (echo "buildall: Unknown distribution: $DIST" && exit 1) current_ts="$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)" @@ -64,7 +58,7 @@ build() { log "============================================" log "Building $BASENAME:$TAG" log "============================================" - ./mkimage "build/$TAG.tar" "$DIST" "$PLATFORM" "${debian_snapshot_id:-}" + ./mkimage "build/$TAG.tar" "$DIST" "$PLATFORM" built_image_id=$(./import "build/$TAG.tar" "$target_ts" "$PLATFORM") log "============================================" log "Running tests for $BASENAME:$TAG" @@ -73,7 +67,7 @@ build() { log "============================================" log "Rebuilding $BASENAME:$TAG to test reproducibility" log "============================================" - ./mkimage "build/${TAG}-repro.tar" "$DIST" "$PLATFORM" "${debian_snapshot_id:-}" + ./mkimage "build/${TAG}-repro.tar" "$DIST" "$PLATFORM" repro_image_id=$(./import "build/${TAG}-repro.tar" "$target_ts" "$PLATFORM") if [ "$repro_image_id" != "$built_image_id" ]; then log "$BASENAME:$TAG differs after a rebuild. Examine $built_image_id and $repro_image_id" diff --git a/buildone_snapshot b/buildone_snapshot deleted file mode 100755 index 36b0b1a..0000000 --- a/buildone_snapshot +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e -set -u -set -o pipefail - -dist=${1:?dist arg is required} -snapshot_id=${2:-$(./snapshot_id)} -platform=${3:-amd64} - -./buildone "$dist" "$platform" "$snapshot_id" diff --git a/mkimage b/mkimage index 1386f98..c368541 100755 --- a/mkimage +++ b/mkimage @@ -8,7 +8,6 @@ ROOT=$(cd "$(dirname "$0")" && pwd) TARGET=${1:?Specify the target filename} DIST=${2:-stable} PLATFORM=${3:-$(dpkg --print-architecture)} -SNAPSHOT_ID=${4:-} LOGFILE=${TARGET}.log @@ -78,11 +77,6 @@ rootfs_chroot bash debootstrap/debootstrap --second-stage repo_url="http://deb.debian.org/debian" sec_repo_url="http://security.debian.org/" -if [ -n "$SNAPSHOT_ID" ]; then - repo_url="http://snapshot.debian.org/archive/debian/${SNAPSHOT_ID}/" - sec_repo_url="http://snapshot.debian.org/archive/debian-security/${SNAPSHOT_ID}/" -fi - echo -e "deb ${repo_url} $DIST main" > "$rootfsDir/etc/apt/sources.list" if [ "$DIST" == "bullseye" ]; then echo "deb ${repo_url} $DIST-updates main" >> "$rootfsDir/etc/apt/sources.list" diff --git a/pushall b/pushall index 1386e45..263bc94 100755 --- a/pushall +++ b/pushall @@ -7,7 +7,6 @@ set -o pipefail DISTS="buster bullseye " -DISTS_WITH_SNAPSHOT="buster" LATEST=bullseye BASENAME=bitnami/minideb @@ -34,15 +33,6 @@ for DIST in $DISTS; do push "$DIST" done -if [ -f "build/snapshot_id" ]; then - snapshot_id=$(cat build/snapshot_id) - - for DIST in $DISTS_WITH_SNAPSHOT; do - TAG="${DIST}-snapshot-${snapshot_id}" - push "${TAG}" - done -fi - docker tag "${BASENAME}:${LATEST}" "${BASENAME}:latest" push latest diff --git a/pushmanifest b/pushmanifest index c64d9cf..82b7f37 100755 --- a/pushmanifest +++ b/pushmanifest @@ -9,11 +9,9 @@ bullseye latest "} -DISTS_WITH_SNAPSHOT=${DISTS_WITH_SNAPSHOT:-buster} BASENAME=bitnami/minideb PLATFORMS=${PLATFORMS:-amd64 arm64} DRY_RUN=${DRY_RUN:-} -SNAPSHOT_ID=${SNAPSHOT_ID:-} read -r -a ARCHS <<<"$PLATFORMS" run_docker() { @@ -60,9 +58,6 @@ tags=() for DIST in $DISTS; do tags+=("$DIST") - if list_includes "$DISTS_WITH_SNAPSHOT" "$DIST" ; then - tags+=("$DIST-snapshot-${SNAPSHOT_ID:-$(./snapshot_id)}") - fi done repositories=("$BASENAME") diff --git a/qemu_build b/qemu_build index 4f91047..2ab505a 100755 --- a/qemu_build +++ b/qemu_build @@ -49,7 +49,6 @@ fi DIST=$1 PLATFORM=${2:-amd64} -DEBIAN_SNAPSHOT_ID=${3:-} make .installed-qemu mkdir -p .kvm-images/{amd64,arm64} @@ -145,7 +144,7 @@ do_ssh "apt-get update && apt-get install -y docker-ce docker-ce-cli containerd. rsync -avz -e "ssh -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null' -p 5555 -i $pub_key_dir/id_rsa" --exclude ".git" --exclude ".installed-requirements" --exclude ".kvm-images" --exclude "build" --exclude "ssh" ./ "root@localhost:/build/." do_ssh "cd /build/ && make .installed-requirements" -do_ssh "cd /build/ && ./buildone \"$DIST\" \"$PLATFORM\" \"$DEBIAN_SNAPSHOT_ID\"" +do_ssh "cd /build/ && ./buildone \"$DIST\" \"$PLATFORM\"" rsync -avz -e "ssh -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null' -p 5555 -i $pub_key_dir/id_rsa" "root@localhost:/build/build/$DIST.tar" "./$TARGET_FILE" current_ts="$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)" diff --git a/snapshot_id b/snapshot_id deleted file mode 100755 index 2dedee2..0000000 --- a/snapshot_id +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e -set -u -set -o pipefail - -snapshot_tmp_dir=$(mktemp -d) -mkdir -p "${snapshot_tmp_dir}" - -get_latest_month_query() { - local -r snapshot_archive_tmp_file="${snapshot_tmp_dir}/archive.html" - - curl -sSfL "https://snapshot.debian.org/archive/debian/" > "$snapshot_archive_tmp_file" - - local -r month_query_regex="(\?year=\d\d\d\d&month=\d+)" - local -r month_query=$(grep -Po "${month_query_regex}" "${snapshot_archive_tmp_file}" | tail -1) - - [[ -z "$month_query" ]] && echo "Not found snapshots using the following regex: ${month_query_regex}" && return 1 - - echo "$month_query" -} - -get_latest_debian_snapshot_id() { - local -r snapshot_list_tmp_file="${snapshot_tmp_dir}/month-snapshots.html" - - ! month_query=$(get_latest_month_query) && return 1 - month_query=${month_query/&month=/&month=} - - curl -sSfL "https://snapshot.debian.org/archive/debian/$month_query" > "$snapshot_list_tmp_file" - - local -r snapshot_id_regex="(\d+T.*Z)" - local -r snapshot_id=$(grep -Po "${snapshot_id_regex}" "${snapshot_list_tmp_file}" | tail -1) - - [[ -z "$snapshot_id" ]] && echo "Not found snapshot id using the following regex: ${snapshot_id_regex}" && return 1 - - echo "$snapshot_id" -} - -get_latest_debian_snapshot_id -rm -rf "${snapshot_tmp_dir}"