Skip to content

Commit 7eff9f2

Browse files
authored
Merge branch 'cloudnative-pg:main' into feat/wal2json
2 parents 06c772d + 1a93a00 commit 7eff9f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4504
-4830
lines changed

.github/generate-strategy.sh

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
#
99
set -eu
1010

11+
ROOT_DIR=$(cd "$(dirname "$0")/../"; pwd)
12+
source "${ROOT_DIR}/lib/repo_funcs.sh"
13+
1114
# Define an optional aliases for some major versions
1215
declare -A aliases=(
13-
[16]='latest'
16+
[$POSTGRESQL_LATEST_MAJOR_RELEASE]='latest'
1417
)
1518

1619
# Define the current default distribution
@@ -66,13 +69,18 @@ generator() {
6669

6770
# Additional aliases in case we are running in the default distro
6871
# i.e. "14", "14.2", "14.2-1", "latest"
69-
if [ "${distro}" == "${DEFAULT_DISTRO}" ]; then
72+
if [[ "${distro}" == "${DEFAULT_DISTRO}" ]]; then
7073
versionAliases+=(
71-
"$version"
7274
"${postgresImageVersion}"
7375
"${postgresImageVersion}-${releaseVersion}"
7476
${aliases[$version]:+"${aliases[$version]}"}
7577
)
78+
# Create a tag with just the major (e.g "14") only for stable versions
79+
if [[ "${version}" -le "${POSTGRESQL_LATEST_MAJOR_RELEASE}" ]]; then
80+
versionAliases+=(
81+
"$version"
82+
)
83+
fi
7684
fi
7785

7886
# Supported platforms for container images

.github/workflows/build.yml

+33-3
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,29 @@ jobs:
7272
username: ${{ github.actor }}
7373
password: ${{ secrets.GITHUB_TOKEN }}
7474

75+
# When publishing new images from main, we should not overwrite an existing
76+
# tag in order to guarantee the tag's SHA digest consistency.
77+
- name: Verify primary tag is not overwritten
78+
run: |
79+
echo "MISSING_TAG=false" >> $GITHUB_ENV
80+
# if we are not on the main branch, always push
81+
if [ "${GITHUB_REF#refs/heads/}" != main ]; then
82+
echo "MISSING_TAG=true" >> $GITHUB_ENV
83+
exit 0
84+
fi
85+
IMAGE="${IMAGE_RELEASE}:${{ matrix.fullTag }}"
86+
# If the primary tag already exists, skip the building phase
87+
if skopeo inspect docker://${IMAGE} >/dev/null 2>/dev/null; then
88+
echo "Image ${IMAGE} already exists"
89+
# We still need to grab the digest to build the imageCatalog
90+
echo "OLD_DIGEST=$(skopeo inspect docker://${IMAGE} --format '{{ .Digest }}')" >> $GITHUB_ENV
91+
else
92+
echo "MISSING_TAG=true" >> $GITHUB_ENV
93+
fi
94+
7595
- name: Build and load
76-
uses: docker/build-push-action@v5
96+
uses: docker/build-push-action@v6
97+
if: ${{ env.MISSING_TAG == 'true' }}
7798
with:
7899
context: ${{ matrix.dir }}
79100
file: ${{ matrix.file }}
@@ -83,6 +104,7 @@ jobs:
83104

84105
- name: Dockle scan
85106
uses: erzz/dockle-action@v1
107+
if: ${{ env.MISSING_TAG == 'true' }}
86108
with:
87109
image: "${{ env.IMAGE_STAGING }}:${{ matrix.tags[0] }}"
88110
exit-code: '1'
@@ -92,6 +114,7 @@ jobs:
92114

93115
- name: Run Snyk to check Docker image for vulnerabilities
94116
uses: snyk/actions/docker@master
117+
if: ${{ env.MISSING_TAG == 'true' }}
95118
continue-on-error: true
96119
env:
97120
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
@@ -101,13 +124,15 @@ jobs:
101124

102125
- name: Upload result to GitHub Code Scanning
103126
uses: github/codeql-action/upload-sarif@v3
127+
if: ${{ env.MISSING_TAG == 'true' }}
104128
continue-on-error: true
105129
with:
106130
sarif_file: snyk.sarif
107131

108132
- name: Build and push
109133
id: build
110-
uses: docker/build-push-action@v5
134+
uses: docker/build-push-action@v6
135+
if: ${{ env.MISSING_TAG == 'true' }}
111136
with:
112137
context: ${{ matrix.dir }}
113138
file: ${{ matrix.file }}
@@ -123,7 +148,12 @@ jobs:
123148
BASE_IMAGE=${IMAGE_RELEASE}
124149
fi
125150
126-
IMAGE=${BASE_IMAGE}:${{ matrix.fullTag }}@${{ steps.build.outputs.digest }} \
151+
DIGEST="${{ steps.build.outputs.digest }}"
152+
if [[ "${{ env.MISSING_TAG }}" == "false" ]]; then
153+
DIGEST="${{ env.OLD_DIGEST }}"
154+
fi
155+
156+
IMAGE=${BASE_IMAGE}:${{ matrix.fullTag }}@${DIGEST} \
127157
MAJOR=${{ matrix.version }} \
128158
yq --null-input '{
129159
"apiVersion": "postgresql.cnpg.io/v1",

.github/workflows/update.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Automatic Updates
22

33
on:
44
schedule:
5-
- cron: 0 0 * * *
5+
- cron: 0 0 * * 1
66
workflow_dispatch:
77

88
defaults:

Debian/12/bookworm/.versions.json

-6
This file was deleted.

Debian/12/bookworm/requirements.txt

-544
This file was deleted.

Debian/12/bullseye/.versions.json

-6
This file was deleted.

Debian/12/bullseye/requirements.txt

-544
This file was deleted.

Debian/13/bookworm/.versions.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"BARMAN_VERSION": "3.10.0",
3-
"IMAGE_RELEASE_VERSION": "1",
4-
"POSTGRES_IMAGE_LAST_UPDATED": "2024-05-15T17:08:55.965329Z",
5-
"POSTGRES_IMAGE_VERSION": "13.15-bookworm"
2+
"BARMAN_VERSION": "3.12.1",
3+
"IMAGE_RELEASE_VERSION": "29",
4+
"POSTGRES_IMAGE_LAST_UPDATED": "2024-12-25T12:08:00.06375Z",
5+
"POSTGRES_IMAGE_VERSION": "13.18-bookworm"
66
}

Debian/13/bookworm/Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17-
FROM postgres:13.15-bookworm
17+
FROM postgres:13.18-bookworm
1818

1919
# Do not split the description, otherwise we will see a blank space in the labels
2020
LABEL name="PostgreSQL Container Images" \
2121
vendor="The CloudNativePG Contributors" \
2222
version="${PG_VERSION}" \
23-
release="1" \
23+
release="29" \
2424
summary="PostgreSQL Container images." \
25-
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 13.15-bookworm."
25+
description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 13.18-bookworm."
2626

27-
LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 13.15-bookworm."
27+
LABEL org.opencontainers.image.description="This Docker image contains PostgreSQL and Barman Cloud based on Postgres 13.18-bookworm."
2828

2929
COPY requirements.txt /
3030

@@ -48,7 +48,7 @@ RUN set -xe; \
4848
python3-setuptools \
4949
; \
5050
pip3 install --break-system-packages --upgrade pip; \
51-
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
51+
# TODO: Remove --no-deps once https://github.com/pypa/pip/issues/9644 is solved
5252
pip3 install --break-system-packages --no-deps -r requirements.txt; \
5353
rm -rf /var/lib/apt/lists/*;
5454

0 commit comments

Comments
 (0)