mirror of https://github.com/knative/func.git
chore: use local registry in test (#1976)
* test: use custom buildah image in tests Signed-off-by: Matej Vasek <mvasek@redhat.com> * refactor: rename Signed-off-by: Matej Vasek <mvasek@redhat.com> * test: use internal registry in on cluster tests Signed-off-by: Matej Vasek <mvasek@redhat.com> * chore: more verbose output Signed-off-by: Matej Vasek <mvasek@redhat.com> * fix: use fake ctx until fixing termination properly Signed-off-by: Matej Vasek <mvasek@redhat.com> --------- Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
parent
812855a1e9
commit
452ff50418
|
@ -104,8 +104,8 @@ jobs:
|
|||
run: ./hack/binaries.sh
|
||||
- name: Allocate Cluster
|
||||
run: ./hack/allocate.sh
|
||||
- name: Setup testing func image
|
||||
run: ./hack/create-testing-func-image.sh
|
||||
- name: Setup testing images
|
||||
run: ./hack/setup-testing-images.sh
|
||||
- name: Deploy Tekton
|
||||
run: ./hack/tekton.sh
|
||||
- name: Deploy Test Git Server
|
||||
|
|
|
@ -20,8 +20,8 @@ jobs:
|
|||
run: ./hack/binaries.sh
|
||||
- name: Allocate Cluster
|
||||
run: ./hack/allocate.sh
|
||||
- name: Setup testing func image
|
||||
run: ./hack/create-testing-func-image.sh
|
||||
- name: Setup testing images
|
||||
run: ./hack/setup-testing-images.sh
|
||||
- name: Deploy Tekton
|
||||
run: ./hack/tekton.sh
|
||||
- name: Deploy Test Git Server
|
||||
|
@ -29,6 +29,7 @@ jobs:
|
|||
- name: E2E On Cluster Test (Runtimes)
|
||||
env:
|
||||
TEST_TAGS: runtime
|
||||
E2E_REGISTRY_URL: registry.default.svc.cluster.local:5000
|
||||
FUNC_REPO_REF: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
FUNC_REPO_BRANCH_REF: ${{ github.head_ref }}
|
||||
run: make test-e2e-on-cluster
|
||||
|
|
|
@ -20,8 +20,8 @@ jobs:
|
|||
run: ./hack/binaries.sh
|
||||
- name: Allocate Cluster
|
||||
run: ./hack/allocate.sh
|
||||
- name: Setup testing func image
|
||||
run: ./hack/create-testing-func-image.sh
|
||||
- name: Setup testing images
|
||||
run: ./hack/setup-testing-images.sh
|
||||
- name: Deploy Tekton
|
||||
run: ./hack/tekton.sh
|
||||
- name: Deploy Test Git Server
|
||||
|
|
|
@ -22,10 +22,8 @@ jobs:
|
|||
run: ./hack/registry.sh
|
||||
- name: Allocate Cluster
|
||||
run: ./hack/allocate.sh
|
||||
- name: Setup testing func image
|
||||
run: ./hack/create-testing-func-image.sh
|
||||
- name: Patch S2I Task
|
||||
run: ./hack/patch-s2i-task.sh
|
||||
- name: Setup testing images
|
||||
run: ./hack/setup-testing-images.sh
|
||||
- name: Install Tekton
|
||||
run: ./hack/tekton.sh
|
||||
- name: Set up environment variables
|
||||
|
|
|
@ -78,6 +78,8 @@ containerdConfigPatches:
|
|||
endpoint = ["http://func-registry:5000"]
|
||||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."ghcr.io"]
|
||||
endpoint = ["http://func-registry:5000"]
|
||||
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."quay.io"]
|
||||
endpoint = ["http://func-registry:5000"]
|
||||
EOF
|
||||
sleep 10
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n kube-system --timeout=5m
|
||||
|
@ -124,16 +126,17 @@ dns() {
|
|||
networking() {
|
||||
echo "${em}④ Contour Ingress${me}"
|
||||
|
||||
# Install load balancer
|
||||
echo "Install load balancer."
|
||||
kubectl apply -f "https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml"
|
||||
kubectl wait --namespace metallb-system \
|
||||
--for=condition=ready pod \
|
||||
--selector=app=metallb \
|
||||
--timeout=90s
|
||||
--timeout=300s
|
||||
|
||||
local kind_addr
|
||||
kind_addr="$(docker container inspect func-control-plane | jq '.[0].NetworkSettings.Networks.kind.IPAddress' -r)"
|
||||
|
||||
echo "Setting up address pool."
|
||||
kubectl apply -f - <<EOF
|
||||
apiVersion: metallb.io/v1beta1
|
||||
kind: IPAddressPool
|
||||
|
@ -151,24 +154,24 @@ metadata:
|
|||
namespace: metallb-system
|
||||
EOF
|
||||
|
||||
# Install a properly configured Contour.
|
||||
echo "Install a properly configured Contour."
|
||||
kubectl apply -f "https://github.com/knative/net-contour/releases/download/knative-${contour_version}/contour.yaml"
|
||||
sleep 5
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n contour-external --timeout=5m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n contour-external --timeout=10m
|
||||
|
||||
# Install the Knative Contour controller.
|
||||
echo "Install the Knative Contour controller."
|
||||
kubectl apply -f "https://github.com/knative/net-contour/releases/download/knative-${contour_version}/net-contour.yaml"
|
||||
sleep 5
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=5m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=10m
|
||||
|
||||
# Configure Knative Serving to use Contour.
|
||||
echo "Configure Knative Serving to use Contour."
|
||||
kubectl patch configmap/config-network \
|
||||
--namespace knative-serving \
|
||||
--type merge \
|
||||
--patch '{"data":{"ingress-class":"contour.ingress.networking.knative.dev"}}'
|
||||
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n contour-external --timeout=5m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=5m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n contour-external --timeout=10m
|
||||
kubectl wait pod --for=condition=Ready -l '!job-name' -n knative-serving --timeout=10m
|
||||
}
|
||||
|
||||
eventing() {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KO_DOCKER_REPO="localhost:50000/knative/func"
|
||||
export KO_DOCKER_REPO
|
||||
|
||||
ko build --tags "latest" -B ./cmd/func
|
|
@ -1,21 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script patches the s2i Tekton task, so it recognizes registry.default.svc.cluster.local:5000 as insecure.
|
||||
|
||||
echo "Patching s2i Tekton task to use 'registry.default.svc.cluster.local:5000' as an insecure registry."
|
||||
|
||||
patch pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml <<EOF
|
||||
diff --git a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
|
||||
index a6973d70..f2bdb5d6 100644
|
||||
--- a/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
|
||||
+++ b/pkg/pipelines/resources/tekton/task/func-s2i/0.1/func-s2i.yaml
|
||||
@@ -102,6 +102,8 @@ spec:
|
||||
image: quay.io/buildah/stable:v1.27.0
|
||||
workingDir: /gen-source
|
||||
script: |
|
||||
+ export BUILD_REGISTRY_SOURCES='{"insecureRegistries": ["registry.default.svc.cluster.local:5000"]}'
|
||||
+
|
||||
TLS_VERIFY_FLAG=""
|
||||
if [ "\$(params.TLSVERIFY)" = "false" ] || [ "\$(params.TLSVERIFY)" = "0" ]; then
|
||||
TLS_VERIFY_FLAG="--tls-verify=false"
|
||||
EOF
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
KO_DOCKER_REPO="localhost:50000/knative/func"
|
||||
export KO_DOCKER_REPO
|
||||
|
||||
ko build --tags "latest" -B ./cmd/func
|
||||
|
||||
# Build custom buildah image for tests.
|
||||
# This image will accept registries ending with .cluster.local as insecure (non-TLS).
|
||||
docker build . -f - -t localhost:50000/buildah/stable:v1.31.0 <<EOF
|
||||
FROM quay.io/buildah/stable:v1.31.0
|
||||
RUN echo -e '\n[[registry]]\nprefix = "*.cluster.local"\ninsecure = true' >> '/etc/containers/registries.conf'
|
||||
EOF
|
||||
docker push localhost:50000/buildah/stable:v1.31.0
|
|
@ -82,7 +82,7 @@ func (c *contextDialer) DialContext(ctx context.Context, network string, addr st
|
|||
stderrBuff := bytes.NewBuffer(nil)
|
||||
ctrStderr := io.MultiWriter(stderrBuff, detectConnSuccess(connectSuccess))
|
||||
|
||||
err := c.exec(ctx, addr, ctrStdin, ctrStdout, ctrStderr)
|
||||
err := c.exec(context.TODO(), addr, ctrStdin, ctrStdout, ctrStderr)
|
||||
if err != nil {
|
||||
stderrStr := stderrBuff.String()
|
||||
socatErr := tryParseSocatError(network, addr, stderrStr)
|
||||
|
@ -268,7 +268,7 @@ func (c *contextDialer) startDialerPod(ctx context.Context) (err error) {
|
|||
|
||||
// attaching to the stdin to automatically Complete the pod on exit
|
||||
go func() {
|
||||
_ = attach(ctx, c.coreV1.RESTClient(), c.restConf, c.podName, c.namespace, emptyBlockingReader(c.detachChan), io.Discard, io.Discard)
|
||||
_ = attach(context.TODO(), c.coreV1.RESTClient(), c.restConf, c.podName, c.namespace, emptyBlockingReader(c.detachChan), io.Discard, io.Discard)
|
||||
}()
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue