Skip to content

Commit

Permalink
Merge pull request #836 from xstefank/lra-disable-tls
Browse files Browse the repository at this point in the history
Disable TLS in LRA quickstart
  • Loading branch information
emmartins authored Jan 9, 2024
2 parents 5a53de4 + 7687df9 commit e73c60c
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .ci/openshift-ci/build-root/scripts/overridable-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ function isOptimizedModeDisabled() {
echo "0"
}

# Whether to disable TLS route.
# Default is to not do anything.
# To disable TLS routes, override this method change the body to 'echo "1"'
function disableTlsRoute() {
echo ""
}

# If the Helm variables set by the parent script (e.g. 'build.enabled') need a prefix, return
# that here. If e.g "wildfly." is returned, the resulting 'build.enabled' becomes 'wildfly.build.enabled'
function getHelmSetVariablePrefix() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Use insecure route for this QS
function disableTlsRoute() {
echo "1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ fi
# These functions are from overridable-functions.sh
application=$(applicationName "${qs_dir}")
helm_set_arg_prefix=$(getHelmSetVariablePrefix)
server_protocol="https"
disableTlsRoute=$(disableTlsRoute)
if [ "1" = "${disableTlsRoute}" ]; then
server_protocol="http"
fi

################################################################################################
# Install any pre-requisites. Function is from overridable-functions.sh
Expand Down Expand Up @@ -183,7 +188,7 @@ if [ "${QS_UNSIGNED_SERVER_CERT}" = "1" ]; then
fi


mvnVerifyArguments="-Dserver.host=https://${route} ${QS_MAVEN_REPOSITORY} ${truststore_properties}"
mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} ${QS_MAVEN_REPOSITORY} ${truststore_properties}"
extraMvnVerifyArguments="$(getMvnVerifyExtraArguments)"
echo "Verify Arguments: ${mvnVerifyArguments}"
if [ -n "${extraMvnVerifyArguments}" ]; then
Expand Down
1 change: 1 addition & 0 deletions microprofile-lra/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The `microprofile-lra` quickstart demonstrates the use of the MicroProfile LRA s
:custom-bootable-jar-layers:
:custom-openshift-layers:
:extra-openshift-test-arguments:
:requires-http-route:

== What is it?

Expand Down
5 changes: 4 additions & 1 deletion microprofile-lra/charts/helm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@ build:
ref: main
contextDir: microprofile-lra
deploy:
replicas: 1
replicas: 1
route:
tls:
enabled: false
16 changes: 16 additions & 0 deletions shared-doc/helm-deploy-project.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ oc get deployment {helm-app-name}

The Helm Chart for this quickstart contains all the information to build an image from the source code using S2I on Java 17:

ifndef::requires-http-route[]
[source,options="nowrap",subs="+attributes"]
----
build:
Expand All @@ -32,6 +33,21 @@ build:
deploy:
replicas: 1
----
endif::requires-http-route[]
ifdef::requires-http-route[]
[source,options="nowrap",subs="+attributes"]
----
build:
uri: {githubRepoCodeUrl}
ref: {WildFlyQuickStartRepoTag}
contextDir: {artifactId}
deploy:
replicas: 1
route:
tls:
enabled: false
----
endif::requires-http-route[]

This will create a new deployment on OpenShift and deploy the application.

Expand Down
8 changes: 8 additions & 0 deletions shared-doc/run-integration-tests-with-openshift.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ endif::extra-openshift-testing-actions[]
ifndef::extra-openshift-test-arguments[:extra-openshift-test-arguments:]

Run the integration tests using the following command to run the `verify` goal with the `integration-testing` profile activated and the proper URL:
ifndef::requires-http-route[]
[source,options="nowrap",subs="+attributes"]
----
$ mvn verify -Pintegration-testing -Dserver.host=https://$(oc get route {helm-app-name} --template='{{ .spec.host }}') {extra-openshift-test-arguments}
----
endif::requires-http-route[]
ifdef::requires-http-route[]
[source,options="nowrap",subs="+attributes"]
----
$ mvn verify -Pintegration-testing -Dserver.host=http://$(oc get route {helm-app-name} --template='{{ .spec.host }}') {extra-openshift-test-arguments}
----
endif::requires-http-route[]

[NOTE]
====
Expand Down

0 comments on commit e73c60c

Please sign in to comment.