From 0944838a7877d4d5f28b1693da2a58ce9db2dd36 Mon Sep 17 00:00:00 2001 From: Claudiu Belu Date: Mon, 22 Jul 2024 18:51:22 +0300 Subject: [PATCH] Adds contour 1.26.1 and 1.22.3 rocks (#7) The mentioned rock versions do not include procps, as it isn't included in the original project's Dockerfile (they're scratch-based images). --- 1.22.3/rockcraft.yaml | 44 +++++++++++++++++++++++++++++++ 1.26.1/rockcraft.yaml | 44 +++++++++++++++++++++++++++++++ tests/integration/test_contour.py | 10 +++---- tests/sanity/test_rock.py | 16 ++++++----- tests/tox.ini | 2 ++ 5 files changed, 104 insertions(+), 12 deletions(-) create mode 100644 1.22.3/rockcraft.yaml create mode 100644 1.26.1/rockcraft.yaml diff --git a/1.22.3/rockcraft.yaml b/1.22.3/rockcraft.yaml new file mode 100644 index 0000000..42e1a74 --- /dev/null +++ b/1.22.3/rockcraft.yaml @@ -0,0 +1,44 @@ +name: contour +base: bare +build-base: ubuntu@22.04 +license: Apache-2.0 + +version: '1.22.3' +summary: Contour is an open source Kubernetes ingress controller. +description: | + Contour is an open source Kubernetes ingress controller that works by deploying + the Envoy proxy as a reverse proxy and load balancer. + Overview of Contour Trademarks: This software listing is packaged by Bitnami. + The respective trademarks mentioned in the offering are owned by the respective companies, + and use of them does not imply any affiliation or endorsement. +platforms: + amd64: + arm64: + + +services: + contour: + override: replace + summary: "contour service" + startup: enabled + command: "contour [ -h ]" + on-failure: shutdown + +entrypoint-service: contour + + +parts: + contour: + plugin: nil + source: https://github.com/projectcontour/contour.git + source-type: git + source-tag: v${CRAFT_PROJECT_VERSION} + source-depth: 1 + build-snaps: + - go/1.19/stable + build-environment: + - GOARCH: $CRAFT_ARCH_BUILD_FOR + override-build: | + make build + mkdir -p "${CRAFT_PART_INSTALL}/bin" + cp contour "${CRAFT_PART_INSTALL}/bin/" diff --git a/1.26.1/rockcraft.yaml b/1.26.1/rockcraft.yaml new file mode 100644 index 0000000..0c6c484 --- /dev/null +++ b/1.26.1/rockcraft.yaml @@ -0,0 +1,44 @@ +name: contour +base: bare +build-base: ubuntu@22.04 +license: Apache-2.0 + +version: '1.26.1' +summary: Contour is an open source Kubernetes ingress controller. +description: | + Contour is an open source Kubernetes ingress controller that works by deploying + the Envoy proxy as a reverse proxy and load balancer. + Overview of Contour Trademarks: This software listing is packaged by Bitnami. + The respective trademarks mentioned in the offering are owned by the respective companies, + and use of them does not imply any affiliation or endorsement. +platforms: + amd64: + arm64: + + +services: + contour: + override: replace + summary: "contour service" + startup: enabled + command: "contour [ -h ]" + on-failure: shutdown + +entrypoint-service: contour + + +parts: + contour: + plugin: nil + source: https://github.com/projectcontour/contour.git + source-type: git + source-tag: v${CRAFT_PROJECT_VERSION} + source-depth: 1 + build-snaps: + - go/1.20/stable + build-environment: + - GOARCH: $CRAFT_ARCH_BUILD_FOR + override-build: | + make build + mkdir -p "${CRAFT_PART_INSTALL}/bin" + cp contour "${CRAFT_PART_INSTALL}/bin/" diff --git a/tests/integration/test_contour.py b/tests/integration/test_contour.py index 798d49d..fd2a72e 100644 --- a/tests/integration/test_contour.py +++ b/tests/integration/test_contour.py @@ -10,7 +10,7 @@ from pathlib import Path from k8s_test_harness import harness -from k8s_test_harness.util import exec_util, k8s_util +from k8s_test_harness.util import env_util, exec_util, k8s_util pytest_plugins = ["k8s_test_harness.plugin"] @@ -24,12 +24,12 @@ def test_integration_contour(module_instance: harness.Instance): - image_name_env_variable = "ROCK_CONTOUR" - - image_uri = os.getenv(image_name_env_variable) - assert image_uri is not None, f"{image_name_env_variable} is not set" + contour_rock = env_util.get_build_meta_info_for_rock_version( + "contour", "1.28.2", "amd64" + ) # This helm chart requires the registry to be separated from the image. + image_uri = contour_rock.image registry = "docker.io" parts = image_uri.split("/") if len(parts) > 1: diff --git a/tests/sanity/test_rock.py b/tests/sanity/test_rock.py index c848a83..796968a 100644 --- a/tests/sanity/test_rock.py +++ b/tests/sanity/test_rock.py @@ -2,16 +2,18 @@ # Copyright 2024 Canonical, Ltd. # See LICENSE file for licensing details # -import os -from k8s_test_harness.util import docker_util +import pytest +from k8s_test_harness.util import docker_util, env_util -def test_sanity(): - image_variable = "ROCK_CONTOUR" - entrypoint = "contour" - image = os.getenv(image_variable) - assert image is not None, f"${image_variable} is not set" +@pytest.mark.parametrize("image_version", ("1.28.2", "1.26.1", "1.22.3")) +def test_sanity(image_version): + rock = env_util.get_build_meta_info_for_rock_version( + "contour", image_version, "amd64" + ) + image = rock.image + entrypoint = "contour" process = docker_util.run_in_docker(image, [entrypoint, "--help"], False) assert "Contour Kubernetes ingress controller." in process.stderr diff --git a/tests/tox.ini b/tests/tox.ini index a038b15..b0dcfc4 100644 --- a/tests/tox.ini +++ b/tests/tox.ini @@ -44,6 +44,7 @@ commands = pass_env = TEST_* ROCK_* + BUILT_ROCKS_METADATA [testenv:integration] description = Run integration tests @@ -60,6 +61,7 @@ commands = pass_env = TEST_* ROCK_* + BUILT_ROCKS_METADATA [flake8]