Remove snapshot logic

Signed-off-by: Carlos Rodriguez Hernandez <carlosrh@vmware.com>
This commit is contained in:
Carlos Rodriguez Hernandez 2022-11-03 16:36:26 +00:00
parent 064761b6d4
commit a9d9039d03
No known key found for this signature in database
GPG Key ID: 100ECB0F58E45C4A
10 changed files with 4 additions and 118 deletions

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"

10
pushall
View File

@ -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

View File

@ -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")

View File

@ -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)"

View File

@ -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&amp;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/&amp;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}"