Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated image name to allow simple tags #80

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions .github/workflows/build_push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,26 +45,25 @@ 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 }}
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
Expand All @@ -73,9 +72,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:sha-${{ 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: |
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/validate_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -63,23 +62,23 @@ 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
sed -i 's|cloudera-labs/cldr-runner-base:latest|${{ env.REPLACEMENT_IMAGE }}|' ${{ inputs.PROFILE }}/execution-environment.yml

- name: Create builder context
run: |
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
Expand All @@ -106,13 +105,13 @@ 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' }}
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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
|-----|-------------|
Expand All @@ -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-<profile>:<version>`.

# 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.
Expand Down Expand Up @@ -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
```
Expand All @@ -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.
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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");
Expand Down
6 changes: 3 additions & 3 deletions aws/execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down
6 changes: 3 additions & 3 deletions azure/execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions base/execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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}"
Expand Down
6 changes: 3 additions & 3 deletions full/execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down
6 changes: 3 additions & 3 deletions gcp/execution-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}"
Expand Down
Loading