From 9d8a05a2cc58f86732a80042cac7feae0d456248 Mon Sep 17 00:00:00 2001 From: Webster Mudge Date: Mon, 20 May 2024 12:25:53 -0400 Subject: [PATCH 1/5] * Update base image reference and image labels and build args * Update README with additional details for new image naming scheme * Update license date * Move PROFILE prefix to append to image name and update REPLACEMENT_IMAGE to use similar for base image Signed-off-by: Webster Mudge --- .github/workflows/build_push_image.yml | 10 +++++----- LICENSE | 2 +- README.md | 12 +++++++----- aws/execution-environment.yml | 6 +++--- azure/execution-environment.yml | 6 +++--- base/execution-environment.yml | 4 ++-- full/execution-environment.yml | 6 +++--- gcp/execution-environment.yml | 6 +++--- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build_push_image.yml b/.github/workflows/build_push_image.yml index 564e0fa..c24e665 100644 --- a/.github/workflows/build_push_image.yml +++ b/.github/workflows/build_push_image.yml @@ -55,16 +55,16 @@ jobs: uses: docker/metadata-action@v4 with: images: | - ghcr.io/${{ github.repository }} + ghcr.io/${{ github.repository }}-${{ inputs.PROFILE }} flavor: | latest=auto - prefix=${{ inputs.PROFILE }}-,onlatest=true + prefix=onlatest=true tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=ref,event=branch type=ref,event=pr - type=sha,prefix=${{ inputs.PROFILE }}- + type=sha - name: Construct short SHA id: sha @@ -73,9 +73,9 @@ jobs: - name: Update container base image reference if: ${{ inputs.PROFILE != 'base' }} env: - REPLACEMENT_IMAGE: ${{ github.repository }}:base-${{ steps.sha.outputs.sha-short }} + REPLACEMENT_IMAGE: ${{ github.repository }}-base:${{ steps.sha.outputs.sha-short }} run: - sed -i 's|cloudera-labs/cldr-runner:base-latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml + sed -i 's|cloudera-labs/cldr-runner-base:latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml - name: Create builder context run: | diff --git a/LICENSE b/LICENSE index f0f086c..2a1cff7 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2023 Cloudera, Inc. + Copyright 2024 Cloudera, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index e8f7375..5afe527 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Specifically, the project consists of `execution-environment.yml` configuration files and other supporting assets that power [`ansible-builder`](https://ansible.readthedocs.io/projects/builder/en/latest/). The configurations encapsulate the necessary Ansible collections and roles, Python libraries, and system applications to work with Cloudera's products and cloud providers. Moreover, the resulting images have the needed tooling for managing infrastructure if so requested. -`cldr-runner` builds several variations: +`cldr-runner` builds several profiles: | Tag | Description | |-----|-------------| @@ -16,6 +16,8 @@ Specifically, the project consists of `execution-environment.yml` configuration | [gcp](gcp/execution-environment.yml) | `base` plus GCP-specific collections and dependencies, including the `gcloud` CLI | | [full](full/execution-environment.yml) | All of the above, plus additional CLI tools for in-container usage, e.g. `git`, `vim`, `nano`, `tree`, `kubectl` | +Each image is tagged `cloudera-labs/cldr-runner-:`. + # Quickstart `cldr-runner` is designed to run with `ansible-navigator` and other _Execution Environment_-based tools. You might want to [install `ansible-navigator`](NAVIGATOR.md) before delving deeper. @@ -52,7 +54,7 @@ ansible-navigator: execution-environment: container-engine: docker enabled: True - image: ghcr.io/cloudera-labs/cldr-runner:aws-latest + image: ghcr.io/cloudera-labs/cldr-runner-aws:latest pull: policy: missing ``` @@ -78,7 +80,7 @@ Once defined, the EE can be used by Job Templates, Container Groups, etc. You can run the container directly in `docker` (or `podman`): ```bash -docker run -it ghcr.io/cloudera-labs/cldr-runner:aws-latest /bin/bash +docker run -it ghcr.io/cloudera-labs/cldr-runner-aws:latest /bin/bash ``` Take care to assemble and mount the needed directories other supporting assets; the image is based on [`ansible-runner`](https://ansible.readthedocs.io/projects/runner/en/stable/) (as are all Execution Environments) and runs as such. @@ -121,7 +123,7 @@ version: 3 images: base_image: - name: ghcr.io/cloudera-labs/cldr-runner:aws-latest + name: ghcr.io/cloudera-labs/cldr-runner-aws:latest dependencies: galaxy: @@ -209,7 +211,7 @@ Follow these steps to set up a local environment: # License and Copyright -Copyright 2023, Cloudera, Inc. +Copyright 2024, Cloudera, Inc. ``` Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/aws/execution-environment.yml b/aws/execution-environment.yml index 3d07eee..96d6791 100644 --- a/aws/execution-environment.yml +++ b/aws/execution-environment.yml @@ -20,7 +20,7 @@ version: 3 images: base_image: - name: ghcr.io/cloudera-labs/cldr-runner:base-latest + name: ghcr.io/cloudera-labs/cldr-runner-base:latest dependencies: galaxy: requirements.yml @@ -31,13 +31,13 @@ additional_build_steps: # See https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html # See https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#cliv2-linux-install prepend_final: - - ARG BUILD_VER="aws-latest" + - ARG BUILD_VER="latest" - ARG BUILD_DATE="unknown" - ARG BUILD_REVISION="unknown" - ENV BUILD_VER="${BUILD_VER}" - ENV BUILD_DATE="${BUILD_DATE}" - ENV BUILD_REVISION="${BUILD_REVISION}" - - LABEL org.opencontainers.image.title="cldr-runner aws" + - LABEL org.opencontainers.image.title="cldr-runner-aws" org.opencontainers.image.description="Ansible Execution Environment with collections and dependencies for CDP Public Cloud, Private Cloud, and Data Services for AWS." org.opencontainers.image.created="${BUILD_DATE}" org.opencontainers.image.version="${BUILD_VER}" diff --git a/azure/execution-environment.yml b/azure/execution-environment.yml index f42cfbb..2088e7c 100644 --- a/azure/execution-environment.yml +++ b/azure/execution-environment.yml @@ -20,7 +20,7 @@ version: 3 images: base_image: - name: ghcr.io/cloudera-labs/cldr-runner:base-latest + name: ghcr.io/cloudera-labs/cldr-runner-base:latest dependencies: galaxy: requirements.yml @@ -29,13 +29,13 @@ dependencies: additional_build_steps: prepend_final: - - ARG BUILD_VER="azure-latest" + - ARG BUILD_VER="latest" - ARG BUILD_DATE="unknown" - ARG BUILD_REVISION="unknown" - ENV BUILD_VER="${BUILD_VER}" - ENV BUILD_DATE="${BUILD_DATE}" - ENV BUILD_REVISION="${BUILD_REVISION}" - - LABEL org.opencontainers.image.title="cldr-runner azure" + - LABEL org.opencontainers.image.title="cldr-runner-azure" org.opencontainers.image.description="Ansible Execution Environment with collections and dependencies for CDP Public Cloud, Private Cloud, and Data Services for Azure." org.opencontainers.image.created="${BUILD_DATE}" org.opencontainers.image.version="${BUILD_VER}" diff --git a/base/execution-environment.yml b/base/execution-environment.yml index faacd22..2faffea 100644 --- a/base/execution-environment.yml +++ b/base/execution-environment.yml @@ -33,7 +33,7 @@ additional_build_steps: prepend_builder: - RUN yum install -y yum-utils && yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo prepend_final: - - ARG BUILD_VER="base-latest" + - ARG BUILD_VER="latest" - ARG BUILD_DATE="unknown" - ARG BUILD_REVISION="unknown" - ENV BUILD_VER="${BUILD_VER}" @@ -45,7 +45,7 @@ additional_build_steps: org.opencontainers.image.url="https://github.com/cloudera-labs/cldr-runner/blob/main/README.md" org.opencontainers.image.source="https://github.com/cloudera-labs/cldr-runner.git" org.opencontainers.image.licenses=Apache-2.0 - org.opencontainers.image.title="cldr-runner base" + org.opencontainers.image.title="cldr-runner-base" org.opencontainers.image.description="Ansible Execution Environment with collections and dependencies for CDP Public Cloud, Private Cloud, and Data Services." org.opencontainers.image.created="${BUILD_DATE}" org.opencontainers.image.version="${BUILD_VER}" diff --git a/full/execution-environment.yml b/full/execution-environment.yml index f9c856b..94d9c29 100644 --- a/full/execution-environment.yml +++ b/full/execution-environment.yml @@ -20,7 +20,7 @@ version: 3 images: base_image: - name: ghcr.io/cloudera-labs/cldr-runner:base-latest + name: ghcr.io/cloudera-labs/cldr-runner-base:latest dependencies: galaxy: requirements.yml @@ -36,13 +36,13 @@ additional_build_steps: - ADD _build/assets/google-cloud-cli.repo /etc/yum.repos.d/google-cloud-cli.repo - RUN yum install -y yum-utils && yum-config-manager --enable google-cloud-cli prepend_final: - - ARG BUILD_VER="full-latest" + - ARG BUILD_VER="latest" - ARG BUILD_DATE="unknown" - ARG BUILD_REVISION="unknown" - ENV BUILD_VER="${BUILD_VER}" - ENV BUILD_DATE="${BUILD_DATE}" - ENV BUILD_REVISION="${BUILD_REVISION}" - - LABEL org.opencontainers.image.title="cldr-runner full" + - LABEL org.opencontainers.image.title="cldr-runner-full" org.opencontainers.image.description="Ansible Execution Environment with collections and dependencies for CDP Public Cloud, Private Cloud, and Data Services for AWS, Azure, GCP, and other tooling for general development and usage." org.opencontainers.image.created="${BUILD_DATE}" org.opencontainers.image.version="${BUILD_VER}" diff --git a/gcp/execution-environment.yml b/gcp/execution-environment.yml index c31283d..155ad8a 100644 --- a/gcp/execution-environment.yml +++ b/gcp/execution-environment.yml @@ -20,7 +20,7 @@ version: 3 images: base_image: - name: ghcr.io/cloudera-labs/cldr-runner:base-latest + name: ghcr.io/cloudera-labs/cldr-runner-base:latest dependencies: galaxy: requirements.yml @@ -36,13 +36,13 @@ additional_build_steps: - ADD _build/assets/google-cloud-cli.repo /etc/yum.repos.d/google-cloud-cli.repo - RUN yum install -y yum-utils && yum-config-manager --enable google-cloud-cli prepend_final: - - ARG BUILD_VER="gcp-latest" + - ARG BUILD_VER="latest" - ARG BUILD_DATE="unknown" - ARG BUILD_REVISION="unknown" - ENV BUILD_VER="${BUILD_VER}" - ENV BUILD_DATE="${BUILD_DATE}" - ENV BUILD_REVISION="${BUILD_REVISION}" - - LABEL org.opencontainers.image.title="cldr-runner gcp" + - LABEL org.opencontainers.image.title="cldr-runner-gcp" org.opencontainers.image.description="Ansible Execution Environment with collections and dependencies for CDP Public Cloud, Private Cloud, and Data Services for GCP." org.opencontainers.image.created="${BUILD_DATE}" org.opencontainers.image.version="${BUILD_VER}" From 498701a569b93b052c0c53e745770bb825c55e36 Mon Sep 17 00:00:00 2001 From: Webster Mudge Date: Mon, 20 May 2024 12:51:22 -0400 Subject: [PATCH 2/5] Remove prefix from flavor parameter for the docker/metadata-action Signed-off-by: Webster Mudge --- .github/workflows/build_push_image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_push_image.yml b/.github/workflows/build_push_image.yml index c24e665..3c96ed6 100644 --- a/.github/workflows/build_push_image.yml +++ b/.github/workflows/build_push_image.yml @@ -58,7 +58,6 @@ jobs: ghcr.io/${{ github.repository }}-${{ inputs.PROFILE }} flavor: | latest=auto - prefix=onlatest=true tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} From f0d8dd3a494a88454c75abc58c94080eda6774a1 Mon Sep 17 00:00:00 2001 From: Webster Mudge Date: Mon, 20 May 2024 13:10:32 -0400 Subject: [PATCH 3/5] * Update to actions/checkout@v4 and docker/metadata-action@v5 * Update metadata tagging and REPLACEMENT_IMAGE to reflect new image naming scheme * Update to actions/checkout@v4 and docker/metadata-action@v5 Signed-off-by: Webster Mudge --- .github/workflows/build_push_image.yml | 4 ++-- .github/workflows/validate_image.yml | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_push_image.yml b/.github/workflows/build_push_image.yml index 3c96ed6..87bd45f 100644 --- a/.github/workflows/build_push_image.yml +++ b/.github/workflows/build_push_image.yml @@ -45,14 +45,14 @@ jobs: registry-paths: ${{ steps.push-image.outputs.registry-paths }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install latest ansible-builder run: pip install ansible-builder - name: Construct image metadata id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | ghcr.io/${{ github.repository }}-${{ inputs.PROFILE }} diff --git a/.github/workflows/validate_image.yml b/.github/workflows/validate_image.yml index 16b4061..2a57910 100644 --- a/.github/workflows/validate_image.yml +++ b/.github/workflows/validate_image.yml @@ -35,26 +35,25 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install latest ansible-builder run: pip install ansible-builder - name: Construct image metadata id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | - ghcr.io/${{ github.repository }} + ghcr.io/${{ github.repository }}-${{ inputs.PROFILE }} flavor: | latest=auto - prefix=${{ inputs.PROFILE }}-,onlatest=true tags: | type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=ref,event=branch type=ref,event=pr - type=sha,prefix=${{ inputs.PROFILE }}- + type=sha - name: Construct short SHA id: sha @@ -63,9 +62,9 @@ jobs: - name: Update container base image reference if: ${{ inputs.PROFILE != 'base' }} env: - REPLACEMENT_IMAGE: ${{ github.repository }}:base-${{ steps.sha.outputs.sha-short }} + REPLACEMENT_IMAGE: ${{ github.repository }}-base:${{ steps.sha.outputs.sha-short }} run: - sed -i 's|cloudera-labs/cldr-runner:base-latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml + sed -i 's|cloudera-labs/cldr-runner-base:latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml - name: Create builder context run: | From 9b73e58bc9d3cdddb77691f1200ffc9323a562ca Mon Sep 17 00:00:00 2001 From: Webster Mudge Date: Mon, 20 May 2024 13:24:04 -0400 Subject: [PATCH 4/5] Update to actions/upload-artifact@v4 and actions/download-artifact@v4 Signed-off-by: Webster Mudge --- .github/workflows/validate_image.yml | 6 +++--- .github/workflows/validate_pr.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/validate_image.yml b/.github/workflows/validate_image.yml index 2a57910..df1ccb8 100644 --- a/.github/workflows/validate_image.yml +++ b/.github/workflows/validate_image.yml @@ -71,14 +71,14 @@ jobs: ansible-builder create --file ${{ inputs.PROFILE }}/execution-environment.yml - name: Upload Containerfile - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ inputs.PROFILE }}-Containerfile path: ./context/Containerfile - name: Download the base image if: ${{ inputs.PROFILE != 'base' }} - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: base-${{ steps.sha.outputs.sha-short }} path: /tmp @@ -111,7 +111,7 @@ jobs: - name: Upload base image if: ${{ inputs.PROFILE == 'base' }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: base-${{ steps.sha.outputs.sha-short }} path: /tmp/base-${{ steps.sha.outputs.sha-short }}.tar diff --git a/.github/workflows/validate_pr.yml b/.github/workflows/validate_pr.yml index 22af58b..1a4e4e4 100644 --- a/.github/workflows/validate_pr.yml +++ b/.github/workflows/validate_pr.yml @@ -53,7 +53,7 @@ jobs: echo $PR_NUMBER > ./pr/pr_number - name: Upload the PR number - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: pr_number path: pr/ From 81f7c677660c3560248e976779d69381361b4852 Mon Sep 17 00:00:00 2001 From: Webster Mudge Date: Mon, 20 May 2024 13:26:23 -0400 Subject: [PATCH 5/5] * Update image reference for base * Fix artifact name and reference SHA-tagged image from build * Fix reference to base image SHA in REPLACEMENT_IMAGE variable * Update REPLACEMENT_IMAGE and image-sha output to reflect SHA image name Signed-off-by: Webster Mudge --- .github/workflows/build_push_image.yml | 4 ++-- .github/workflows/validate_image.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_push_image.yml b/.github/workflows/build_push_image.yml index 87bd45f..f3c6082 100644 --- a/.github/workflows/build_push_image.yml +++ b/.github/workflows/build_push_image.yml @@ -31,7 +31,7 @@ on: value: ${{ jobs.build-push.outputs.registry-paths }} image-sha: description: 'the SHA-tagged image path' - value: ghcr.io/${{ github.repository }}:sha-${{ jobs.build-push.outputs.sha-short }} + value: ghcr.io/${{ github.repository }}-${{ inputs.PROFILE }}:sha-${{ jobs.build-push.outputs.sha-short }} permissions: contents: read @@ -72,7 +72,7 @@ jobs: - name: Update container base image reference if: ${{ inputs.PROFILE != 'base' }} env: - REPLACEMENT_IMAGE: ${{ github.repository }}-base:${{ steps.sha.outputs.sha-short }} + REPLACEMENT_IMAGE: ${{ github.repository }}-base:sha-${{ steps.sha.outputs.sha-short }} run: sed -i 's|cloudera-labs/cldr-runner-base:latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml diff --git a/.github/workflows/validate_image.yml b/.github/workflows/validate_image.yml index df1ccb8..bdbd484 100644 --- a/.github/workflows/validate_image.yml +++ b/.github/workflows/validate_image.yml @@ -62,7 +62,7 @@ jobs: - name: Update container base image reference if: ${{ inputs.PROFILE != 'base' }} env: - REPLACEMENT_IMAGE: ${{ github.repository }}-base:${{ steps.sha.outputs.sha-short }} + REPLACEMENT_IMAGE: ${{ github.repository }}-base:sha-${{ steps.sha.outputs.sha-short }} run: sed -i 's|cloudera-labs/cldr-runner-base:latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml @@ -105,9 +105,9 @@ jobs: - name: Save the base image if: ${{ inputs.PROFILE == 'base' }} env: - BASE_IMAGE: base-${{ steps.sha.outputs.sha-short }} + BASE_IMAGE: ${{ steps.sha.outputs.sha-short }} run: | - podman save --output /tmp/${{ env.BASE_IMAGE }}.tar ${{ github.repository }}:${{ env.BASE_IMAGE }} + podman save --output /tmp/base-${{ env.BASE_IMAGE }}.tar ${{ github.repository }}-base:sha-${{ env.BASE_IMAGE }} - name: Upload base image if: ${{ inputs.PROFILE == 'base' }}