From 3e8a70710a5a0a6649b82bf340c4d8a90518e81a Mon Sep 17 00:00:00 2001 From: Alessandro Chitolina Date: Thu, 11 Feb 2021 15:00:59 +0100 Subject: [PATCH] fix jessie builds and repo digest fetch command --- .travis.yml | 29 ++++++++++++++++++++++++----- buildone | 6 +++--- test | 2 +- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index c429d0b..daa8ebb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,16 +79,35 @@ jobs: for DIST in $DISTS ; do sudo docker manifest create $BASENAME:$DIST $BASENAME:$DIST-amd64 $BASENAME:$DIST-arm64 sudo docker manifest push $BASENAME:$DIST - sudo docker pull $BASENAME:$DIST if [[ "$DISTS_WITH_SNAPSHOT" =~ (^|[[:space:]])"$DIST"($|[[:space:]]) ]] ; then SNAPSHOT_NAME="$DIST-snapshot-$(./snapshot_id)" - sudo docker manifest create $SNAPSHOT_NAME:$DIST $SNAPSHOT_NAME:$DIST-amd64 $SNAPSHOT_NAME:$DIST-arm64 - sudo docker manifest push $SNAPSHOT_NAME:$DIST - sudo docker pull $SNAPSHOT_NAME:$DIST + sudo docker manifest create $BASENAME:$SNAPSHOT_NAME $BASENAME:$SNAPSHOT_NAME-amd64 $BASENAME:$SNAPSHOT_NAME-arm64 + sudo docker manifest push $BASENAME:$SNAPSHOT_NAME fi # Use '.RepoDigests 0' for getting Dockerhub repo digest as it was the first pushed - DIST_REPO_DIGEST=$(docker image inspect --format '{{index .RepoDigests 0}}' "$BASENAME:${DIST}") + DIST_REPO_DIGEST="$BASENAME"@$(docker manifest inspect "$BASENAME:${DIST}" | jq -r .manifests[0].digest) update_minideb_derived "https://github.com/$BASENAME-runtimes" "$DIST" "$DIST_REPO_DIGEST" done + - stage: deploy + if: branch = master AND type = push + env: + - DIST="jessie" + before_install: mkdir $HOME/.docker + install: 'echo "{ \"experimental\": \"enabled\" }" > $HOME/.docker/config.json' + script: + - | + if [ -n "${DOCKER_PASSWORD:-}" ]; then + docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" + fi + + # Create and merge a PR to update minideb-extras + CIRCLE_CI_FUNCTIONS_URL=${CIRCLE_CI_FUNCTIONS_URL:-https://raw.githubusercontent.com/bitnami/test-infra/master/circle/functions} + source <(curl -sSL "$CIRCLE_CI_FUNCTIONS_URL") + sudo docker manifest create $BASENAME:$DIST $BASENAME:$DIST-amd64 + sudo docker manifest push $BASENAME:$DIST + + # Use '.RepoDigests 0' for getting Dockerhub repo digest as it was the first pushed + DIST_REPO_DIGEST="$BASENAME"@$(docker manifest inspect "$BASENAME:${DIST}" | jq -r .manifests[0].digest) + update_minideb_derived "https://github.com/$BASENAME-runtimes" "$DIST" "$DIST_REPO_DIGEST" diff --git a/buildone b/buildone index c0f9b53..e49c3f5 100755 --- a/buildone +++ b/buildone @@ -47,14 +47,14 @@ build() { debian_snapshot_id=${3:-} if [ -n "$debian_snapshot_id" ]; then - TAG="${DIST}-snapshot-${debian_snapshot_id}" + TAG="${DIST}-snapshot-${debian_snapshot_id}-$PLATFORM" else - TAG=$DIST + TAG=$DIST-$PLATFORM fi [ -f "debootstrap/$DIST" ] || (echo "buildall: Unknown distribution: $DIST" && exit 1) current_ts="$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)" - if docker pull "$BASENAME:$TAG" > /dev/null; then + if docker pull "$BASENAME:$TAG-$PLATFORM" > /dev/null; then target_ts="$(docker inspect "$BASENAME:$TAG" | jq --raw-output ".[0].Created")" pulled_image_id="$(docker inspect "$BASENAME:$TAG" | jq --raw-output ".[0].Id")" else diff --git a/test b/test index 6381538..5f6ae10 100755 --- a/test +++ b/test @@ -53,7 +53,7 @@ desc "Checking that the terminfo is valid when running with -t (#17)" echo "" | test_extra_args '-t' bash -c 'install_packages procps && top -d1 -n1 -b' MYSQL_PACKAGE=default-mysql-server -if [ "jessie" == "$DIST" ]; then +if [[ "$DIST" == "jessie"* ]]; then MYSQL_PACKAGE=mysql-server fi