Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CI images to GHCR #157

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/build-test-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER_NAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# If current branch is not master,build and publish dev image
- name: Build & Push all dev images
Expand All @@ -66,11 +67,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER_NAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# If current branch is not master,build and publish dev image
- name: Build & Push all dev images
Expand All @@ -90,11 +92,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER_NAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build & Push all live images
run: |
Expand Down
2 changes: 1 addition & 1 deletion circleci/images/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# config variable
DOCKER_REPO ?= citus
DOCKER_REPO ?= ghcr.io/citusdata
SHA_SUFFIX := $(shell git rev-parse --short HEAD)

# auto generated variables
Expand Down
54 changes: 36 additions & 18 deletions circleci/images/citusupgradetester/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ FROM python:3.9.7-slim-bullseye AS base
# add unpriviliged user for tests
RUN useradd -ms /bin/bash circleci

RUN apt-get update \
RUN <<'EOF'
# install dependencies
&& apt-get install -y --no-install-recommends \
set -eux
apt-get update

apt-get install -y --no-install-recommends \
apt-transport-https \
autoconf \
build-essential \
Expand Down Expand Up @@ -34,7 +37,8 @@ RUN apt-get update \
perl \

# clear apt cache
&& rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*
EOF

# make special locales available
COPY locale.gen /etc/locale.gen
Expand All @@ -43,28 +47,37 @@ RUN locale-gen
# Add codeclimate
RUN curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /usr/local/bin/cc-test-reporter && chmod +x /usr/local/bin/cc-test-reporter

# add postgres signing key
RUN curl -sf https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -

ARG PG_VERSION
ARG PG_MAJOR
ENV PG_VERSION=$PG_VERSION
ENV PG_MAJOR=$PG_MAJOR

# add postgres repository
RUN echo "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" >> /etc/apt/sources.list.d/postgresql.list \
&& echo "deb https://apt-archive.postgresql.org/pub/repos/apt bullseye-pgdg-archive main" >> /etc/apt/sources.list.d/postgresql.list \
&& apt-get update \

RUN <<'EOF'
# install postgres ecosystem for pg version: $PG_VERSION
set -eux

# install key and repositories
curl -sf https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
echo "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" >> /etc/apt/sources.list.d/postgresql.list
echo "deb https://apt-archive.postgresql.org/pub/repos/apt bullseye-pgdg-archive main" >> /etc/apt/sources.list.d/postgresql.list

apt-get update

# infer the pgdgversion of postgres based on the $PG_VERSION
&& pgdg_version=$(apt list -a postgresql-server-dev-${PG_MAJOR} 2>/dev/null | grep "${PG_VERSION}" | awk '{print $2}' | head -n1 ) \
&& apt-get install -y --no-install-recommends --allow-downgrades \
pgdg_version=$(apt list -a postgresql-server-dev-${PG_MAJOR} 2>/dev/null | grep "${PG_VERSION}" | awk '{print $2}' | head -n1 )

apt-get install -y --no-install-recommends --allow-downgrades \
libpq-dev=${pgdg_version} \
libpq5=${pgdg_version} \
postgresql-${PG_MAJOR}=${pgdg_version} \
postgresql-client-${PG_MAJOR}=${pgdg_version} \
postgresql-${PG_MAJOR}-dbgsym=${pgdg_version} \
postgresql-server-dev-${PG_MAJOR}=${pgdg_version} \

# clear apt cache
&& rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*
EOF

# add postgress to the path
ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
Expand All @@ -75,11 +88,18 @@ RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgres
##############################################################################
FROM base AS builder

RUN apt update \
&& apt install -y \
RUN <<'EOF'
# install dependencies
set -eux
apt update

apt install -y \
git \
libkrb5-dev \
&& rm -rf /var/lib/apt/lists/*

# clear apt cache
rm -rf /var/lib/apt/lists/*
EOF

ARG CITUS_VERSIONS
ENV CITUS_VERSIONS=$CITUS_VERSIONS
Expand All @@ -98,8 +118,6 @@ RUN chown -R circleci /usr/lib/postgresql/ /usr/include/postgresql/ /usr/share/p
COPY ./files/etc/requirements.txt /tmp/etc/
RUN pip3 install -Ir /tmp/etc/requirements.txt

WORKDIR /home/circleci

ARG CITUS_VERSIONS
ENV CITUS_VERSIONS=$CITUS_VERSIONS

Expand Down
41 changes: 27 additions & 14 deletions circleci/images/extbuilder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ FROM buildpack-deps:bullseye
# add unpriviliged user for tests
RUN useradd -ms /bin/bash circleci

RUN apt-get update \
RUN <<'EOF'
# install dependencies
&& apt-get install -y --no-install-recommends \
set -eux
apt-get update

apt-get install -y --no-install-recommends \
apt-transport-https \
autoconf \
build-essential \
Expand All @@ -29,31 +32,41 @@ RUN apt-get update \
locales \
make \
perl \
# clear apt cache
&& rm -rf /var/lib/apt/lists/*

# add postgres signing key
RUN curl -sf https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
# clear apt cache
rm -rf /var/lib/apt/lists/*
EOF

ARG PG_VERSION
ARG PG_MAJOR
ENV PG_VERSION=$PG_VERSION
ENV PG_MAJOR=$PG_MAJOR

# add postgres repository
RUN echo "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" >> /etc/apt/sources.list.d/postgresql.list \
&& echo "deb https://apt-archive.postgresql.org/pub/repos/apt bullseye-pgdg-archive main" >> /etc/apt/sources.list.d/postgresql.list \
&& apt-get update \
RUN <<'EOF'
# install postgres ecosystem for pg version: $PG_VERSION
set -eux

# install key and repositories
curl -sf https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
echo "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" >> /etc/apt/sources.list.d/postgresql.list
echo "deb https://apt-archive.postgresql.org/pub/repos/apt bullseye-pgdg-archive main" >> /etc/apt/sources.list.d/postgresql.list

apt-get update

# infer the pgdgversion of postgres based on the $PG_VERSION
&& pgdg_version=$(apt list -a postgresql-server-dev-${PG_MAJOR} 2>/dev/null | grep "${PG_VERSION}" | awk '{print $2}' | head -n1 ) \
&& apt-get install -y --no-install-recommends --allow-downgrades \
pgdg_version=$(apt list -a postgresql-server-dev-${PG_MAJOR} 2>/dev/null | grep "${PG_VERSION}" | awk '{print $2}' | head -n1 )

apt-get install -y --no-install-recommends --allow-downgrades \
libpq-dev=${pgdg_version} \
libpq5=${pgdg_version} \
postgresql-${PG_MAJOR}=${pgdg_version} \
postgresql-client-${PG_MAJOR}=${pgdg_version} \
postgresql-${PG_MAJOR}-dbgsym=${pgdg_version} \
postgresql-server-dev-${PG_MAJOR}=${pgdg_version} \
postgresql-server-dev-${PG_MAJOR}=${pgdg_version}

# clear apt cache
&& rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*
EOF

USER circleci
WORKDIR /home/circleci
74 changes: 49 additions & 25 deletions circleci/images/exttester/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
# we use this builder to build the isolation tester from a specific version
FROM buildpack-deps:bullseye AS dev-tools-builder

RUN apt-get update \
RUN <<'EOF'
# install dependencies
&& apt-get install -y --no-install-recommends \
set -eux

apt-get update

apt-get install -y --no-install-recommends \
apt-transport-https \
autoconf \
build-essential \
Expand All @@ -28,8 +32,10 @@ RUN apt-get update \
locales \
make \
perl \

# clear apt cache
&& rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*
EOF

ARG PG_VERSION
ARG PG_VERSION_CLEAN
Expand All @@ -43,11 +49,15 @@ RUN tar jxf "postgresql-${PG_VERSION_CLEAN}.tar.bz2"
# apply optional patches that might be required for a successful testsuite
WORKDIR /build/postgresql-${PG_VERSION_CLEAN}/
COPY patches/ patches/
SHELL ["/bin/bash", "-c"]
RUN if [ -d "patches/${PG_VERSION_CLEAN}/" ]; \
then \
git apply patches/${PG_VERSION_CLEAN}/*.patch; \
fi;
RUN <<'EOF'
# apply postgres patches

set -eux
if [ -d "patches/${PG_VERSION_CLEAN}/" ];
then
git apply patches/${PG_VERSION_CLEAN}/*.patch;
fi;
EOF

WORKDIR /build/postgresql-${PG_VERSION_CLEAN}/build
RUN ../configure --prefix /usr/lib/postgresql/${PG_MAJOR}/
Expand All @@ -63,9 +73,9 @@ ARG PG_VERSION_CLEAN
ARG PG_MAJOR

COPY --from=dev-tools-builder \
/build/postgresql-${PG_VERSION_CLEAN}/build/src/test/isolation/pg_isolation_regress \
/build/postgresql-${PG_VERSION_CLEAN}/build/src/test/isolation/isolationtester \
build/postgresql-${PG_MAJOR}/build/src/test/isolation/
/build/postgresql-${PG_VERSION_CLEAN}/build/src/test/isolation/pg_isolation_regress \
/build/postgresql-${PG_VERSION_CLEAN}/build/src/test/isolation/isolationtester \
build/postgresql-${PG_MAJOR}/build/src/test/isolation/

# copy regress files in multiple layers as we only need a few
COPY --from=dev-tools-builder /build/postgresql-${PG_VERSION_CLEAN}/build/src/test/regress/regress.so usr/lib/postgresql/${PG_MAJOR}/lib/
Expand All @@ -77,9 +87,13 @@ FROM buildpack-deps:bullseye
# add unpriviliged user for tests
RUN useradd -ms /bin/bash circleci

RUN apt-get update \
RUN <<'EOF'
# install dependencies
&& apt-get install -y --no-install-recommends \
set -eux

apt-get update

apt-get install -y --no-install-recommends \
apt-transport-https \
autoconf \
build-essential \
Expand All @@ -106,8 +120,10 @@ RUN apt-get update \
locales \
make \
perl \

# clear apt cache
&& rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*
EOF

# install rust
RUN curl --proto '=https' --tlsv1.2 --silent --show-error https://sh.rustup.rs | sh -s -- -y
Expand All @@ -123,31 +139,39 @@ RUN locale-gen
# Add codeclimate
RUN curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > /usr/local/bin/cc-test-reporter && chmod +x /usr/local/bin/cc-test-reporter

# add postgres signing key
RUN curl -sf https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -

ARG PG_VERSION
ARG PG_MAJOR
ENV PG_VERSION=$PG_VERSION
ENV PG_MAJOR=$PG_MAJOR

# add postgres repository
RUN echo "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" >> /etc/apt/sources.list.d/postgresql.list \
&& echo "deb https://apt-archive.postgresql.org/pub/repos/apt bullseye-pgdg-archive main" >> /etc/apt/sources.list.d/postgresql.list \
&& apt-get update \
RUN <<'EOF'
# install postgres ecosystem for pg version: $PG_VERSION
set -eux

# install key and repositories
curl -sf https://www.postgresql.org/media/keys/ACCC4CF8.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add -
echo "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main" >> /etc/apt/sources.list.d/postgresql.list
echo "deb https://apt-archive.postgresql.org/pub/repos/apt bullseye-pgdg-archive main" >> /etc/apt/sources.list.d/postgresql.list

apt-get update

# infer the pgdgversion of postgres based on the $PG_VERSION
&& pgdg_version=$(apt list -a postgresql-server-dev-${PG_MAJOR} 2>/dev/null | grep "${PG_VERSION}" | awk '{print $2}' | head -n1 ) \
&& apt-get install -y --no-install-recommends --allow-downgrades \
pgdg_version=$(apt list -a postgresql-server-dev-${PG_MAJOR} 2>/dev/null | grep "${PG_VERSION}" | awk '{print $2}' | head -n1 )

apt-get install -y --no-install-recommends --allow-downgrades \
libdbi-perl \
libdbd-pg-perl \
libpq-dev=${pgdg_version} \
libpq5=${pgdg_version} \
postgresql-${PG_MAJOR}=${pgdg_version} \
postgresql-client-${PG_MAJOR}=${pgdg_version} \
postgresql-${PG_MAJOR}-dbgsym=${pgdg_version} \
postgresql-server-dev-${PG_MAJOR}=${pgdg_version} \
postgresql-${PG_MAJOR}-wal2json \
# clear apt cache
&& rm -rf /var/lib/apt/lists/*

# clear apt cache
rm -rf /var/lib/apt/lists/*
EOF

# add postgress to the path
ENV PATH=/usr/lib/postgresql/$PG_MAJOR/bin/:$PATH
Expand Down
Loading
Loading