Repository: cloud-custodian/cloud-custodian

Issue:
ACTION REQUIRED: Changes to pulling Chainguard Images
Hey there [Chainguard](https://github.com/chainguard-dev) here.

We noticed that you are using [Chainguard Images](https://github.com/chainguard-images/images), thank you! We wanted to make you aware of an upcoming change that will impact your project.

Starting August 16, 2023 public users will no longer be able to pull images from our registry (cgr.dev/chainguard) by tags other than `latest` or `latest-dev`. Please see [the announcement](https://www.chainguard.dev/unchained/scaling-chainguard-images-with-a-growing-catalog-and-proactive-security-updates) for more information.

You are currently using the following.



In https://github.com/cloud-custodian/cloud-custodian/blob/354954a6a8843d071a31e9efa2ca846b6477236e/docker/c7n-left:

- cgr.dev/chainguard/python:3.11-dev

- cgr.dev/chainguard/python:3.11



Our goal is to prevent your project from experiencing any disruptions. Please see [the migration guide](https://www.chainguard.dev/unchained/a-guide-on-how-to-use-chainguard-images-for-public-catalog-tier-users) for options.

If there's more we can do to help please reply to this issue or email us at [support@chainguard.dev](mailto:support@chainguard.dev).

Thank you!

<!-- x-chainguard-id: cgr-auth-note-1 -->



Discussion:

Resolving patch:
diff --git a/tools/dev/dockerpkg.py b/tools/dev/dockerpkg.py
--- a/tools/dev/dockerpkg.py
+++ b/tools/dev/dockerpkg.py
@@ -60,9 +60,9 @@
     [PHASE_2_INSTALL_TMPL.format(pkg=pkg) for pkg in default_providers]
 )
 
-BUILD_STAGE = """\
-# Dockerfiles are generated from tools/dev/dockerpkg.py
 
+BOOTSTRAP_STAGE = """\
+# Dockerfiles are generated from tools/dev/dockerpkg.py
 FROM {base_build_image} as build-env
 
 ARG POETRY_VERSION="1.5.1"
@@ -73,10 +73,27 @@
 RUN apt-get --yes update
 RUN apt-get --yes install --no-install-recommends build-essential curl python3-venv python3-dev
 RUN python3 -m venv /usr/local
-RUN curl -sSL https://install.python-poetry.org | python3 - -y --version {poetry_version}
+RUN /usr/local/bin/pip install -U pip setuptools && \
+    /usr/local/bin/pip install "poetry=={poetry_version}"
 ARG PATH="/root/.local/bin:$PATH"
+
 WORKDIR /src
+"""
+
+LEFT_BUILD_STAGE = BOOTSTRAP_STAGE + """\
+ADD pyproject.toml poetry.lock README.md /src
+RUN . /usr/local/bin/activate && poetry install --without dev --no-root
+
+ADD c7n /src/c7n/
+RUN . /usr/local/bin/activate && poetry install --only-root
+
+ADD tools/c7n_left /src/tools/c7n_left
+RUN . /usr/local/bin/activate && cd tools/c7n_left && poetry install --without dev
 
+RUN mkdir /output
+"""
+
+BUILD_STAGE = BOOTSTRAP_STAGE + """\
 # Add core & aws packages
 ADD pyproject.toml poetry.lock README.md /src/
 RUN . /usr/local/bin/activate && pip install -qU pip wheel aws-xray-sdk psutil jsonpatch
@@ -108,7 +125,7 @@
 ENV DEBIAN_FRONTEND=noninteractive
 
 RUN apt-get --yes update \\
-        && apt-get --yes install python3 python3-venv --no-install-recommends \\
+        && apt-get --yes install python3 python3-venv {packages} --no-install-recommends \\
         && rm -Rf /var/cache/apt \\
         && rm -Rf /var/lib/apt/lists/* \\
         && rm -Rf /var/log/*
@@ -157,6 +174,12 @@
 LABEL "org.opencontainers.image.documentation"="https://cloudcustodian.io/docs"
 """
 
+TARGET_LEFT = """
+LABEL "org.opencontainers.image.title"="left"
+LABEL "org.opencontainers.image.description"="Cloud Custodian IaC Engine"
+LABEL "org.opencontainers.image.documentation"="https://cloudcustodian.io/docs/tools/c7n-left.html"
+"""
+
 BUILD_KUBE = """\
 # Install c7n-kube
 ADD tools/c7n_kube /src/tools/c7n_kube
@@ -213,6 +236,7 @@ class Image:
         base_build_image="ubuntu:22.04",
         base_target_image="ubuntu:22.04",
         poetry_version="${POETRY_VERSION}",
+        packages="",
         providers=" ".join(default_providers),
         PHASE_1_PKG_INSTALL_DEP=PHASE_1_PKG_INSTALL_DEP,
         PHASE_2_PKG_INSTALL_ROOT=PHASE_2_PKG_INSTALL_ROOT,
@@ -256,6 +280,17 @@ def clone(self, metadata, target=None):
         build=[BUILD_STAGE],
         target=[TARGET_UBUNTU_STAGE, TARGET_CLI],
     ),
+    "docker/c7n-left": Image(
+        dict(
+            name="left",
+            repo="c7n",
+            description="Cloud Custodian IaC Governance",
+            entrypoint="/usr/local/bin/c7n-left",
+            packages="git"
+        ),
+        build=[LEFT_BUILD_STAGE],
+        target=[TARGET_UBUNTU_STAGE, TARGET_LEFT],
+    ),
     "docker/c7n-kube": Image(
         dict(
             name="kube",
@@ -609,6 +644,7 @@ def build_image(client, image_name, image_def, dfile_path, build_args):
 def generate():
     """Generate dockerfiles"""
     for df_path, image in ImageMap.items():
+        print(df_path)
         p = Path(df_path)
         p.write_text(image.render())
 


Test patch: