Skip to content

Commit 74b440a

Browse files
committed
remove pg14 and 15 from docker flow. update some tests
1 parent 9322601 commit 74b440a

7 files changed

Lines changed: 35 additions & 205 deletions

File tree

docker

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 0ec73165f525a639830bb47c9cdbfa51c1c9a153

packaging_automation/publish_docker.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@ class DockerImageType(Enum):
2828
latest = 1
2929
alpine = 2
3030
nightly = 3
31-
postgres_14 = 4
32-
postgres_15 = 5
33-
postgres_16 = 6
34-
postgres_17 = 7
35-
postgres_18 = 8
31+
postgres_16 = 4
32+
postgres_17 = 5
33+
postgres_18 = 6
3634

3735

3836
class ManualTriggerType(Enum):
@@ -58,16 +56,6 @@ class ScheduleType(Enum):
5856
"docker-tag": "alpine",
5957
"schedule-type": ScheduleType.regular,
6058
},
61-
DockerImageType.postgres_14: {
62-
"file-name": "postgres-14/Dockerfile",
63-
"docker-tag": "pg14",
64-
"schedule-type": ScheduleType.regular,
65-
},
66-
DockerImageType.postgres_15: {
67-
"file-name": "postgres-15/Dockerfile",
68-
"docker-tag": "pg15",
69-
"schedule-type": ScheduleType.regular,
70-
},
7159
DockerImageType.postgres_16: {
7260
"file-name": "postgres-16/Dockerfile",
7361
"docker-tag": "pg16",

packaging_automation/templates/docker/postgres-14/postgres-14.tmpl.dockerfile

Lines changed: 0 additions & 42 deletions
This file was deleted.

packaging_automation/templates/docker/postgres-15/postgres-15.tmpl.dockerfile

Lines changed: 0 additions & 42 deletions
This file was deleted.

packaging_automation/tests/test_publish_docker.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
publish_nightly_docker_image,
1717
)
1818

19-
NON_DEFAULT_BRANCH_NAME = "12.0.0_test"
19+
NON_DEFAULT_BRANCH_NAME = "13.2.0_test"
2020
DEFAULT_BRANCH_NAME = "master"
21-
TAG_NAME = "v12.0.0"
22-
INVALID_TAG_NAME = "v12.x"
21+
TAG_NAME = "v13.2.0"
22+
INVALID_TAG_NAME = "v13.x"
2323
DOCKER_IMAGE_NAME = "citusdata/citus"
2424
docker_client = docker.from_env()
2525

@@ -49,8 +49,8 @@ def test_decode_tag_parts():
4949
tag_parts = decode_tag_parts(TAG_NAME)
5050
assert (
5151
len(tag_parts) == 3
52-
and tag_parts[0] == "12"
53-
and tag_parts[1] == "0"
52+
and tag_parts[0] == "13"
53+
and tag_parts[1] == "2"
5454
and tag_parts[2] == "0"
5555
)
5656

@@ -60,12 +60,12 @@ def test_decode_tag_parts():
6060

6161
def test_get_image_tag():
6262
image_name = get_image_tag(remove_prefix(TAG_NAME, "v"), DockerImageType.latest)
63-
assert image_name == "12.0.0"
63+
assert image_name == "13.2.0"
6464

6565
image_name = get_image_tag(
66-
remove_prefix(TAG_NAME, "v"), DockerImageType.postgres_15
66+
remove_prefix(TAG_NAME, "v"), DockerImageType.postgres_16
6767
)
68-
assert image_name == "12.0.0-pg15"
68+
assert image_name == "13.2.0-pg16"
6969

7070

7171
def test_publish_main_docker_images():
@@ -86,10 +86,10 @@ def test_publish_tagged_docker_images_latest():
8686
os.chdir("docker")
8787
try:
8888
run_with_output("git checkout -b docker-unit-test")
89-
publish_tagged_docker_images(DockerImageType.latest, "v12.0.0", False)
90-
docker_client.images.get("citusdata/citus:12")
91-
docker_client.images.get("citusdata/citus:12.0")
92-
docker_client.images.get("citusdata/citus:12.0.0")
89+
publish_tagged_docker_images(DockerImageType.postgres_17, "v13.2.0", False)
90+
docker_client.images.get("citusdata/citus:13-pg17")
91+
docker_client.images.get("citusdata/citus:13.2-pg17")
92+
docker_client.images.get("citusdata/citus:13.2.0-pg17")
9393
finally:
9494
run_with_output("git checkout master")
9595
run_with_output("git branch -D docker-unit-test")
@@ -101,9 +101,9 @@ def test_publish_tagged_docker_images_alpine():
101101
try:
102102
run_with_output("git checkout -b docker-unit-test")
103103
publish_tagged_docker_images(DockerImageType.alpine, TAG_NAME, False)
104-
docker_client.images.get("citusdata/citus:12-alpine")
105-
docker_client.images.get("citusdata/citus:12.0-alpine")
106-
docker_client.images.get("citusdata/citus:12.0.0-alpine")
104+
docker_client.images.get("citusdata/citus:13-alpine")
105+
docker_client.images.get("citusdata/citus:13.2-alpine")
106+
docker_client.images.get("citusdata/citus:13.2.0-alpine")
107107
finally:
108108
run_with_output("git checkout master")
109109
run_with_output("git branch -D docker-unit-test")

packaging_automation/tests/test_update_docker.py

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,20 @@
99
DEFAULT_ENCODING_FOR_FILE_HANDLING,
1010
DEFAULT_UNICODE_ERROR_HANDLER,
1111
)
12-
from dotenv import dotenv_values
1312
from ..update_docker import (
1413
update_docker_file_for_latest_postgres,
1514
update_regular_docker_compose_file,
1615
update_docker_file_alpine,
17-
update_docker_file_for_postgres15,
18-
update_docker_file_for_postgres14,
16+
update_docker_file_for_postgres16,
1917
update_changelog,
2018
)
19+
from dotenv import dotenv_values
2120

2221
BASE_PATH = os.getenv("BASE_PATH", default=pathlib2.Path(__file__).parents[2])
2322
TEST_BASE_PATH = f"{BASE_PATH}/docker"
2423
PROJECT_VERSION = "12.0.0"
2524

26-
POSTGRES_15_VERSION = "15.4"
27-
POSTGRES_14_VERSION = "14.9"
25+
POSTGRES_16_VERSION = "16.4"
2826

2927
PROJECT_NAME = "citus"
3028
version_details = get_version_details(PROJECT_VERSION)
@@ -45,7 +43,7 @@ def teardown_module():
4543

4644
def test_update_docker_file_for_latest_postgres():
4745
update_docker_file_for_latest_postgres(
48-
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_14_VERSION
46+
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_16_VERSION
4947
)
5048
with open(
5149
f"{TEST_BASE_PATH}/Dockerfile",
@@ -55,7 +53,7 @@ def test_update_docker_file_for_latest_postgres():
5553
) as reader:
5654
content = reader.read()
5755
lines = content.splitlines()
58-
assert lines[2].strip() == f"FROM postgres:{POSTGRES_14_VERSION}"
56+
assert lines[2].strip() == f"FROM postgres:{POSTGRES_16_VERSION}"
5957
assert lines[3].strip() == f"ARG VERSION={PROJECT_VERSION}"
6058
assert (
6159
f"postgresql-$PG_MAJOR-{PROJECT_NAME}-"
@@ -83,7 +81,7 @@ def test_update_regular_docker_compose_file():
8381

8482
def test_update_docker_file_alpine():
8583
update_docker_file_alpine(
86-
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_14_VERSION
84+
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_16_VERSION
8785
)
8886
with open(
8987
f"{TEST_BASE_PATH}/alpine/Dockerfile",
@@ -93,46 +91,24 @@ def test_update_docker_file_alpine():
9391
) as reader:
9492
content = reader.read()
9593
lines = content.splitlines()
96-
assert lines[2].strip() == f"FROM postgres:{POSTGRES_14_VERSION}-alpine"
94+
assert lines[2].strip() == f"FROM postgres:{POSTGRES_16_VERSION}-alpine"
9795
assert lines[3].strip() == f"ARG VERSION={PROJECT_VERSION}"
9896
assert len(lines) == 58
9997

10098

101-
def test_update_docker_file_for_postgres14():
102-
update_docker_file_for_postgres14(
103-
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_14_VERSION
104-
)
105-
with open(
106-
f"{TEST_BASE_PATH}/postgres-14/Dockerfile",
107-
"r",
108-
encoding=DEFAULT_ENCODING_FOR_FILE_HANDLING,
109-
errors=DEFAULT_UNICODE_ERROR_HANDLER,
110-
) as reader:
111-
content = reader.read()
112-
lines = content.splitlines()
113-
assert lines[2].strip() == f"FROM postgres:{POSTGRES_14_VERSION}"
114-
assert lines[3].strip() == f"ARG VERSION={PROJECT_VERSION}"
115-
assert (
116-
f"postgresql-$PG_MAJOR-{PROJECT_NAME}-"
117-
f"{version_details['major']}.{version_details['minor']}=$CITUS_VERSION"
118-
in lines[21]
119-
)
120-
assert len(lines) == 42
121-
122-
123-
def test_update_docker_file_for_postgres15():
124-
update_docker_file_for_postgres15(
125-
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_15_VERSION
99+
def test_update_docker_file_for_postgres16():
100+
update_docker_file_for_postgres16(
101+
PROJECT_VERSION, TEMPLATE_PATH, TEST_BASE_PATH, POSTGRES_16_VERSION
126102
)
127103
with open(
128-
f"{TEST_BASE_PATH}/postgres-15/Dockerfile",
104+
f"{TEST_BASE_PATH}/postgres-16/Dockerfile",
129105
"r",
130106
encoding=DEFAULT_ENCODING_FOR_FILE_HANDLING,
131107
errors=DEFAULT_UNICODE_ERROR_HANDLER,
132108
) as reader:
133109
content = reader.read()
134110
lines = content.splitlines()
135-
assert lines[2].strip() == f"FROM postgres:{POSTGRES_15_VERSION}"
111+
assert lines[2].strip() == f"FROM postgres:{POSTGRES_16_VERSION}"
136112
assert lines[3].strip() == f"ARG VERSION={PROJECT_VERSION}"
137113
assert (
138114
f"postgresql-$PG_MAJOR-{PROJECT_NAME}-"
@@ -177,5 +153,4 @@ def test_update_changelog_without_postgres():
177153

178154
def test_pkgvar_postgres_version_existence():
179155
config = dotenv_values(PKGVARS_FILE)
180-
assert config["postgres_15_version"]
181-
assert config["postgres_14_version"]
156+
assert config["postgres_16_version"]

0 commit comments

Comments
 (0)