Skip to content

Commit

Permalink
Fixes publish_docker
Browse files Browse the repository at this point in the history
  • Loading branch information
gurkanindibay committed Sep 21, 2023
1 parent 2097399 commit 4b5e48e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions packaging_automation/publish_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class DockerImageType(Enum):
latest = 1
alpine = 2
nightly = 3
postgres_13 = 4
postgres_14 = 5
postgres_14 = 4
postgres_15 = 5


class ManualTriggerType(Enum):
Expand All @@ -55,16 +55,16 @@ class ScheduleType(Enum):
"docker-tag": "alpine",
"schedule-type": ScheduleType.regular,
},
DockerImageType.postgres_13: {
"file-name": "postgres-13/Dockerfile",
"docker-tag": "pg13",
"schedule-type": ScheduleType.regular,
},
DockerImageType.postgres_14: {
"file-name": "postgres-14/Dockerfile",
"docker-tag": "pg14",
"schedule-type": ScheduleType.regular,
},
DockerImageType.postgres_15: {
"file-name": "postgres-15/Dockerfile",
"docker-tag": "pg15",
"schedule-type": ScheduleType.regular,
},
DockerImageType.nightly: {
"file-name": "nightly/Dockerfile",
"docker-tag": "nightly",
Expand Down
28 changes: 14 additions & 14 deletions packaging_automation/tests/test_publish_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

NON_DEFAULT_BRANCH_NAME = "10.0.3_test"
DEFAULT_BRANCH_NAME = "master"
TAG_NAME = "v10.0.3"
INVALID_TAG_NAME = "v10.x"
TAG_NAME = "v12.0.0"
INVALID_TAG_NAME = "v12.x"
DOCKER_IMAGE_NAME = "citusdata/citus"
docker_client = docker.from_env()

Expand Down Expand Up @@ -49,9 +49,9 @@ def test_decode_tag_parts():
tag_parts = decode_tag_parts(TAG_NAME)
assert (
len(tag_parts) == 3
and tag_parts[0] == "10"
and tag_parts[0] == "12"
and tag_parts[1] == "0"
and tag_parts[2] == "3"
and tag_parts[2] == "0"
)

with pytest.raises(ValueError):
Expand All @@ -60,12 +60,12 @@ def test_decode_tag_parts():

def test_get_image_tag():
image_name = get_image_tag(remove_prefix(TAG_NAME, "v"), DockerImageType.latest)
assert image_name == "10.0.3"
assert image_name == "12.0.0"

image_name = get_image_tag(
remove_prefix(TAG_NAME, "v"), DockerImageType.postgres_13
remove_prefix(TAG_NAME, "v"), DockerImageType.postgres_15
)
assert image_name == "10.0.3-pg13"
assert image_name == "12.0.0-pg15"


def test_publish_main_docker_images():
Expand All @@ -86,10 +86,10 @@ def test_publish_tagged_docker_images_latest():
os.chdir("docker")
try:
run_with_output("git checkout -b docker-unit-test")
publish_tagged_docker_images(DockerImageType.latest, "v10.0.3", False)
docker_client.images.get("citusdata/citus:10")
docker_client.images.get("citusdata/citus:10.0")
docker_client.images.get("citusdata/citus:10.0.3")
publish_tagged_docker_images(DockerImageType.latest, "v12.0.0", False)
docker_client.images.get("citusdata/citus:12")
docker_client.images.get("citusdata/citus:12.0")
docker_client.images.get("citusdata/citus:12.0.0")
finally:
run_with_output("git checkout master")
run_with_output("git branch -D docker-unit-test")
Expand All @@ -101,9 +101,9 @@ def test_publish_tagged_docker_images_alpine():
try:
run_with_output("git checkout -b docker-unit-test")
publish_tagged_docker_images(DockerImageType.alpine, TAG_NAME, False)
docker_client.images.get("citusdata/citus:10-alpine")
docker_client.images.get("citusdata/citus:10.0-alpine")
docker_client.images.get("citusdata/citus:10.0.3-alpine")
docker_client.images.get("citusdata/citus:12-alpine")
docker_client.images.get("citusdata/citus:12.0-alpine")
docker_client.images.get("citusdata/citus:12.0.0-alpine")
finally:
run_with_output("git checkout master")
run_with_output("git branch -D docker-unit-test")
Expand Down

0 comments on commit 4b5e48e

Please sign in to comment.