Skip to content
This repository has been archived by the owner on Feb 2, 2025. It is now read-only.

Commit

Permalink
Release 2.2.0: Bug fixes, Orbstack support
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
halostatue committed May 16, 2023
1 parent baf819b commit 9d68bcb
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: /
schedule:
interval: weekly
- package-ecosystem: docker
directory: /build/pgtap
schedule:
interval: weekly
17 changes: 17 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.17
FROM alpine:3.18

ARG PG_PROVE_VERSION
ARG PGTAP_VERSION
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
12 changes: 6 additions & 6 deletions build/pgtap/Dockerfile
Original file line number Diff line number Diff line change
@@ -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

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

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

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

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

Expand Down Expand Up @@ -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

Expand Down
21 changes: 15 additions & 6 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9d68bcb

Please sign in to comment.