-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Stop race condition on cloud event YAML test #1517
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ apiVersion: v1 | |
kind: Service | ||
metadata: | ||
name: sink | ||
namespace: default | ||
spec: | ||
selector: | ||
app: cloudevent | ||
|
@@ -17,7 +16,6 @@ metadata: | |
labels: | ||
app: cloudevent | ||
name: message-sink | ||
namespace: default | ||
spec: | ||
containers: | ||
- env: | ||
|
@@ -67,6 +65,7 @@ apiVersion: tekton.dev/v1alpha1 | |
kind: Task | ||
metadata: | ||
name: send-cloud-event-task | ||
|
||
spec: | ||
outputs: | ||
resources: | ||
|
@@ -75,6 +74,30 @@ spec: | |
- name: notification | ||
type: cloudEvent | ||
steps: | ||
- name: wait-for-sink | ||
image: python:3-alpine | ||
imagePullPolicy: IfNotPresent | ||
command: ["/bin/sh"] | ||
args: | ||
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. Do we want to use 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. I can prepare the PR, we can decide to merge it later, but it would be good to have updated examples when 0.9 goes out. |
||
- -ce | ||
- | | ||
cat <<EOF | python | ||
import http.client | ||
import json | ||
import sys | ||
import time | ||
|
||
while True: | ||
conn = http.client.HTTPConnection("sink:8080") | ||
try: | ||
conn.request("GET", "/") | ||
break | ||
except: | ||
# Perhaps the service is not setup yet, so service name does not | ||
# resolve or it does not accept connections on 8080 yet | ||
print("Not yet...") | ||
time.sleep(10) | ||
EOF | ||
- name: build-index-json | ||
image: busybox | ||
command: | ||
|
@@ -83,8 +106,7 @@ spec: | |
- -ce | ||
- | | ||
set -e | ||
mkdir -p /builder/home/image-outputs/myimage/ | ||
cat <<EOF > /builder/home/image-outputs/myimage/index.json | ||
cat <<EOF > $(outputs.resources.myimage.path)/index.json | ||
{ | ||
"schemaVersion": 2, | ||
"manifests": [ | ||
|
@@ -117,7 +139,7 @@ spec: | |
import time | ||
|
||
while True: | ||
conn = http.client.HTTPConnection("sink.default:8080") | ||
conn = http.client.HTTPConnection("sink:8080") | ||
try: | ||
conn.request("GET", "/") | ||
except: | ||
|
@@ -140,6 +162,7 @@ spec: | |
else: | ||
print("Not yet...") | ||
time.sleep(10) | ||
EOF | ||
--- | ||
apiVersion: tekton.dev/v1alpha1 | ||
kind: TaskRun | ||
|
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.
This is the default, so I think we can just omit it for brevity.
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.
nice catch, thanks