Skip to content

Commit

Permalink
workflows: publish tembo-pg-cnpg for Pg 14 and 16 (#52)
Browse files Browse the repository at this point in the history
* workflows: change secrets used in `build_and_push_pg_slim`

* workflows: build & push tembo-pg-cnpg for Pg14 & 16

* workflows: skip linux/arm64 for tembo-pg-cnpg

* workflows: update build_and_push with Nick's latest changes

* workflows: use prod registry
  • Loading branch information
vrmiguel authored Jan 26, 2024
1 parent 839d08e commit db818c3
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 9 deletions.
53 changes: 45 additions & 8 deletions .github/workflows/build_images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
# in a pull request, and using all directories on the release
# or main branches.
changed_relative_to_ref: origin/${{ github.base_ref || 'not-a-branch' }}
ignore_dirs: ".tembo, tembo-pg-slim"
ignore_dirs: ".tembo, tembo-pg-slim, tembo-pg-cnpg"

build_and_push:
name: Build and push images
Expand Down Expand Up @@ -115,18 +115,14 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
image: quay.io/coredb/binfmt:latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASSWORD }}
username: ${{ secrets.QUAY_USER_TEMBO }}
password: ${{ secrets.QUAY_PASSWORD_TEMBO }}
- name: Build and push
run: |
set -xe
Expand All @@ -139,5 +135,46 @@ jobs:
--build-arg PG_VERSION=${{ matrix.pg_version }} \
--build-arg PG_MAJOR=${{ matrix.pg_major }} \
--platform linux/amd64,linux/arm64 \
--tag quay.io/tembo/tembo-pg-slim:pg${{ matrix.pg_version }} \
--tag quay.io/tembo/tembo-pg-slim:pg${{ matrix.pg_major }} \
--pull ${PUSH_FLAG} ./tembo-pg-slim
build_and_push_pg_cnpg:
name: Build and push tembo-pg-cnpg
runs-on:
- self-hosted
- dind
- large-8x8
strategy:
fail-fast: false
matrix:
include:
- pg_version: "14"
- pg_version: "15"
- pg_version: "16"
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USER_TEMBO }}
password: ${{ secrets.QUAY_PASSWORD_TEMBO }}
- name: Get short SHA
id: sha
run: echo "::set-output name=sha::$(git rev-parse --short HEAD)"
- name: Build and push
run: |
set -xe
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
PUSH_FLAG=""
if [ "${BRANCH_NAME}" == "main" ]; then
PUSH_FLAG="--push"
fi
docker buildx build \
--build-arg PG_VERSION=${{ matrix.pg_version }} \
--platform linux/amd64 \
--tag quay.io/tembo/tembo-pg-cnpg:pg${{ matrix.pg_version }}-${{ steps.sha.outputs.sha }} \
--pull ${PUSH_FLAG} ./tembo-pg-cnpg
7 changes: 6 additions & 1 deletion tembo-pg-cnpg/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
ARG PG_VERSION=15

FROM rust:1.70-bookworm as builder

ARG TRUNK_VER=0.12.12

ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL sparse
RUN cargo install --version $TRUNK_VER pg-trunk

FROM quay.io/tembo/tembo-pg-slim:722acc3
FROM quay.io/tembo/tembo-pg-slim:pg${PG_VERSION}

USER root

# Install trunk
Expand Down Expand Up @@ -35,6 +38,8 @@ RUN trunk install auto_explain

# cache pg_stat_statements and auto_explain and pg_stat_kcache to temp directory
RUN set -eux; \
mkdir /tmp/pg_pkglibdir; \
mkdir /tmp/pg_sharedir; \
cp -r $(pg_config --pkglibdir)/* /tmp/pg_pkglibdir; \
cp -r $(pg_config --sharedir)/* /tmp/pg_sharedir

Expand Down

0 comments on commit db818c3

Please sign in to comment.