Skip to content
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

Declare missing debug endpoints #122

Merged
merged 4 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion stacks/java-maven/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: java-maven
version: 1.1.1
version: 1.2.0
displayName: Maven Java
description: Upstream Maven and OpenJDK 11
tags:
Expand All @@ -24,6 +24,9 @@ components:
endpoints:
- name: http-maven
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
volumeMounts:
- name: m2
path: /home/user/.m2
Expand Down
7 changes: 5 additions & 2 deletions stacks/java-openliberty-gradle/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
schemaVersion: 2.1.0
metadata:
name: java-openliberty-gradle
version: 0.3.1
displayName: Open Liberty Gradle
version: 0.4.0
displayName: 'Open Liberty Gradle'
description: Java application Gradle-built stack using the Open Liberty runtime
icon: https://raw.githubusercontent.com/OpenLiberty/logos/7fbb132949b9b2589e18c8d5665c1b107028a21d/logomark/svg/OL_logomark.svg
tags:
Expand Down Expand Up @@ -55,6 +55,9 @@ components:
name: http-gradle
targetPort: 9080
protocol: http
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
7 changes: 5 additions & 2 deletions stacks/java-openliberty/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
schemaVersion: 2.1.0
metadata:
name: java-openliberty
version: 0.8.1
displayName: Open Liberty Maven
version: 0.9.0
displayName: 'Open Liberty Maven'
description: Java application Maven-built stack using the Open Liberty runtime
icon: https://raw.githubusercontent.com/OpenLiberty/logos/7fbb132949b9b2589e18c8d5665c1b107028a21d/logomark/svg/OL_logomark.svg
tags:
Expand Down Expand Up @@ -57,6 +57,9 @@ components:
name: http-openlib
targetPort: 9080
protocol: http
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
5 changes: 4 additions & 1 deletion stacks/java-quarkus/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: java-quarkus
version: 1.2.1
version: 1.3.0
website: https://quarkus.io
displayName: Quarkus Java
description: Quarkus with Java
Expand Down Expand Up @@ -31,6 +31,9 @@ components:
endpoints:
- name: http-quarkus
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
5 changes: 4 additions & 1 deletion stacks/java-springboot/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: java-springboot
version: 1.1.1
version: 1.2.0
displayName: Spring Boot®
description: Spring Boot® using Java
tags:
Expand All @@ -25,6 +25,9 @@ components:
endpoints:
- name: http-springboot
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
volumeMounts:
- name: m2
path: /home/user/.m2
Expand Down
5 changes: 4 additions & 1 deletion stacks/java-vertx/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: java-vertx
version: 1.1.1
version: 1.2.0
displayName: Vert.x Java
description: Upstream Vert.x using Java
icon: https://raw.githubusercontent.com/vertx-web-site/vertx-logo/master/vertx-logo.svg
Expand Down Expand Up @@ -96,6 +96,9 @@ components:
name: http-vertx
targetPort: 8080
protocol: http
- exposure: none
name: debug
targetPort: 5858
image: quay.io/eclipse/che-java11-maven:next
memoryLimit: 512Mi
mountSources: true
Expand Down
7 changes: 5 additions & 2 deletions stacks/java-websphereliberty-gradle/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
schemaVersion: 2.1.0
metadata:
name: java-websphereliberty-gradle
version: 0.3.1
displayName: WebSphere Liberty Gradle
version: 0.4.0
displayName: 'WebSphere Liberty Gradle'
description: Java application Gradle-built stack using the WebSphere Liberty runtime
icon: https://raw.githubusercontent.com/WASdev/logos/main/liberty-was-500-purple.svg
tags:
Expand Down Expand Up @@ -56,6 +56,9 @@ components:
name: http-webgradle
targetPort: 9080
protocol: http
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
7 changes: 5 additions & 2 deletions stacks/java-websphereliberty/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
schemaVersion: 2.1.0
metadata:
name: java-websphereliberty
version: 0.8.1
displayName: WebSphere Liberty Maven
version: 0.9.0
displayName: 'WebSphere Liberty Maven'
description: Java application Maven-built stack using the WebSphere Liberty runtime
icon: https://raw.githubusercontent.com/WASdev/logos/main/liberty-was-500-purple.svg
tags:
Expand Down Expand Up @@ -58,6 +58,9 @@ components:
name: http-websphere
targetPort: 9080
protocol: http
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
5 changes: 4 additions & 1 deletion stacks/java-wildfly-bootable-jar/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: java-wildfly-bootable-jar
version: 1.0.6
version: 1.1.0
website: https://docs.wildfly.org/bootablejar/
displayName: WildFly Bootable Jar
description: Java stack with WildFly in bootable Jar mode, OpenJDK 11 and Maven 3.5
Expand Down Expand Up @@ -133,6 +133,9 @@ components:
endpoints:
- name: http-wildjar
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
- name: m2-repository
volume:
size: 3Gi
Expand Down
5 changes: 4 additions & 1 deletion stacks/java-wildfly/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: java-wildfly
version: 1.0.6
version: 1.1.0
website: https://wildfly.org
displayName: WildFly Java
description: Upstream WildFly
Expand Down Expand Up @@ -117,6 +117,9 @@ components:
endpoints:
- name: http-wildfly
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
- name: m2-repository
volume:
size: 3Gi
Expand Down
5 changes: 4 additions & 1 deletion stacks/nodejs/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: nodejs
version: 2.0.1
version: 2.1.0
displayName: Node.js Runtime
description: Stack with Node.js 16
icon: https://nodejs.org/static/images/logos/nodejs-new-pantone-black.svg
Expand All @@ -26,6 +26,9 @@ components:
endpoints:
- name: http-node
targetPort: 3000
- exposure: none
name: debug
targetPort: 5858
commands:
- id: install
exec:
Expand Down
5 changes: 4 additions & 1 deletion stacks/python-django/devfile.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schemaVersion: 2.1.0
metadata:
name: python-django
version: 2.0.1
version: 2.1.0
displayName: Django
description:
'Django is a high-level Python web framework that enables rapid development of secure and maintainable websites.
Expand Down Expand Up @@ -29,6 +29,9 @@ components:
endpoints:
- name: http-django
targetPort: 8000
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
5 changes: 4 additions & 1 deletion stacks/python/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
- Python
- Pip
- Flask
version: 2.0.2
version: 2.1.0
starterProjects:
- name: flask-example
description:
Expand All @@ -31,6 +31,9 @@ components:
endpoints:
- name: http-python
targetPort: 8080
- exposure: none
name: debug
targetPort: 5858
env:
- name: DEBUG_PORT
value: '5858'
Expand Down
25 changes: 12 additions & 13 deletions tests/check_odov2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,19 @@ test() {
fi

if [ "$ENV" = "minikube" ]; then
# ToDo: Clean up, I'm not happy about having specific checks for the stacks with multiple ports
# But since we're testing against minikube, we need to specifically create the URL/ingress before pushing
# And if there's multiple ports in the devfile, a port must be specified.
if [ "$devfileName" = "java-wildfly" ] || [ "$devfileName" = "java-wildfly-bootable-jar" ]; then
$ODO_PATH url create --host "$(minikube ip).nip.io" --port 8080 || error=true
$ODO_PATH url create --host "$(minikube ip).nip.io" --port 16686 || error=true
exposedEndpoints=$("$YQ_PATH" e '.components[].container.endpoints[] | select (.exposure != "none" and .exposure != "internal").targetPort' "$devfilePath")
if [ "$exposedEndpoints" = "" ] || [ "$exposedEndpoints" = "null" ]; then
echo "WARN Devfile at path $devfilePath has no endpoints => no URL will be created."
else
$ODO_PATH url create --host "$(minikube ip).nip.io" || error=true
fi
if $error; then
echo "ERROR url create failed"
$ODO_PATH project delete -f "$devfileName"
FAILED_TESTS="$FAILED_TESTS $devfileName"
return 1
for ep in $exposedEndpoints; do
"$ODO_PATH" url create --host "$(minikube ip).nip.io" --port "$ep" || error=true
done
if $error; then
echo "ERROR url create failed"
$ODO_PATH project delete -f "$devfileName"
FAILED_TESTS="$FAILED_TESTS $devfileName"
return 1
fi
fi
fi

Expand Down
31 changes: 29 additions & 2 deletions tests/odov3/odo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,36 @@ func waitForPort(devError chan error) ([]ForwardedPort, error) {
continue
}

if len(component.DevForwardedPorts) > 0 {
// get list ports that we should wait for
// this ignores ports that have exposure set to "none" or "internal"
ports := []int{}
for _, component := range component.DevfileData.Devfile.Components {
if component.Container != nil {
for _, endpoint := range component.Container.Endpoints {
if endpoint.Exposure == "none" || endpoint.Exposure == "internal" {
continue
}
ports = append(ports, endpoint.TargetPort)
}
}
}

GinkgoWriter.Printf("Checking if following %v ports have port-forwarding setup.\n", ports)

if len(component.DevForwardedPorts) >= len(ports) {
GinkgoWriter.Println("Found ports", component.DevForwardedPorts)
return component.DevForwardedPorts, nil

out := []ForwardedPort{}
// return only ports that we were waiting for
for _, forwardedPort := range component.DevForwardedPorts {
for _, port := range ports {
if forwardedPort.ContainerPort == port {
out = append(out, forwardedPort)
}
}
}

return out, nil
}
delay += 10 * time.Second
time.Sleep(delay)
Expand Down