Skip to content

Commit

Permalink
(Fixes tektoncd#481) replace registry sidecar with registry reployment
Browse files Browse the repository at this point in the history
The end to end test attaches a sidecar with a image registry for tasks to push into to. However, the function add_sidecar_registry sets the sidecar registry instead of appending it. Removing the function from test to remove this bug. There is a local registry being added to the test that is deployed with deployment and svc. The svc is referenced during the test instead of the sidecar. tektoncd#481
  • Loading branch information
popcor255 committed Aug 14, 2020
1 parent 9a4c087 commit 3a5d60a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 19 deletions.
32 changes: 19 additions & 13 deletions task/docker-build/0.1/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ spec:
- name: push_extra_args
description: Extra parameters passed for the push command when pushing images.
default: ""
- name: docker_host
description: Connect to the sidecar over TCP, with TLS.
default: "tcp://localhost:2376"
- name: docker_tls_verify
description: Verify TLS
default: '1'
- name: docker_cert_path
description: Use the certs generated by the sidecar daemon.
default: /certs/client
- name: docker_opts
description: Use to specify docker options
default:
- --storage-driver=vfs
- --userland-proxy=false
- --debug
workspaces:
- name: source
results:
Expand All @@ -43,15 +58,12 @@ spec:
- name: docker-build
image: $(params.builder_image)
env:
# Connect to the sidecar over TCP, with TLS.
- name: DOCKER_HOST
value: tcp://localhost:2376
# Verify TLS.
value: $(params.docker_host)
- name: DOCKER_TLS_VERIFY
value: '1'
# Use the certs generated by the sidecar daemon.
value: $(params.docker_tls_verify)
- name: DOCKER_CERT_PATH
value: /certs/client
value: $(params.docker_cert_path)
workingDir: $(workspaces.source.path)
script: |
docker build \
Expand All @@ -64,13 +76,10 @@ spec:
- name: docker-push
image: $(params.builder_image)
env:
# Connect to the sidecar over TCP, with TLS.
- name: DOCKER_HOST
value: tcp://localhost:2376
# Verify TLS.
- name: DOCKER_TLS_VERIFY
value: '1'
# Use the certs generated by the sidecar daemon.
- name: DOCKER_CERT_PATH
value: /certs/client
workingDir: $(workspaces.source.path)
Expand All @@ -82,10 +91,7 @@ spec:
sidecars:
- image: docker:dind
name: server
args:
- --storage-driver=vfs
- --userland-proxy=false
- --debug
args: ["$(params.docker_opts[*])"]
securityContext:
privileged: true
env:
Expand Down
4 changes: 0 additions & 4 deletions task/docker-build/0.1/tests/pre-apply-task-hook.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/usr/bin/env bash

# Add an internal registry as sidecar to the task so we can upload it directly
# from our tests without having to go to an external registry.
add_sidecar_registry ${TMPF}

# Add git-clone
kubectl -n ${tns} apply -f ./task/git-clone/0.1/git-clone.yaml
47 changes: 46 additions & 1 deletion task/docker-build/0.1/tests/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: docker-test-pipeline
namespace: docker-build-0-1
spec:
workspaces:
- name: shared-workspace
Expand Down Expand Up @@ -30,16 +31,60 @@ spec:
workspace: shared-workspace
params:
- name: image
value: localhost:5000/nocode
value: registry.docker-build-0-1.svc.cluster.local:5000/nocode
- name: docker_opts
value:
- --storage-driver=vfs
- --userland-proxy=false
- --debug
- --insecure-registry=registry.docker-build-0-1.svc.cluster.local:5000
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: docker-test-pipeline-run
namespace: docker-build-0-1
spec:
pipelineRef:
name: docker-test-pipeline
workspaces:
- name: shared-workspace
persistentvolumeclaim:
claimName: docker-source-pvc
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: registry-docker-build-local
namespace: docker-build-0-1
spec:
selector:
matchLabels:
app: registry-docker-build-local
template:
metadata:
labels:
app: registry-docker-build-local
spec:
containers:
- name: registry-docker-build-local
image: registry:2
resources:
limits:
memory: "128Mi"
cpu: "500m"
ports:
- containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
name: registry
namespace: docker-build-0-1
spec:
selector:
app: registry-docker-build-local
ports:
- port: 5000
targetPort: 5000
---
2 changes: 1 addition & 1 deletion test/e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST_YAML_IGNORES=${TEST_YAML_IGNORES:-""}

# Allow ignoring some yaml tests, space separated, should be the basename of the
# test for example "s2i"
TEST_TASKRUN_IGNORES=${TEST_TASKRUN_IGNORES:-"docker-build"}
TEST_TASKRUN_IGNORES=${TEST_TASKRUN_IGNORES:-""}

set -ex
set -o pipefail
Expand Down

0 comments on commit 3a5d60a

Please sign in to comment.