mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 23:32:06 -04:00
rewrite deploy script
This commit is contained in:
parent
cc6648b017
commit
2d91f9afe7
6 changed files with 42 additions and 103 deletions
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
source "$WORK_DIR/../../lib/common"
|
||||
|
||||
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
|
||||
TagDockerImageAliases "${TARGET_ARCH}"
|
||||
PushDockerImageAliases "${TARGET_ARCH}"
|
||||
done
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
source "$WORK_DIR/../../lib/common"
|
||||
|
||||
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
|
||||
PushDockerImage "${TARGET_ARCH}"
|
||||
done
|
||||
|
|
@ -14,22 +14,53 @@ IFS=$'\n\t'
|
|||
|
||||
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
Deploy() {
|
||||
DOCKER_REPO="$1"
|
||||
TAG_BASE="$2"
|
||||
DOCKERFILE_DIR="$3"
|
||||
DOCKERFILE_PATH="$DOCKERFILE_DIR/Dockerfile"
|
||||
DOCKER_TAG="$TAG_BASE" DOCKER_REPO="$DOCKER_REPO" DOCKERFILE_PATH="$DOCKERFILE_PATH" bash "$DOCKERFILE_DIR/hooks/push"
|
||||
DOCKER_TAG="$TAG_BASE" DOCKER_REPO="$DOCKER_REPO" DOCKERFILE_PATH="$DOCKERFILE_PATH" bash "$DOCKERFILE_DIR/hooks/post_push"
|
||||
}
|
||||
|
||||
TAG_BASE="$1" # Eg. v0.35.0 or nightly
|
||||
source "$WORK_DIR/lib/common"
|
||||
|
||||
# Creates and pushes all Docker images aliases for all architectures.
|
||||
# If the value of the global variable TAG_BASE is a version tag such as
|
||||
# v0.35.0, the "latest" tag is also updated. Tags without the architecture part
|
||||
# are also created for the default architecture.
|
||||
# As an example, for amd64 (the default architecture) and the tag v0.35.0, the
|
||||
# following tags would be created:
|
||||
# - certbot/certbot:v0.35.0
|
||||
# - certbot/certbot:latest
|
||||
# - certbot/certbot:amd64-latest
|
||||
# For the architecture arm32v6 and the tag v0.35.0, only the following tag
|
||||
# would be created:
|
||||
# - certbot/certbot:arm32v6-latest
|
||||
# For other tags such as "nightly", aliases are only created for the default
|
||||
# architecture where the tag "nightly" would be used without an architecture
|
||||
# part.
|
||||
# Usage: TagAndPush [IMAGE NAME]
|
||||
# where [IMAGE NAME] is the name of the Docker image in the Docker repository
|
||||
# such as "certbot" or "dns-cloudflare".
|
||||
# Read globals:
|
||||
# * TAG_BASE
|
||||
TagAndPushForAllArch() {
|
||||
DOCKER_REPO="${DOCKER_HUB_ORG}/${1}"
|
||||
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
|
||||
docker push "${DOCKER_REPO}:${TARGET_ARCH}-${TAG_BASE}"
|
||||
|
||||
if [[ "${TAG_BASE}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
docker tag "${DOCKER_REPO}:${TARGET_ARCH}-${TAG_BASE}" "${DOCKER_REPO}:${TARGET_ARCH}-latest"
|
||||
docker push "${DOCKER_REPO}:${TARGET_ARCH}-latest"
|
||||
if [ "${TARGET_ARCH}" == "${DEFAULT_ARCH}" ]; then
|
||||
docker tag "${DOCKER_REPO}:${TARGET_ARCH}-${TAG_BASE}" "${DOCKER_REPO}:latest"
|
||||
docker push "${DOCKER_REPO}:latest"
|
||||
fi
|
||||
fi
|
||||
if [ "${TARGET_ARCH}" == "${DEFAULT_ARCH}" ]; then
|
||||
docker tag "${DOCKER_REPO}:${TARGET_ARCH}-${TAG_BASE}" "${DOCKER_REPO}:${TAG_BASE}"
|
||||
docker push "${DOCKER_REPO}:${TAG_BASE}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Step 1: Certbot core Docker
|
||||
Deploy "$DOCKER_HUB_ORG/certbot" "$TAG_BASE" "$WORK_DIR/core"
|
||||
TagAndPushForAllArch "certbot"
|
||||
|
||||
# Step 2: Certbot DNS plugins Docker images
|
||||
for plugin in "${CERTBOT_PLUGINS[@]}"; do
|
||||
Deploy "$DOCKER_HUB_ORG/$plugin" "$TAG_BASE" "$WORK_DIR/plugin"
|
||||
TagAndPushForAllArch "${plugin}"
|
||||
done
|
||||
|
|
|
|||
|
|
@ -31,57 +31,3 @@ export CERTBOT_PLUGINS=(
|
|||
"dns-linode"
|
||||
"dns-sakuracloud"
|
||||
)
|
||||
|
||||
# Pushes docker image for a specific architecture.
|
||||
# Usage: BuildDockerCoreImage [amd64|arm32v6|arm64v8]
|
||||
PushDockerImage() {
|
||||
ARCH=$1
|
||||
|
||||
docker push "${DOCKER_REPO}:${ARCH}-${DOCKER_TAG}"
|
||||
}
|
||||
|
||||
# Creates any docker images aliases for a given architecture.
|
||||
# If DOCKER_TAG tag is a version tag such as v0.35.0, the "latest" tag is also
|
||||
# updated. In the case of the default architecture, tags without the
|
||||
# architecture part are also created.
|
||||
# As an example, for amd64 (the default architecture) and the tag v0.35.0, the
|
||||
# following tags would be created:
|
||||
# - certbot/certbot:v0.35.0
|
||||
# - certbot/certbot:latest
|
||||
# - certbot/certbot:amd64-latest
|
||||
# For the architecture arm32v6 and the tag v0.35.0, only the following tag
|
||||
# would be created:
|
||||
# - certbot/certbot:arm32v6-latest
|
||||
# For other tags such as "nightly", aliases are only created for the default
|
||||
# architecture where the tag "nightly" would be used without an architecture
|
||||
# part.
|
||||
# Usage: TagDockerImageAliases [amd64|arm32v6|arm64v8]
|
||||
TagDockerImageAliases() {
|
||||
ARCH=$1
|
||||
|
||||
if [[ "${DOCKER_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
docker tag "${DOCKER_REPO}:${ARCH}-${DOCKER_TAG}" "${DOCKER_REPO}:${ARCH}-latest"
|
||||
if [ "${ARCH}" == "${DEFAULT_ARCH}" ]; then
|
||||
docker tag "${DOCKER_REPO}:${ARCH}-${DOCKER_TAG}" "${DOCKER_REPO}:latest"
|
||||
fi
|
||||
fi
|
||||
if [ "${ARCH}" == "${DEFAULT_ARCH}" ]; then
|
||||
docker tag "${DOCKER_REPO}:${ARCH}-${DOCKER_TAG}" "${DOCKER_REPO}:${DOCKER_TAG}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Pushes docker images aliases created by the TagDockerImageAliases function.
|
||||
# Usage: PushDockerImageAliases [amd64|arm32v6|arm64v8]
|
||||
PushDockerImageAliases() {
|
||||
ARCH=$1
|
||||
|
||||
if [[ "${DOCKER_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
docker push "${DOCKER_REPO}:${ARCH}-latest"
|
||||
if [ "${ARCH}" == "${DEFAULT_ARCH}" ]; then
|
||||
docker push "${DOCKER_REPO}:latest"
|
||||
fi
|
||||
fi
|
||||
if [ "${ARCH}" == "${DEFAULT_ARCH}" ]; then
|
||||
docker push "${DOCKER_REPO}:${DOCKER_TAG}"
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
source "$WORK_DIR/../../lib/common"
|
||||
|
||||
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
|
||||
TagDockerImageAliases "${TARGET_ARCH}"
|
||||
PushDockerImageAliases "${TARGET_ARCH}"
|
||||
done
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
source "$WORK_DIR/../../lib/common"
|
||||
|
||||
for TARGET_ARCH in "${ALL_TARGET_ARCH[@]}"; do
|
||||
PushDockerImage "${TARGET_ARCH}"
|
||||
done
|
||||
Loading…
Reference in a new issue