Skip to content
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
3 changes: 3 additions & 0 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore": ["**/README.tpl.md"]
}
3 changes: 3 additions & 0 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ jobs:
with:
sl_env: |
VALIDATE_TRIVY=false
VALIDATE_JSON_PRETTIER=false
VALIDATE_MARKDOWN_PRETTIER=false
VALIDATE_NATURAL_LANGUAGE=false
1 change: 1 addition & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
README.tpl.md
8 changes: 5 additions & 3 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ LABEL org.opencontainers.image.title="${TITLE}" \
description="${DESCRIPTION}"

ARG COLLECTIONS_TO_REMOVE="fortinet cisco dellemc f5networks junipernetworks mellanox netapp"
ARG DNF_TO_REMOVE="dejavu-sans-fonts langpacks-core-font-en langpacks-core-en langpacks-en"
ARG DNF_TO_REMOVE=''
ARG RPM_TO_FORCEFULLY_REMOVE="cracklib-dicts"
# Versions
ARG OPENSHIFT_CLIENT_VERSION="4.20.14"
Expand All @@ -38,6 +38,7 @@ ARG HELM_SECRETS_VERSION="4.7.5"
# command
ARG PYTHON_VERSION="3.11"
ARG PYTHON_PKGS="python${PYTHON_VERSION} python${PYTHON_VERSION}-pip python3-pip"
ARG PLAYWRIGHT_PKGS="atk at-spi2-atk cups-libs libdrm libxkbcommon libxcb libXcomposite libXdamage libXext libXfixes libXrandr libgbm pango alsa-lib nss nspr expat"

# amd64 - arm64
ARG TARGETARCH
Expand Down Expand Up @@ -84,8 +85,8 @@ ENV PIP_BREAK_SYSTEM_PACKAGES=1

ENV HELM_PLUGINS=/etc/helm-plugins

RUN microdnf --disableplugin=subscription-manager install -y make git-core tar vi jq which findutils diffutils sshpass gzip ${PYTHON_PKGS} $EXTRARPMS && \
microdnf remove -y $DNF_TO_REMOVE && \
RUN microdnf --disableplugin=subscription-manager install -y make git-core tar vi jq which findutils diffutils sshpass gzip ${PYTHON_PKGS} ${PLAYWRIGHT_PKGS} $EXTRARPMS && \
if [ -n "$DNF_TO_REMOVE" ]; then microdnf remove -y $DNF_TO_REMOVE; fi && \
rpm -e --nodeps $RPM_TO_FORCEFULLY_REMOVE && \
microdnf clean all && \
rm -rf /var/cache/dnf && \
Expand All @@ -102,6 +103,7 @@ chown root:root /usr/local/bin/* && chmod 755 /usr/local/bin/* && \
rm -rf /root/anaconda* /root/original-ks.cfg /usr/local/README && \
pip install --no-cache-dir --no-compile -r /tmp/requirements.txt && \
ansible-galaxy collection install --collections-path /usr/share/ansible/collections -r /tmp/requirements.yml && \
playwright install --only-shell chromium && \
# Create ansible-playbook wrapper that sets ANSIBLE_STDOUT_CALLBACK to rhvp.cluster_utils.readable when it's "null" \
mv /usr/local/bin/ansible-playbook /usr/local/bin/ansible-playbook.orig && \
mv /tmp/ansible-playbook-wrapper.sh /usr/local/bin/ansible-playbook && \
Expand Down
75 changes: 34 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,48 +75,43 @@ test-arm64: ## Prints the test of most tools inside the container arm64
.PHONY: test
test: test-amd64 test-arm64 ## Tests the container for all the required bits both arm64 and amd64

##@ Run and upload tasks
.PHONY: versions
versions: ## Print all the versions of software in the locally-built container
@podman run --rm -it --net=host \
VERSION ?=$(shell git describe --tags --abbrev=0 2>/dev/null || echo "N/A")
.PHONY: gen-docs
gen-docs: ## Print all the versions of software in the locally-built container
@echo "Extracting versions and updating README.md..."
@SOFTWARE_MANIFEST=$$(podman run --rm --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-w $$(pwd) "${REGISTRY}/${CONTAINER}-amd64" sh -c \
"set -e; \
echo -n \"|sshpass package \"; rpm -q --queryformat '%{VERSION}' sshpass; echo \" \"; \
echo -n \"|python3-pip package \"; rpm -q --queryformat '%{VERSION}' python3-pip; echo \" \"; \
echo -n \"|git-core package \"; rpm -q --qf '%{VERSION}' git-core; echo \" \"; \
echo -n \"|vi package \"; rpm -q --qf '%{VERSION}' vim-minimal; echo \" \"; \
echo -n \"|tar package \"; rpm -q --qf '%{VERSION}' tar; echo \" \"; \
echo -n \"|gzip package \"; rpm -q --qf '%{VERSION}' gzip; echo \" \"; \
echo -n \"|make package \"; rpm -q --qf '%{VERSION}' make; echo \" \"; \
echo -n \"|python package \"; /usr/bin/python3 --version | sed -e s'/Python //' | tr -d '\n'; echo \" \"; \
echo -n \"|jq package \"; rpm -q --qf '%{VERSION}' jq; echo \" \"; \
echo -n \"|age binary \"; age --version |tr -d '\n'; echo \" \"; \
echo -n \"|helm binary \"; helm version --template '{{ .Version }}'; echo \" \"; \
echo -n \"|helmsecrets binary \"; helm plugin list |grep ^secrets | tr '[:blank:]' ' '| cut -f2 -d\ | tr -d '\n'; echo \" \"; \
echo -n \"|tea binary \"; tea --version | sed -e 's/Version: //' | sed -e 's/golang.*//' | tr -d '\t' | tr -d '\n'; echo \" \"; \
echo -n \"|openshift binary \"; oc version --client -o json | jq -j '.releaseClientVersion'; echo \" \"; \
echo -n \"|kustomize binary \"; oc version --client -o json | jq -j '.kustomizeVersion'; echo \" \"; \
echo -n \"|pytest pip \"; pip show pytest | grep ^Version | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|ansible pip \"; ansible --version -o json | grep core | cut -f3 -d\ | tr -d '\n]'; echo \" \"; \
echo -n \"|kubernetes pip \"; pip show kubernetes |grep ^Version: | cut -f2 -d\ | tr -d '\n'; echo \" \"; \
echo -n \"|boto3 pip \"; pip show boto3 | grep ^Version: | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|botocore pip \"; pip show botocore | grep ^Version: | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|awscli pip \"; pip show awscli | grep ^Version: | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|azure-cli pip \"; pip show azure-cli | grep ^Version: | cut -f2 -d\ | tr -d '\n'; echo \" \"; \
echo -n \"|gcloud pip \"; pip show gcloud| grep ^Version: | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|jmespath pip \"; pip show jmespath| grep ^Version: | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|ansible-runner pip \"; pip show ansible-runner| grep ^Version: | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|vp-qe-test-common pip \"; pip show vp-qe-test-common | grep ^Version: | cut -f2 -d\ | tr -d '\n'; echo \" \"; \
echo -n \"|kubernetes.core collection \"; ansible-galaxy collection list kubernetes.core |grep ^kubernetes.core | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|community.okd collection \"; ansible-galaxy collection list community.okd |grep ^community.okd | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|community.general collection \"; ansible-galaxy collection list community.general |grep ^community.general | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|ansible.posix collection \"; ansible-galaxy collection list ansible.posix |grep ^ansible.posix | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|ansible.utils collection \"; ansible-galaxy collection list ansible.utils |grep ^ansible.utils | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
echo -n \"|rhvp.cluster_utils collection \"; ansible-galaxy collection list rhvp.cluster_utils |grep ^rhvp.cluster_utils | cut -f2 -d\ |tr -d '\n'; echo \" \"; \
" | sort | column --table -o '|'
-w $$(pwd) "${REGISTRY}/${CONTAINER}-amd64" sh -c " \
set -e; \
for pkg in sshpass python3-pip git-core jq tar gzip make vim-minimal; do \
echo \"\$$pkg package \$$(rpm -q --queryformat '%{VERSION}' \$$pkg )\"; \
done; \
for pip_pkg in \$$(awk -F'[=>@#]' '{print \$$1}' requirements.txt | xargs); do \
[ -z \"\$$pip_pkg\" ] && continue; \
echo \"\$$pip_pkg pip \$$(pip show \$$pip_pkg | awk '/^Version:/ {print \$$2}')\"; \
done; \
for coll in \$$(yq '.collections[].name' requirements.yml 2>/dev/null); do \
echo \"\$$coll collection \$$(ansible-galaxy collection list \$$coll 2>/dev/null | grep \"^\$$coll\" | awk '{print \$$2}')\"; \
done; \
echo \"python package \$$(/usr/bin/python3 --version 2>/dev/null | awk '{print \$$2}')\"; \
echo \"age binary \$$(age --version 2>/dev/null)\"; \
echo \"helm binary \$$(helm version --template '{{ .Version }}' 2>/dev/null)\"; \
echo \"helmsecrets binary \$$(helm plugin list 2>/dev/null | awk '/^secrets/ {print \$$2}')\"; \
echo \"tea binary \$$(tea --version 2>/dev/null | awk '/^Version:/ {print \$$2}')\"; \
echo \"openshift binary \$$(oc version --client -o json 2>/dev/null | jq -j '.releaseClientVersion')\"; \
echo \"kustomize binary \$$(oc version --client -o json 2>/dev/null | jq -j '.kustomizeVersion')\"; \
echo \"ansible pip \$$(ansible --version -o json 2>/dev/null | grep core | awk '{print \$$3}' | tr -d '\"],')\"; \
" | sed -e 's/\x1b\[[0-9;]*m//g' | sort | awk '{print "| " $$1 " | " $$2 " | " $$3 " |"}'); \
\
awk -v version="$(VERSION)" -v table="$$SOFTWARE_MANIFEST" ' \
{ \
gsub(/__VERSION__/, version); \
gsub(/__SOFTWARE_TABLE__/, table); \
print; \
}' README.tpl.md > README.md


.PHONY: run
run: ## Runs the container interactively
Expand All @@ -135,8 +130,6 @@ super-linter: ## Runs super linter locally
-e VALIDATE_DOCKERFILE_HADOLINT=false \
-e VALIDATE_JSON_PRETTIER=false \
-e VALIDATE_MARKDOWN_PRETTIER=false \
-e VALIDATE_MARKDOWN_PRETTIER=false \
-e VALIDATE_NATURAL_LANGUAGE=false \
-e VALIDATE_PYTHON_PYLINT=false \
-e VALIDATE_SHELL_SHFMT=false \
-e VALIDATE_TRIVY=false \
Expand Down
87 changes: 38 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Validated Patterns Utility Container

![Version: 1.0.2](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square)
![Version: v1.0.5 ](https://img.shields.io/badge/Version-v1.0.5-informational?style=flat-square)
[![Quay Repository](https://img.shields.io/badge/Quay.io-utility--container-blue?logo=quay)](https://quay.io/repository/validatedpatterns/utility-container)
[![CI Pipeline](https://github.com/validatedpatterns/utility-container/actions/workflows/docker-publish.yml/badge.svg?branch=main)](https://github.com/validatedpatterns/utility-container/actions/workflows/docker-publish.yml)

Expand All @@ -12,54 +12,43 @@ This container provides a pre-configured environment with all the necessary tool

## Installed Software

<!-- textlint-disable -->

| name | type | version |
| :---------------------------------: | :---------: | :-------------: |
| age | binary | 1.3.1 |
| ansible | pip | 2.19.6 |
| ansible.posix | collection | 2.1.0 |
| ansible-runner | pip | 2.4.2 |
| ansible.utils | collection | 6.0.1 |
| argocd | binary | v3.1.12+a46152e |
| awscli | pip | 1.44.39 |
| awx.awx | collection | 24.6.1 |
| awxkit | pip | 24.6.1 |
| azure-cli | pip | 2.83.0 |
| boto3 | pip | 1.42.49 |
| botocore | pip | 1.42.49 |
| community.general | collection | 12.3.0 |
| community.okd | collection | 5.0.0 |
| gcloud | pip | 0.18.3 |
| gh | package | 2.86.0 |
| git-core | package | 2.47.3 |
| gzip | package | 1.12 |
| hcp | binary | 4.17.0 |
| helm | binary | v3.19.5 |
| helm-secrets | helm plugin | 4.7.5 |
| infra.ah_configuration | collection | 2.1.0 |
| infra.controller_configuration | collection | 3.2.2 |
| infra.eda_configuration | collection | 1.1.0 |
| jmespath | pip | 1.1.0 |
| jq | package | 1.6 |
| kubernetes.core | collection | 6.3.0 |
| kubernetes | pip | 35.0.0 |
| kustomize | binary | v5.6.0 |
| make | package | 4.3 |
| openshift | binary | 4.20.14 |
| pytest | pip | 9.0.2 |
| python3-pip | package | 21.3.1 |
| python | package | 3.11.13 |
| redhat_cop.controller_configuration | collection | 2.3.1 |
| rhvp.cluster_utils | collection | 1.1.0 |
| sshpass | package | 1.09 |
| tar | package | 1.34 |
| tea | binary | 0.9.2 |
| tekton | binary | 0.35.2 |
| vi | package | 8.2.2637 |
| vp-qe-test-common | pip | 0.0.1 |

<!-- textlint-enable -->
| name | type | version |
| :--- | :--- | :--- |
| age | binary | v1.3.1 |
| amazon.aws | collection | 11.4.0 |
| ansible-core | pip | 2.18.19 |
| ansible | pip | 2.18.19 |
| ansible.posix | collection | 2.2.2 |
| ansible-runner | pip | 2.4.3 |
| ansible.utils | collection | 6.1.0 |
| awscli | pip | 1.46.1 |
| azure-cli | pip | 2.90.0 |
| boto3 | pip | 1.43.94 |
| botocore | pip | 1.43.94 |
| community.general | collection | 13.4.0 |
| community.okd | collection | 6.0.0 |
| gcloud | pip | 0.18.3 |
| git-core | package | 2.52.0 |
| gzip | package | 1.12 |
| helm | binary | v3.19.5 |
| helmsecrets | binary | 4.7.5 |
| jq | package | 1.6 |
| kubernetes.core | collection | 6.5.0 |
| kubernetes | pip | 35.0.0 |
| kustomize | binary | v5.6.0 |
| make | package | 4.3 |
| openshift | binary | 4.20.14 |
| openshift | pip | 0.13.2 |
| pytest | pip | 9.1.1 |
| pytest-playwright | pip | 0.9.0 |
| python3-pip | package | 21.3.1 |
| python | package | 3.11.13 |
| rhvp.cluster_utils | collection | 1.1.0 |
| sshpass | package | 1.09 |
| tar | package | 1.34 |
| tea | binary | 0.9.2 |
| vim-minimal | package | 8.2.2637 |
| vp-qe-test-common | pip | 0.0.1 |

## Usage

Expand Down
93 changes: 93 additions & 0 deletions README.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Validated Patterns Utility Container

![Version: __VERSION__ ](https://img.shields.io/badge/Version-__VERSION__-informational?style=flat-square)
[![Quay Repository](https://img.shields.io/badge/Quay.io-utility--container-blue?logo=quay)](https://quay.io/repository/validatedpatterns/utility-container)
[![CI Pipeline](https://github.com/validatedpatterns/utility-container/actions/workflows/docker-publish.yml/badge.svg?branch=main)](https://github.com/validatedpatterns/utility-container/actions/workflows/docker-publish.yml)

A utility container for simplified execution of imperative commands in each of the Validated Patterns.

## Overview

This container provides a pre-configured environment with all the necessary tools and dependencies for working with Validated Patterns. It includes Ansible, Kubernetes tools, cloud CLIs, and other utilities commonly needed for pattern deployment and management.

## Installed Software

| name | type | version |
| :--- | :--- | :--- |
__SOFTWARE_TABLE__

## Usage

### Pull the Image

```bash
podman pull quay.io/validatedpatterns/utility-container:latest
```

### Examples

**Interactive shell**

```bash
podman run --rm -it --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-w $(pwd) \
quay.io/validatedpatterns/utility-container:latest sh
```

**Execute an Ansible playbook**

```bash
podman run --rm -it --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-w $(pwd) \
quay.io/validatedpatterns/utility-container:latest \
ansible-playbook <playbook>.yml
```

**Run OpenShift commands**

```bash
podman run --rm -it --net=host \
--security-opt label=disable \
-v ${HOME}:/pattern \
-v ${HOME}:${HOME} \
-w $(pwd) \
quay.io/validatedpatterns/utility-container:latest \
oc get nodes
```

## Troubleshooting

**Permission issues with volume mounts**

- Ensure the `--security-opt label=disable` flag is used when running the container.
- Check that your user has read/write access to the mounted directories.

**Network connectivity issues**

- Use `--net=host` for full network access.
- For restricted environments, configure appropriate network policies.

**Missing tools or outdated versions**

- Check the installed software table above for current versions.
- Consider building a custom image if you need different tool versions.

## Development

### Build the Image

Run `make build` to build both amd64 and arm64 architectures locally (requires qemu-user-static package).

### Upload to Registry

Run `make upload` to push the image to the official repository.

### Contributing

To update software versions or add new tools, modify the Containerfile and update the software table in this readme. Use `make versions` to generate the software versions table from the container after building locally.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ awscli>=1.22
azure-cli>=2.34
gcloud
pytest
pytest-playwright
vp-qe-test-common @ git+https://github.com/validatedpatterns/vp-qe-test-common.git@v1#egg=vp-qe-test-common