From 28f9b57c82c6afb231040a88cc434f810cb76311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20R=2E=20Miguel?= Date: Thu, 25 Jan 2024 20:23:09 -0300 Subject: [PATCH] workflows: build & push tembo-pg-cnpg for Pg14 & 16 --- .github/workflows/build_images.yaml | 49 +++++++++++++++++++++++++---- tembo-pg-cnpg/Dockerfile | 11 +++++-- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_images.yaml b/.github/workflows/build_images.yaml index eb753a8..a53488e 100644 --- a/.github/workflows/build_images.yaml +++ b/.github/workflows/build_images.yaml @@ -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 @@ -116,10 +116,6 @@ 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 @@ -140,5 +136,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,linux/arm64 \ + --tag quay.io/tembo/tembo-pg-cnpg:pg${{ matrix.pg_version }}-${{ steps.sha.outputs.sha }} \ + --pull ${PUSH_FLAG} ./tembo-pg-cnpg \ No newline at end of file diff --git a/tembo-pg-cnpg/Dockerfile b/tembo-pg-cnpg/Dockerfile index dbe7583..8e759f0 100644 --- a/tembo-pg-cnpg/Dockerfile +++ b/tembo-pg-cnpg/Dockerfile @@ -1,3 +1,5 @@ +ARG PG_VERSION=15 + FROM rust:1.70-bookworm as builder ARG TRUNK_VER=0.12.12 @@ -5,7 +7,8 @@ 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 @@ -28,13 +31,15 @@ RUN set -xe; \ rm -rf /var/lib/apt/lists/*; # Install pg_stat_statements -RUN trunk install pg_stat_statements +RUN trunk install --registry https://trunk-registry.cdb-dev.com pg_stat_statements # Install auto_explain -RUN trunk install auto_explain +RUN trunk install --registry https://trunk-registry.cdb-dev.com 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