From 9d68bcbc33b1ba064547400ec437b4b649d4bef9 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Mon, 15 May 2023 10:02:25 -0400 Subject: [PATCH] Release 2.2.0: Bug fixes, Orbstack support - Added explicit support for the internal macOS hostname under [Orbstack](https://docs.orbstack.dev/machines/network#connecting-to-servers-on-mac) - Extended Dependabot configuration to look at `build/pgtap/Dockerfile` as well as the root `Dockerfile.` - Upgraded base image to Alpine 3.18. - Added code to work around an unnecessary warning from `docker context ls` when `$DOCKER_HOST` is already set. - Changed logic for adding `--add-host=host.docker.internal:host-gateway` under Linux. Closes #19. --- .github/dependabot.yml | 4 ++++ Changelog.md | 17 +++++++++++++++++ Dockerfile | 2 +- README.md | 2 +- build/pgtap/Dockerfile | 12 ++++++------ run | 21 +++++++++++++++------ 6 files changed, 44 insertions(+), 14 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 07042a0..1b5234a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,7 @@ updates: directory: / schedule: interval: weekly + - package-ecosystem: docker + directory: /build/pgtap + schedule: + interval: weekly diff --git a/Changelog.md b/Changelog.md index 5d18a14..02b075b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,21 @@ # kineticcafe/sqitch-pgtap Changelog +## 2.2.0 / 2023-05-15 + +- Added explicit support for the internal macOS hostname under + [Orbstack][orbstack-internal]. + +- Extended Dependabot configuration to look at `build/pgtap/Dockerfile` as well + as the root `Dockerfile.` + +- Upgraded base image to Alpine 3.18. + +- Added code to work around an unnecessary warning from `docker context ls` when + `$DOCKER_HOST` is already set. + +- Changed logic for adding `--add-host=host.docker.internal:host-gateway` under + Linux. + ## 2.1.1 / 2023-03-29 - Copied `package-versions.json` to the built image. Added `jq` to the supported @@ -109,3 +125,4 @@ [extractions/setup-just]: https://github.com/extractions/setup-just [casey/just]: https://github.com/casey/just +[orbstack-internal]: https://docs.orbstack.dev/machines/network#connecting-to-servers-on-mac diff --git a/Dockerfile b/Dockerfile index 8881dc2..a0b1761 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.17 +FROM alpine:3.18 ARG PG_PROVE_VERSION ARG PGTAP_VERSION diff --git a/README.md b/README.md index 800de06..ce36a26 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This is a simple Docker container that contains [sqitch][], [pgTAP][], and to work with `sqitch` and `pg_prove`/`pgTAP` without going through the effort of installing them on various systems. -The image is based on Alpine (3.17) and does not include a PostgreSQL server; +The image is based on Alpine (3.18) and does not include a PostgreSQL server; instead, it is expected that all values will be provided through environment variables or on the command-line. diff --git a/build/pgtap/Dockerfile b/build/pgtap/Dockerfile index 8ac363a..5ec4130 100644 --- a/build/pgtap/Dockerfile +++ b/build/pgtap/Dockerfile @@ -1,4 +1,4 @@ -FROM postgres:15-alpine3.17 AS build-pgtap-psql-15 +FROM postgres:15-alpine3.18 AS build-pgtap-psql-15 ARG PGTAP_VERSION @@ -12,7 +12,7 @@ RUN apk add --no-cache --update perl wget postgresql-dev openssl \ && mv sql/pgtap.sql sql/uninstall_pgtap.sql /opt/pgtap/15 \ && rm -rf /var/cache/apk/* /tmp/* -FROM postgres:14-alpine3.17 AS build-pgtap-psql-14 +FROM postgres:14-alpine3.18 AS build-pgtap-psql-14 ARG PGTAP_VERSION @@ -26,7 +26,7 @@ RUN apk add --no-cache --update perl wget postgresql-dev openssl \ && mv sql/pgtap.sql sql/uninstall_pgtap.sql /opt/pgtap/14 \ && rm -rf /var/cache/apk/* /tmp/* -FROM postgres:13-alpine3.17 AS build-pgtap-psql-13 +FROM postgres:13-alpine3.18 AS build-pgtap-psql-13 ARG PGTAP_VERSION @@ -40,7 +40,7 @@ RUN apk add --no-cache --update perl wget postgresql-dev openssl \ && mv sql/pgtap.sql sql/uninstall_pgtap.sql /opt/pgtap/13 \ && rm -rf /var/cache/apk/* /tmp/* -FROM postgres:12-alpine3.17 as build-pgtap-psql-12 +FROM postgres:12-alpine3.18 as build-pgtap-psql-12 ARG PGTAP_VERSION @@ -54,7 +54,7 @@ RUN apk add --no-cache --update perl wget postgresql-dev openssl \ && mv sql/pgtap.sql sql/uninstall_pgtap.sql /opt/pgtap/12 \ && rm -rf /var/cache/apk/* /tmp/* -FROM postgres:11-alpine3.17 AS build-pgtap-psql-11 +FROM postgres:11-alpine3.18 AS build-pgtap-psql-11 ARG PGTAP_VERSION @@ -96,7 +96,7 @@ RUN apk add --no-cache --update perl wget postgresql-dev openssl \ && mv sql/pgtap.sql sql/uninstall_pgtap.sql /opt/pgtap/9.6 \ && rm -rf /var/cache/apk/* /tmp/* -FROM alpine:3.17 AS package-pgtap +FROM alpine:3.18 AS package-pgtap ARG PGTAP_VERSION diff --git a/run b/run index 0c60499..f306889 100755 --- a/run +++ b/run @@ -39,8 +39,12 @@ has() { } get-current-docker-context() { - docker context ls --format '{{ . | json }}' | - jq -sr '.[] | select(.Current == true) | .Name' + if [[ -n "${DOCKER_HOST}" ]]; then + echo "${DOCKER_HOST}" + else + docker context ls --format '{{ . | json }}' | + jq -sr '.[] | select(.Current == true) | .Name' + fi } set-command() { @@ -142,14 +146,19 @@ setup() { if [[ -z "${PGHOST:-}" ]]; then case "$(get-current-docker-context)" in - colima*) docker_host="host.lima.internal" ;; + colima | colima-* | unix:*/.colima/*) docker_host="host.lima.internal" ;; + orbstack) docker_host="host.internal" ;; *) docker_host="host.docker.internal" ;; esac + # TODO: + # - How to support Podman? + # - How to support containerd/nerdctl? + # This requires Docker 20.04 or later. - case "${uname_s}" in - Linux*) passopt+=(--add-host=host.docker.internal:host-gateway) ;; - esac + if [[ "${docker_host}" == "host.docker.internal" ]] && [[ "${uname_s}" =~ ^Linux ]]; then + passopt+=(--add-host=host.docker.internal:host-gateway) + fi PGHOST="${docker_host}" fi