-
Notifications
You must be signed in to change notification settings - Fork 6
HYPERFLEET-578 | feat: E2E testing Container Images to include Helm and Cloud CLI Tools #19
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # HyperFleet E2E Testing Framework | ||
| # | ||
| # Build: podman build -t quay.io/hyperfleet/hyperfleet-e2e:latest . | ||
| # Build with commit: podman build --build-arg GIT_COMMIT=$(git rev-parse HEAD) -t quay.io/hyperfleet/hyperfleet-e2e:latest . | ||
| # Run: podman run --rm -e HYPERFLEET_API_URL=<url> quay.io/hyperfleet/hyperfleet-e2e:latest test | ||
|
|
||
| ARG BASE_IMAGE=registry.access.redhat.com/ubi9/go-toolset | ||
|
|
||
| # Build stage | ||
| FROM golang:1.25 AS builder | ||
|
|
||
| WORKDIR /build | ||
|
|
||
| # Install build dependencies | ||
| RUN apt-get update && apt-get install -y --no-install-recommends make && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Copy source code | ||
| COPY . . | ||
|
|
||
| # Build binary using make to include commit and build date | ||
| ARG GIT_COMMIT=unknown | ||
| RUN make build GIT_COMMIT=${GIT_COMMIT} | ||
|
|
||
| RUN chmod +x /build/bin/hyperfleet-e2e | ||
|
|
||
| # Runtime stage | ||
| FROM ${BASE_IMAGE} | ||
|
|
||
| # Install runtime dependencies and tools | ||
| USER root | ||
| RUN dnf -y install jq gettext curl && dnf clean all | ||
|
|
||
| # Install kubectl (latest stable) | ||
| RUN curl -fsSL "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ | ||
| -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl | ||
|
|
||
| # Install Helm | ||
| RUN curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
|
Comment on lines
+33
to
+38
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "Dockerfile" -type fRepository: openshift-hyperfleet/hyperfleet-e2e Length of output: 111 🏁 Script executed: cat -n images/Dockerfile | head -50Repository: openshift-hyperfleet/hyperfleet-e2e Length of output: 1995 🌐 Web query:
💡 Result: Official
|
||
|
|
||
| WORKDIR /e2e | ||
|
|
||
| # Copy binary from builder (make build outputs to bin/) | ||
| COPY --from=builder /build/bin/hyperfleet-e2e /usr/local/bin/ | ||
|
|
||
| # Copy test payloads and fixtures | ||
| COPY --from=builder /build/testdata /e2e/testdata | ||
|
|
||
| # Copy default config (fallback if ConfigMap is not mounted) | ||
| COPY --from=builder /build/configs /e2e/configs | ||
|
|
||
| ENTRYPOINT ["/usr/local/bin/hyperfleet-e2e"] | ||
| CMD ["test", "--help"] | ||
|
|
||
| LABEL name="hyperfleet-e2e" \ | ||
| vendor="Red Hat" \ | ||
| summary="HyperFleet E2E Testing Framework" \ | ||
| description="End to end testing for HyperFleet cluster lifecycle management" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # ================================================== | ||
| # Cloud Platform Tools Image | ||
| # Base: Red Hat Universal Base Image 9 | ||
| # ================================================== | ||
| FROM registry.access.redhat.com/ubi9/ubi:latest | ||
|
|
||
| LABEL maintainer="HyperFleet E2E Team" \ | ||
| description="Cloud platform tools for E2E testing (gcloud, aws, kubectl, helm, jq)" | ||
|
|
||
| # Install base tools | ||
| RUN dnf install -y --allowerasing \ | ||
| curl \ | ||
| tar \ | ||
| unzip \ | ||
| jq \ | ||
| python3 \ | ||
| && dnf clean all | ||
|
|
||
| # Install gcloud CLI | ||
| RUN cat <<EOF > /etc/yum.repos.d/google-cloud-sdk.repo | ||
| [google-cloud-cli] | ||
| name=Google Cloud CLI | ||
| baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el9-x86_64 | ||
| enabled=1 | ||
| gpgcheck=1 | ||
| repo_gpgcheck=0 | ||
| gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg | ||
| EOF | ||
|
|
||
| RUN dnf install -y \ | ||
| google-cloud-cli \ | ||
| google-cloud-cli-gke-gcloud-auth-plugin \ | ||
| && dnf clean all | ||
|
|
||
| # Install AWS CLI v2 | ||
| RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ | ||
| && unzip awscliv2.zip \ | ||
| && ./aws/install \ | ||
| && rm -rf aws awscliv2.zip | ||
|
|
||
| # Install kubectl (latest stable) | ||
| RUN curl -fsSL "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ | ||
| -o /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl | ||
|
|
||
| # Install Helm | ||
| RUN curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash | ||
|
|
||
| # Install yq | ||
| RUN curl -L "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64" \ | ||
| -o /usr/local/bin/yq \ | ||
| && chmod +x /usr/local/bin/yq | ||
|
Comment on lines
+35
to
+51
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "Dockerfile.platform" -o -name "Dockerfile*" | head -20Repository: openshift-hyperfleet/hyperfleet-e2e Length of output: 140 🏁 Script executed: cat images/Dockerfile.platform 2>/dev/null | head -100Repository: openshift-hyperfleet/hyperfleet-e2e Length of output: 1943 🌐 Web query:
💡 Result: Official AWS CLI v2 install on RHEL / UBI (Linux) with integrity verification (AWS-supported)AWS’s official verification method for the Linux ZIP installer is PGP signature verification ( 1) Install prerequisites (RHEL/UBI)Install tools you’ll need: 2) Download the installer ZIPx86_64: curl -o awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"aarch64 (ARM64): curl -o awscliv2.zip "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"3) Create/import the AWS CLI Team PGP public keyAWS’s install guide provides the AWS CLI Team public key block plus fingerprint/Key ID—paste it into a file (example: gpg --import aws-cli.pub(Key ID 4) Download the matching
|
||
|
|
||
| # Create non-root user (OpenShift SCC compatible) | ||
| RUN useradd -r -u 1000 -g 0 -m -d /home/clouduser -s /bin/bash clouduser \ | ||
| && mkdir -p /workspace \ | ||
| && chown -R 1000:0 /workspace /home/clouduser \ | ||
| && chmod -R g=u /workspace /home/clouduser | ||
|
|
||
| USER 1000 | ||
| WORKDIR /workspace | ||
|
|
||
| CMD ["/bin/bash"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
kubectl official installation RHEL checksum verification binary💡 Result:
Official kubectl (binary) install on RHEL + checksum verification
This is the Kubernetes project’s official install flow for Linux (works on RHEL) and includes the official checksum verification step. [1]
(Optional, stronger) Verify the kubectl binary signature (cosign keyless)
Kubernetes also publishes keyless cosign signatures for standalone binaries; download
kubectl,kubectl.sig,kubectl.certfor a specific version/arch and verify withcosign verify-blob. [2]Sources: Kubernetes docs on installing kubectl on Linux and validating SHA256 checksums [1]; Kubernetes docs on verifying signed release artifacts with cosign [2].
🌐 Web query:
Helm official installation script checksum RHEL UBI best practices💡 Result:
What Helm publishes (and what it doesn’t)
scripts/get-helm-3) and explicitly warn that piping it tobashis “live on the edge.” [1]main). Treat it like source code you must pin/review.Best-practice approaches (RHEL / UBI-friendly)
1) Prefer release artifacts + checksum (and optionally signatures) over the script
.sha256.sha256sum(oropenssl dgst -sha256).gpg. [3]This avoids trusting a mutable install script URL and aligns with typical supply-chain controls.
2) If you must use
get-helm-3, pin it and verify more than “it ran”The script supports:
VERIFY_CHECKSUM=trueby default (verifies the downloaded tarball checksum),VERIFY_SIGNATURES=true(requiresgpg), andDESIRED_VERSIONso you can avoid “latest”. [2]Best practice when using it:
DESIRED_VERSION=vX.Y.Zand considerVERIFY_SIGNATURES=true. [2]3) RHEL UBI container specifics
microdnf(not fulldnf) to add dependencies. [4]curl,tar,gzip,openssl; plusgnupg2if doing signatures). The Helm script will fail iftaris missing. [2]Pattern (Containerfile idea):
microdnf, disable weak deps, then clean caches to keep the image small. [4]Sources: [1] Helm install docs (script warning). [2]
get-helm-3script behavior/options (checksum/signature/version env vars, required tools). [3] Helm GitHub releases guidance on using attached signatures withgpg. [4] Red Hat docs on usingmicrodnfin UBI minimal and disabling weak deps.🌐 Web query:
Kubernetes kubectl binary SHA256 checksum verification official💡 Result:
Official Kubernetes instructions to verify a
kubectldownload are:Download the same version of the binary and the
.sha256file. [1]If you want to verify the Sigstore signature (in addition to SHA256), Kubernetes also publishes
kubectl.sigandkubectl.cert, which you can verify withcosign verify-blob. [2]Sources: [1] https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/ [2] https://kubernetes.io/blog/2022/12/12/kubernetes-release-artifact-signing/
🌐 Web query:
Helm installation methods verified checksums release download💡 Result:
Helm installation methods (official) + how to verify release downloads
1) Install from binary releases (manual download)
helmon yourPATH. (helm.sh)*.sha256sum(or*.sha256) file for the tarball and verify locally, e.g.:(Exact checksum filename varies by release artifact.) (github.com)
*.ascsignature assets and indicate releases are signed; verify withgpg --verify <file>.asc <file>. (github.com)2) Install via the official install script (
get-helm-3)(helm.sh)
VERIFY_CHECKSUM=true). (gist.github.com)VERIFY_SIGNATURES=true), using the projectKEYSfile plus the release.ascassets. (gist.github.com)3) Install via package managers
Helm docs list common package-manager installs (Homebrew/apt/dnf/snap/winget, etc.). This is convenient, but verification behavior depends on the package ecosystem rather than Helm release artifacts directly. (helm.sh)
Citations:
Pin versions and add checksum verification for kubectl/Helm.
Lines 29–38 install tools without version pinning or integrity checks, creating supply-chain risks. Kubernetes officially publishes SHA256 checksums for kubectl releases; Helm's installer script (from
mainbranch) is explicitly flagged in official docs as unsafe without version pinning and signature verification.For kubectl: Download and verify the SHA256 checksum alongside the binary from the same versioned release URL:
For Helm: Either (1) download release artifacts with checksum verification, or (2) if using the install script, pin a specific version with
DESIRED_VERSION=vX.Y.Z, download the script to a file (don't pipe to bash), review it, and enableVERIFY_CHECKSUM=trueand optionallyVERIFY_SIGNATURES=true.🤖 Prompt for AI Agents