Skip to content

Commit 0617d90

Browse files
authored
Merge pull request #22 from cisagov/improvement/manual-override
Add ability to use challenges other than Route53 DNS
2 parents ae25df9 + ec8909e commit 0617d90

File tree

4 files changed

+41
-9
lines changed

4 files changed

+41
-9
lines changed

.github/workflows/build.yml

+15-4
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ jobs:
156156
if [ "${{ github.event_name }}" = "push" ]; then
157157
TAGS="${TAGS},${IMAGE_NAME}:sha-${GITHUB_SHA::8}"
158158
fi
159+
for i in ${TAGS//,/ }
160+
do
161+
TAGS="${TAGS},ghcr.io/${i}"
162+
done
159163
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
160164
echo ::set-output name=source_version::$(./bump_version.sh show)
161165
echo ::set-output name=tags::${TAGS}
@@ -275,9 +279,10 @@ jobs:
275279
build-push-all:
276280
# Builds the final set of images for each of the platforms listed in
277281
# PLATFORMS environment variable. These images are tagged with the Docker
278-
# tags calculated in the "prepare" job and pushed to DockerHub. The
279-
# contents of README.md is pushed as the image's description. This job is
280-
# skipped when the triggering event is a pull request.
282+
# tags calculated in the "prepare" job and pushed to DockerHub and the
283+
# GitHub Container Registry. The contents of README.md are pushed as the
284+
# image's description to DockerHub. This job is skipped when the triggering
285+
# event is a pull request.
281286
name: "Build and push all platforms"
282287
runs-on: ubuntu-latest
283288
needs: [lint, prepare, test]
@@ -288,6 +293,12 @@ jobs:
288293
with:
289294
username: ${{ secrets.DOCKER_USERNAME }}
290295
password: ${{ secrets.DOCKER_PASSWORD }}
296+
- name: Login to GitHub Container Registry
297+
uses: docker/login-action@v1
298+
with:
299+
registry: ghcr.io
300+
username: ${{ github.actor }}
301+
password: ${{ secrets.GITHUB_TOKEN }}
291302
- name: Checkout
292303
uses: actions/checkout@v2
293304
- name: Set up QEMU
@@ -305,7 +316,7 @@ jobs:
305316
${{ env.BASE_CACHE_KEY }}
306317
- name: Create cross-platform support Dockerfile-x
307318
run: ./buildx-dockerfile.sh
308-
- name: Build and push platform images to Docker Hub
319+
- name: Build and push platform images to registries
309320
id: docker_build
310321
uses: docker/build-push-action@v2
311322
with:

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ For additional `certbot` commands see the help:
3838
docker-compose run certboto --help
3939
```
4040

41+
To disable usage of the Route53 DNS plugin pass `--no-dns-route53` as the first
42+
argument. This is useful if you need to use other types of challenges.
43+
44+
```console
45+
docker-compose run certboto --no-dns-route53 --manual certonly -d lemmy.imotorhead.com
46+
```
47+
4148
### Install ###
4249

4350
Create a `docker-compose.yml` file similar to this:
@@ -76,7 +83,7 @@ Or build `cisagov/certboto` from source:
7683
```console
7784
git clone https://github.com/cisagov/certboto-docker.git
7885
cd certboto-docker
79-
docker-compose build --build-arg VERSION=0.0.1
86+
docker-compose build --build-arg VERSION=0.0.3
8087
```
8188

8289
## Environment Variables ##

src/entrypoint.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@ set -o nounset
44
set -o errexit
55
# Sha-bang cannot be /bin/bash (not available), but
66
# the container's /bin/sh does support pipefail.
7-
# shellcheck disable=SC2039
7+
# SC2039 has been retired in favor of SC3xxx issues.
8+
# See: https://github.com/koalaman/shellcheck/wiki/SC2039
9+
# See: https://github.com/koalaman/shellcheck/issues/2052
10+
# Both the old and new codes are listed since CI is using the old code (0.7.0),
11+
# and dev environments are using the newer version (0.7.2).
12+
# shellcheck disable=SC2039,SC3040
813
set -o pipefail
914

1015
if [ "$1" = "--version" ]; then
@@ -28,9 +33,18 @@ AWS_PROFILE=${BUCKET_PROFILE} aws s3 sync --no-progress "s3://${BUCKET_NAME}" \
2833
echo "Rebuilding symlinks in ${ACME_CONFIG_ROOT}"
2934
./rebuild-symlinks.py --log-level warning ${ACME_CONFIG_ROOT}
3035

31-
echo "Running: certbot --dns-route53 $*"
36+
# First argument flag --no-dns-route53 disables default use of --dns-route53
37+
if [ "$1" = "--no-dns-route53" ]; then
38+
shift
39+
echo "Route53 DNS challenge disabled by --no-dns-route53 flag"
40+
else
41+
# Add the --dns-route53 argument to the start of our args
42+
set -- --dns-route53 "$*"
43+
fi
44+
45+
echo "Running: certbot $*"
3246
# shellcheck disable=SC2048,SC2086
33-
AWS_PROFILE=${DNS_PROFILE} certbot --dns-route53 $*
47+
AWS_PROFILE=${DNS_PROFILE} certbot $*
3448

3549
echo "Syncing certbot configs to ${BUCKET_NAME}"
3650
AWS_PROFILE=${BUCKET_PROFILE} aws s3 sync --delete ${ACME_CONFIG_ROOT} "s3://${BUCKET_NAME}"

src/version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.2"
1+
__version__ = "0.0.3"

0 commit comments

Comments
 (0)