From 1b9a326d5731c86049067a68d7a7b404dbdf22cc Mon Sep 17 00:00:00 2001 From: Simon Baird Date: Mon, 16 Nov 2026 17:01:21 -0500 Subject: [PATCH 1/3] Text align fixes in ta_task_validate_image.feature Unrelated to my PR, but it was annoying me so I want to fix. --- features/ta_task_validate_image.feature | 104 ++++++++++++------------ 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/features/ta_task_validate_image.feature b/features/ta_task_validate_image.feature index 7f4d2c1e8..86d723967 100644 --- a/features/ta_task_validate_image.feature +++ b/features/ta_task_validate_image.feature @@ -38,13 +38,13 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | + | SNAPSHOT_FILENAME | snapshotartifact | | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | - | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | - | STRICT | true | - | IGNORE_REKOR | true | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | + | STRICT | true | + | IGNORE_REKOR | true | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task logs for step "pin-policy-bundle" should match the snapshot And the task logs for step "report-json" should match the snapshot @@ -83,14 +83,14 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | + | SNAPSHOT_FILENAME | snapshotartifact | | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | - | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | - | STRICT | true | - | IGNORE_REKOR | true | - | EC_USE_OPA | 1 | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | + | STRICT | true | + | IGNORE_REKOR | true | + | EC_USE_OPA | 1 | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task results should match the snapshot @@ -125,14 +125,14 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | - | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | - | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | + | SNAPSHOT_FILENAME | snapshotartifact | + | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | + | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | | POLICY_BUNDLE_DIGEST | sha256:2a851b5d56259ba46391f72bc4e75ed5475510dce5ae47d054b72baf1e908d26 | - | STRICT | false | - | IGNORE_REKOR | true | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | STRICT | false | + | IGNORE_REKOR | true | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task logs for step "pin-policy-bundle" should match the snapshot And the task logs for step "show-config" should match the snapshot @@ -173,14 +173,14 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | + | SNAPSHOT_FILENAME | snapshotartifact | | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | - | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | - | COLLECTOR_DATA | /var/workdir/conforma/runtime_data.json | - | STRICT | true | - | IGNORE_REKOR | true | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | + | COLLECTOR_DATA | /var/workdir/conforma/runtime_data.json | + | STRICT | true | + | IGNORE_REKOR | true | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task logs for step "inject-runtime-data" should match the snapshot And the task logs for step "show-config" should contain "file::/var/workdir/data-source-" @@ -219,15 +219,15 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | - | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | - | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | - | POLICY_BUNDLE_DIGEST | sha256:2a851b5d56259ba46391f72bc4e75ed5475510dce5ae47d054b72baf1e908d26 | - | COLLECTOR_DATA | /var/workdir/conforma/runtime_data.json | - | STRICT | true | - | IGNORE_REKOR | true | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | SNAPSHOT_FILENAME | snapshotartifact | + | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | + | POLICY_CONFIGURATION | ${NAMESPACE}/${POLICY_NAME} | + | POLICY_BUNDLE_DIGEST | sha256:2a851b5d56259ba46391f72bc4e75ed5475510dce5ae47d054b72baf1e908d26 | + | COLLECTOR_DATA | /var/workdir/conforma/runtime_data.json | + | STRICT | true | + | IGNORE_REKOR | true | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task logs for step "pin-policy-bundle" should match the snapshot And the task logs for step "inject-runtime-data" should match the snapshot @@ -247,10 +247,10 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | + | SNAPSHOT_FILENAME | snapshotartifact | | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | - | COLLECTOR_DATA | /var/workdir/conforma/missing-runtime-data.json | - | ORAS_OPTIONS | --plain-http | + | COLLECTOR_DATA | /var/workdir/conforma/missing-runtime-data.json | + | ORAS_OPTIONS | --plain-http | Then the task should fail And the task logs for step "inject-runtime-data" should contain "Data file does not exist: /var/workdir/conforma/missing-runtime-data.json" @@ -267,15 +267,15 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | - | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | + | SNAPSHOT_FILENAME | snapshotartifact | + | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | | POLICY_CONFIGURATION | {"publicKey":"-----BEGIN PUBLIC KEY-----\\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERhr8Zj4dZW67zucg8fDr11M4lmRp\\nzN6SIcIjkvH39siYg1DkCoa2h2xMUZ10ecbM3/ECqvBV55YwQ2rcIEa7XQ==\\n-----END PUBLIC KEY-----","sources":[{"policy":["git::github.com/conforma/policy//policy/release?ref=d34eab36b23d43748e451004177ca144296bf323","git::github.com/conforma/policy//policy/lib?ref=d34eab36b23d43748e451004177ca144296bf323"],"config":{"include":["slsa_provenance_available"]}}]} | - | STRICT | true | - | IGNORE_REKOR | true | - | ENABLE_VSA | true | - | ATTESTATION_FORMAT | predicate | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | STRICT | true | + | IGNORE_REKOR | true | + | ENABLE_VSA | true | + | ATTESTATION_FORMAT | predicate | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task result "VSA_GENERATED" should equal "true" @@ -292,12 +292,12 @@ Feature: Verify Conforma Trusted Artifact Tekton Task } ``` When version 0.1 of the task named "verify-conforma-konflux-ta" is run with parameters: - | SNAPSHOT_FILENAME | snapshotartifact | + | SNAPSHOT_FILENAME | snapshotartifact | | SOURCE_DATA_ARTIFACT | oci:${REGISTRY}/acceptance/snapshotartifact@${BUILD_SNAPSHOT_DIGEST} | | POLICY_CONFIGURATION | {"publicKey":"-----BEGIN PUBLIC KEY-----\\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAERhr8Zj4dZW67zucg8fDr11M4lmRp\\nzN6SIcIjkvH39siYg1DkCoa2h2xMUZ10ecbM3/ECqvBV55YwQ2rcIEa7XQ==\\n-----END PUBLIC KEY-----","sources":[{"policy":["git::github.com/conforma/policy//policy/release?ref=d34eab36b23d43748e451004177ca144296bf323","git::github.com/conforma/policy//policy/lib?ref=d34eab36b23d43748e451004177ca144296bf323"],"config":{"include":["slsa_provenance_available"]}}]} | - | STRICT | true | - | IGNORE_REKOR | true | - | TRUSTED_ARTIFACTS_DEBUG | "true" | - | ORAS_OPTIONS | --plain-http | + | STRICT | true | + | IGNORE_REKOR | true | + | TRUSTED_ARTIFACTS_DEBUG | "true" | + | ORAS_OPTIONS | --plain-http | Then the task should succeed And the task logs for step "show-config" should contain "slsa_provenance_available" From 13ed00d65a1e3c120a3ba387c66e3ba9bb1ee2cd Mon Sep 17 00:00:00 2001 From: Simon Baird Date: Wed, 28 Oct 2026 17:07:26 -0400 Subject: [PATCH 2/3] Build yq for Conforma CLI container images I was thinking I would need it for the "inject data source" script, but I realized I could get away with using jq. Despite that, we've have been talking about doing this for a number of other reasons recently, perhaps it's worth while either way. Ref: https://redhat.atlassian.net/browse/EC-2377 Assisted-by: gpt-6-sol --- .tekton/cli-main-pull-request.yaml | 2 +- .tekton/cli-main-push.yaml | 2 +- Dockerfile | 9 ++- Dockerfile.dist | 9 ++- build.sh | 18 ++++++ tools/yq/go.mod | 39 +++++++++++++ tools/yq/go.sum | 91 ++++++++++++++++++++++++++++++ tools/yq/yq.go | 20 +++++++ 8 files changed, 186 insertions(+), 4 deletions(-) create mode 100644 tools/yq/go.mod create mode 100644 tools/yq/go.sum create mode 100644 tools/yq/yq.go diff --git a/.tekton/cli-main-pull-request.yaml b/.tekton/cli-main-pull-request.yaml index 515d354bd..c93867d44 100644 --- a/.tekton/cli-main-pull-request.yaml +++ b/.tekton/cli-main-pull-request.yaml @@ -33,7 +33,7 @@ spec: - name: path-context value: . - name: prefetch-input - value: '[{"type": "gomod"}, {"type": "gomod", "path": "tools/kubectl"}, {"type": "rpm"}]' + value: '[{"type": "gomod"}, {"type": "gomod", "path": "tools/kubectl"}, {"type": "gomod", "path": "tools/yq"}, {"type": "rpm"}]' - name: build-source-image value: "true" - name: build-args-file diff --git a/.tekton/cli-main-push.yaml b/.tekton/cli-main-push.yaml index 510bff114..fc4de6a5e 100644 --- a/.tekton/cli-main-push.yaml +++ b/.tekton/cli-main-push.yaml @@ -32,7 +32,7 @@ spec: - name: path-context value: . - name: prefetch-input - value: '[{"type": "gomod"}, {"type": "gomod", "path": "tools/kubectl"}, {"type": "rpm"}]' + value: '[{"type": "gomod"}, {"type": "gomod", "path": "tools/kubectl"}, {"type": "gomod", "path": "tools/yq"}, {"type": "rpm"}]' - name: build-source-image value: "true" - name: build-args-file diff --git a/Dockerfile b/Dockerfile index 1ab91de7f..2c0e04dda 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,6 +36,10 @@ RUN go mod download COPY tools/kubectl/go.mod tools/kubectl/go.sum ./tools/kubectl/ RUN cd tools/kubectl && go mod download +# Cache the yq module separately from the source tree +COPY tools/yq/go.mod tools/yq/go.sum ./tools/yq/ +RUN cd tools/yq && go mod download + # Now copy everything including .git COPY . . @@ -74,6 +78,9 @@ COPY --from=build "/build/dist/ec_${TARGETOS}_${TARGETARCH}" /usr/local/bin/ec # Copy the one kubectl binary that can run in this container COPY --from=build "/build/dist/kubectl_${TARGETOS}_${TARGETARCH}" /usr/local/bin/kubectl +# Copy the yq binary for this container's platform +COPY --from=build "/build/dist/yq_${TARGETOS}_${TARGETARCH}" /usr/local/bin/yq + # Copy reduce-snapshot script needed for single component mode COPY hack/reduce-snapshot.sh /usr/local/bin/ @@ -94,6 +101,6 @@ RUN ln -s /usr/local/bin/ec /usr/local/bin/conforma USER 1001 # Show some version numbers for troubleshooting purposes -RUN jq --version && ec version && ls -l /usr/local/bin +RUN jq --version && yq --version && ec version && ls -l /usr/local/bin ENTRYPOINT ["/usr/local/bin/ec"] diff --git a/Dockerfile.dist b/Dockerfile.dist index b183cfabe..e8a969c10 100644 --- a/Dockerfile.dist +++ b/Dockerfile.dist @@ -36,6 +36,10 @@ RUN go mod download COPY tools/kubectl/go.mod tools/kubectl/go.sum ./tools/kubectl/ RUN cd tools/kubectl && go mod download +# Cache the yq module separately from the source tree +COPY tools/yq/go.mod tools/yq/go.sum ./tools/yq/ +RUN cd tools/yq && go mod download + # Now copy everything including .git COPY . . @@ -75,6 +79,9 @@ COPY --from=build "/build/dist/ec_${TARGETOS}_${TARGETARCH}" /usr/local/bin/ec # Copy the one kubectl binary that can run in this container COPY --from=build "/build/dist/kubectl_${TARGETOS}_${TARGETARCH}" /usr/local/bin/kubectl +# Copy the yq binary for this container's platform +COPY --from=build "/build/dist/yq_${TARGETOS}_${TARGETARCH}" /usr/local/bin/yq + # Copy reduce-snapshot script needed for single component mode COPY hack/reduce-snapshot.sh /usr/local/bin/ @@ -95,6 +102,6 @@ RUN ln -s /usr/local/bin/ec /usr/local/bin/conforma USER 1001 # Show some version numbers for troubleshooting purposes -RUN jq --version && ec version && ls -l /usr/local/bin +RUN jq --version && yq --version && ec version && ls -l /usr/local/bin ENTRYPOINT ["/usr/local/bin/ec"] diff --git a/build.sh b/build.sh index 5c827effa..590a00789 100755 --- a/build.sh +++ b/build.sh @@ -83,6 +83,15 @@ build_kubectl() { cp "${kubectlbin}" "dist/$3_$1_$2" } +build_yq() { + GOOS="$1" GOARCH="$2" CGO_ENABLED=0 GOCACHE="$GOCACHE" GOMODCACHE="$GOMODCACHE" go build \ + -modfile tools/yq/go.mod \ + -trimpath \ + -mod=readonly \ + -o "dist/yq_$1_$2" \ + github.com/mikefarah/yq/v4 +} + KUBECTL_VERSION="$(go list -modfile tools/kubectl/go.mod -mod=readonly -f '{{.Version}}' -m k8s.io/kubernetes)" for os_arch in ${BUILDS}; do @@ -97,3 +106,12 @@ for os_arch in ${BUILDS}; do echo "Building ${GOOS}/${GOARCH} of ${KUBECTLBIN} version ${KUBECTL_VERSION}" build_kubectl "${GOOS}" "${GOARCH}" "${KUBECTLBIN}" done + +# yq runs inside the image; unlike ec and kubectl, it is not needed for downloads. +IMAGE_OS="${TARGETOS:-$(go env GOOS)}" +IMAGE_ARCH="${TARGETARCH:-$(go env GOARCH)}" +if [[ "${IMAGE_OS}" == "linux" ]]; then + YQ_VERSION="$(go list -modfile tools/yq/go.mod -mod=readonly -f '{{.Version}}' -m github.com/mikefarah/yq/v4)" + echo "Building ${IMAGE_OS}/${IMAGE_ARCH} of yq version ${YQ_VERSION} for the image" + build_yq "${IMAGE_OS}" "${IMAGE_ARCH}" +fi diff --git a/tools/yq/go.mod b/tools/yq/go.mod new file mode 100644 index 000000000..34f52eb7a --- /dev/null +++ b/tools/yq/go.mod @@ -0,0 +1,39 @@ +module github.com/conforma/cli/tools/yq + +go 1.26.7 + +require github.com/mikefarah/yq/v4 v4.54.3 + +require ( + github.com/a8m/envsubst v1.4.3 // indirect + github.com/agext/levenshtein v1.2.3 // indirect + github.com/alecthomas/participle/v2 v2.1.4 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/apparentlymart/go-textseg/v17 v17.0.1 // indirect + github.com/dimchansky/utfbom v1.2.0 // indirect + github.com/elliotchance/orderedmap v1.8.0 // indirect + github.com/fatih/color v1.19.0 // indirect + github.com/go-ini/ini v1.67.0 // indirect + github.com/goccy/go-json v0.12.0 // indirect + github.com/goccy/go-yaml v1.19.2 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/hashicorp/hcl/v2 v2.25.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jinzhu/copier v0.4.0 // indirect + github.com/magiconair/properties v1.18.13 // indirect + github.com/mattn/go-colorable v0.1.16 // indirect + github.com/mattn/go-isatty v0.0.24 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/pelletier/go-toml/v2 v2.4.3 // indirect + github.com/spf13/cobra v1.10.2 // indirect + github.com/spf13/pflag v1.1.0 // indirect + github.com/yuin/gopher-lua v1.1.2 // indirect + github.com/zclconf/go-cty v1.20.0 // indirect + go.yaml.in/yaml/v4 v4.0.0 // indirect + golang.org/x/mod v0.43.0 // indirect + golang.org/x/net v0.62.0 // indirect + golang.org/x/sync v0.25.0 // indirect + golang.org/x/sys v0.50.0 // indirect + golang.org/x/text v0.44.0 // indirect + golang.org/x/tools v0.52.0 // indirect +) diff --git a/tools/yq/go.sum b/tools/yq/go.sum new file mode 100644 index 000000000..8c8fc14c2 --- /dev/null +++ b/tools/yq/go.sum @@ -0,0 +1,91 @@ +github.com/a8m/envsubst v1.4.3 h1:kDF7paGK8QACWYaQo6KtyYBozY2jhQrTuNNuUxQkhJY= +github.com/a8m/envsubst v1.4.3/go.mod h1:4jjHWQlZoaXPoLQUb7H2qT4iLkZDdmEQiOUogdUmqVU= +github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= +github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8vS6K3D0= +github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= +github.com/alecthomas/participle/v2 v2.1.4 h1:W/H79S8Sat/krZ3el6sQMvMaahJ+XcM9WSI2naI7w2U= +github.com/alecthomas/participle/v2 v2.1.4/go.mod h1:8tqVbpTX20Ru4NfYQgZf4mP18eXPTBViyMWiArNEgGI= +github.com/alecthomas/repr v0.5.4 h1:OVP7JEcuzU9CCDsT6STCr3rg17oQfWILtPWd2EG0uN4= +github.com/alecthomas/repr v0.5.4/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/apparentlymart/go-textseg/v17 v17.0.1 h1:bpMXRgQ5cEoRNuQke1a80/Nl6w3G5eoIbWo9f3gXkAs= +github.com/apparentlymart/go-textseg/v17 v17.0.1/go.mod h1:fa8X4jgGeevslICIY6LcdjkSecWnXmYd9Lk34z/VxZs= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dimchansky/utfbom v1.2.0 h1:ikiGYT9Wa8zleQ0xrlAWC9Ar9LNInSWRodJ5MkHB3d4= +github.com/dimchansky/utfbom v1.2.0/go.mod h1:kJPs9PFVyF/LnFVVGz+XXvouv0KxympBxr0pSwv0KQU= +github.com/elliotchance/orderedmap v1.8.0 h1:TrOREecvh3JbS+NCgwposXG5ZTFHtEsQiCGOhPElnMw= +github.com/elliotchance/orderedmap v1.8.0/go.mod h1:wsDwEaX5jEoyhbs7x93zk2H/qv0zwuhg4inXhDkYqys= +github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= +github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= +github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A= +github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/goccy/go-json v0.12.0 h1:pD+oWouAiz4yruwXIt/iT+lOMeyhr1aTtxzaMP/RgVI= +github.com/goccy/go-json v0.12.0/go.mod h1:3NdmfEkZlB7YI5UFw/qdFKq8XN1aiWR0YyRPWZNQltY= +github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM= +github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/hashicorp/hcl/v2 v2.25.0 h1:HmmQVYRny4MaBo4b20TjmL46wyuUxpnMWkPZ4+NTbWk= +github.com/hashicorp/hcl/v2 v2.25.0/go.mod h1:vR+FKETxoZAmRlHgFfKmuqivj+C4Izm/c66XkmZ3r7M= +github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8= +github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= +github.com/magiconair/properties v1.18.13 h1:UzIwH+0nODFR48wsJaaiWP4oCE1Xvp168ovLKsdqy0c= +github.com/magiconair/properties v1.18.13/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.16 h1:+2YjeAe7xP1OQbZW1jERPWWCDLlNqFNCvjiqGiAt84A= +github.com/mattn/go-colorable v0.1.16/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI= +github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A= +github.com/mikefarah/yq/v4 v4.54.3 h1:1SnmdehRmL1Z56SuPH8IQUW3D73Q74F3mpGWW0jAb3E= +github.com/mikefarah/yq/v4 v4.54.3/go.mod h1:sp5Vt/XocWgI8kulOlHFIevBmubienfQUBd39KiyHXg= +github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= +github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= +github.com/pelletier/go-toml/v2 v2.4.3 h1:GTRvJQutkOSftxIFD5xw9aepkYNuPWmVJpffdDPYVpY= +github.com/pelletier/go-toml/v2 v2.4.3/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.1.0 h1:6W6MbVUrnMb8PEhjkqwsVLY7ryuzRfFHF4mQd7L94ag= +github.com/spf13/pflag v1.1.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/gopher-lua v1.1.2 h1:yF/FjE3hD65tBbt0VXLE13HWS9h34fdzJmrWRXwobGA= +github.com/yuin/gopher-lua v1.1.2/go.mod h1:7aRmXIWl37SqRf0koeyylBEzJ+aPt8A+mmkQ4f1ntR8= +github.com/zclconf/go-cty v1.20.0 h1:V2Mh9pu2xWPATCY7US3LnGBNSq/AAZDsqQZmmOAV7DI= +github.com/zclconf/go-cty v1.20.0/go.mod h1:12W89jGn3JCOIQi7infWr9m80rOkb5RNYJqXMZcN4c8= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw= +go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= +golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg= +golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs= +golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs= +golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo= +golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/yq/yq.go b/tools/yq/yq.go new file mode 100644 index 000000000..312c56f6f --- /dev/null +++ b/tools/yq/yq.go @@ -0,0 +1,20 @@ +// Copyright The Conforma Contributors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: Apache-2.0 + +// Tracks the yq CLI dependency (the executable's main package cannot be imported). +package yq + +import _ "github.com/mikefarah/yq/v4/cmd" From 57c46fd63abd8ffbec099470d68ea82dcc790a32 Mon Sep 17 00:00:00 2001 From: Simon Baird Date: Wed, 28 Oct 2026 17:47:09 -0400 Subject: [PATCH 3/3] Don't cross-compile kubectl binaries I don't think there was ever any good reason to do all that cross-compiling of kubectl. I think it was done that way since that's how the ec build was done. It seems like we don't copy the cross-compiled binaries over to the final image anyway which would have to mean they're 100% unused. https://redhat.atlassian.net/browse/EC-2365 Assisted-by: gpt-6-sol --- build.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.sh b/build.sh index 590a00789..1af7f2a55 100755 --- a/build.sh +++ b/build.sh @@ -92,8 +92,6 @@ build_yq() { github.com/mikefarah/yq/v4 } -KUBECTL_VERSION="$(go list -modfile tools/kubectl/go.mod -mod=readonly -f '{{.Version}}' -m k8s.io/kubernetes)" - for os_arch in ${BUILDS}; do GOOS="${os_arch%_*}" GOARCH="${os_arch#*_}" @@ -101,16 +99,16 @@ for os_arch in ${BUILDS}; do BINFILE="ec_${GOOS}_${GOARCH}${DOT_EXE}" echo "Building ${BINFILE} for ${EC_FULL_VERSION}" build_ec "${GOOS}" "${GOARCH}" "${BINFILE}" "${EC_FULL_VERSION}" - - KUBECTLBIN="kubectl${DOT_EXE}" - echo "Building ${GOOS}/${GOARCH} of ${KUBECTLBIN} version ${KUBECTL_VERSION}" - build_kubectl "${GOOS}" "${GOARCH}" "${KUBECTLBIN}" done -# yq runs inside the image; unlike ec and kubectl, it is not needed for downloads. +# yq and kubectl run inside the image; unlike ec, they are not needed for downloads. IMAGE_OS="${TARGETOS:-$(go env GOOS)}" IMAGE_ARCH="${TARGETARCH:-$(go env GOARCH)}" if [[ "${IMAGE_OS}" == "linux" ]]; then + KUBECTL_VERSION="$(go list -modfile tools/kubectl/go.mod -mod=readonly -f '{{.Version}}' -m k8s.io/kubernetes)" + echo "Building ${IMAGE_OS}/${IMAGE_ARCH} of kubectl version ${KUBECTL_VERSION} for the image" + build_kubectl "${IMAGE_OS}" "${IMAGE_ARCH}" kubectl + YQ_VERSION="$(go list -modfile tools/yq/go.mod -mod=readonly -f '{{.Version}}' -m github.com/mikefarah/yq/v4)" echo "Building ${IMAGE_OS}/${IMAGE_ARCH} of yq version ${YQ_VERSION} for the image" build_yq "${IMAGE_OS}" "${IMAGE_ARCH}"