mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 18:54:06 +00:00
Merge pull request #130453 from BenTheElder/gotoolchain-kms
kms-e2e: use setup_env / respect GOTOOLCHAIN / use kube-cross image
This commit is contained in:
commit
949abfc34f
@ -137,8 +137,6 @@ dependencies:
|
|||||||
- path: build/build-image/cross/VERSION
|
- path: build/build-image/cross/VERSION
|
||||||
- path: hack/lib/golang.sh
|
- path: hack/lib/golang.sh
|
||||||
match: minimum_go_version=go([0-9]+\.[0-9]+)
|
match: minimum_go_version=go([0-9]+\.[0-9]+)
|
||||||
- path: staging/src/k8s.io/kms/internal/plugins/_mock/Dockerfile
|
|
||||||
match: golang:([0-9]+\.[0-9]+).0-bullseye
|
|
||||||
|
|
||||||
- name: "registry.k8s.io/kube-cross: dependents"
|
- name: "registry.k8s.io/kube-cross: dependents"
|
||||||
version: v1.33.0-go1.24.0-bullseye.0
|
version: v1.33.0-go1.24.0-bullseye.0
|
||||||
|
@ -12,7 +12,10 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM golang:1.24.0-bullseye as builder
|
# NOTE: this is just a default placeholder for convenience
|
||||||
|
# To build this image properly, please invoke test/e2e/testing-manifests/auth/encrypt/run-e2e.sh
|
||||||
|
ARG BUILDER_IMAGE=golang:latest
|
||||||
|
FROM $BUILDER_IMAGE AS builder
|
||||||
|
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
|
|
||||||
@ -23,6 +26,7 @@ WORKDIR /workspace/kms/internal/plugins/_mock
|
|||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
ARG GOTOOLCHAIN
|
||||||
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o mock-kms-plugin plugin.go
|
RUN CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o mock-kms-plugin plugin.go
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
@ -25,6 +25,10 @@ set -o errexit
|
|||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/../../../../.. && pwd -P)"
|
||||||
|
source "${KUBE_ROOT}/hack/lib/init.sh"
|
||||||
|
source "${KUBE_ROOT}/build/common.sh"
|
||||||
|
|
||||||
readonly cluster_name="kms"
|
readonly cluster_name="kms"
|
||||||
readonly registry_name="kind-registry"
|
readonly registry_name="kind-registry"
|
||||||
readonly kind_network="kind"
|
readonly kind_network="kind"
|
||||||
@ -35,6 +39,8 @@ build_and_push_mock_plugin() {
|
|||||||
--no-cache \
|
--no-cache \
|
||||||
--platform linux/amd64 \
|
--platform linux/amd64 \
|
||||||
--output=type=docker \
|
--output=type=docker \
|
||||||
|
--build-arg=GOTOOLCHAIN="${GOTOOLCHAIN:?}" \
|
||||||
|
--build-arg=BUILDER_IMAGE="${KUBE_CROSS_IMAGE:?}:${KUBE_CROSS_VERSION:?}" \
|
||||||
-t localhost:5000/mock-kms-provider:e2e \
|
-t localhost:5000/mock-kms-provider:e2e \
|
||||||
-f staging/src/k8s.io/kms/internal/plugins/_mock/Dockerfile staging/src/k8s.io/ \
|
-f staging/src/k8s.io/kms/internal/plugins/_mock/Dockerfile staging/src/k8s.io/ \
|
||||||
--progress=plain;
|
--progress=plain;
|
||||||
@ -136,18 +142,23 @@ main(){
|
|||||||
export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
|
export ARTIFACTS="${ARTIFACTS:-${PWD}/_artifacts}"
|
||||||
mkdir -p "${ARTIFACTS}"
|
mkdir -p "${ARTIFACTS}"
|
||||||
|
|
||||||
export GO111MODULE=on;
|
kube::golang::setup_env
|
||||||
go install sigs.k8s.io/kind@latest;
|
(
|
||||||
go install sigs.k8s.io/kubetest2@latest;
|
# just while installing external tools
|
||||||
go install sigs.k8s.io/kubetest2/kubetest2-kind@latest;
|
export GO111MODULE=on GOTOOLCHAIN=auto
|
||||||
go install sigs.k8s.io/kubetest2/kubetest2-tester-ginkgo@latest;
|
# TODO: consider using specific versions to avoid surprise breaking changes
|
||||||
|
go install sigs.k8s.io/kind@latest
|
||||||
|
go install sigs.k8s.io/kubetest2@latest
|
||||||
|
go install sigs.k8s.io/kubetest2/kubetest2-kind@latest
|
||||||
|
go install sigs.k8s.io/kubetest2/kubetest2-tester-ginkgo@latest
|
||||||
|
)
|
||||||
|
|
||||||
# The build e2e.test, ginkgo and kubectl binaries + copy to dockerized dir is
|
# The build e2e.test, ginkgo and kubectl binaries + copy to dockerized dir is
|
||||||
# because of https://github.com/kubernetes-sigs/kubetest2/issues/184
|
# because of https://github.com/kubernetes-sigs/kubetest2/issues/184
|
||||||
make all WHAT="test/e2e/e2e.test vendor/github.com/onsi/ginkgo/v2/ginkgo cmd/kubectl";
|
make all WHAT="test/e2e/e2e.test vendor/github.com/onsi/ginkgo/v2/ginkgo cmd/kubectl"
|
||||||
mkdir -p _output/dockerized/bin/linux/amd64;
|
mkdir -p _output/dockerized/bin/linux/amd64;
|
||||||
for binary in kubectl e2e.test ginkgo; do
|
for binary in kubectl e2e.test ginkgo; do
|
||||||
cp -f _output/local/go/bin/${binary} _output/dockerized/bin/linux/amd64/${binary};
|
cp -f _output/local/go/bin/${binary} _output/dockerized/bin/linux/amd64/${binary}
|
||||||
done;
|
done;
|
||||||
|
|
||||||
create_registry
|
create_registry
|
||||||
|
Loading…
Reference in New Issue
Block a user