Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Mezarina <[email protected]>
  • Loading branch information
mezarin committed Jul 22, 2021
1 parent 426519e commit 51d83a7
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This stack is based on OpenJDK with container-optimizations in OpenJ9 and Open L

**Note:** Maven or Gradle is provided by the stack. This allows you to build, test, and debug your Java application without installing those tools locally.

## Getting Started With The Intro Sample
## Getting Started With the Intro Sample

> It's recommended to use the latest version of OpenShift Do (odo). You can install odo using [these instructions](https://odo.dev/docs/installing-odo/)
Expand Down
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ OL_UBI_IMAGE="${OL_UBI_IMAGE:-openliberty/open-liberty:21.0.0.6-full-java11-open
# The name and tag of the stack image you will build. This will used to create your inner loop development containers, and also as the base image for the first stage of your outer loop image build.
#
STACK_IMAGE_MAVEN="${STACK_IMAGE_MAVEN:-openliberty/application-stack:0.6.0}"
STACK_IMAGE_GRADLE="${STACK_IMAGE_GRADLE:-openliberty/application-stack:gradle-0.6.0}"
STACK_IMAGE_GRADLE="${STACK_IMAGE_GRADLE:-openliberty/application-stack:gradle-0.1.0}"

#
# URL at which your outer loop Dockerfile is hosted
#
OUTERLOOP_DOCKERFILE_MAVEN_LOC="${OUTERLOOP_DOCKERFILE_MAVEN_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/maven-0.6.0/Dockerfile}"
OUTERLOOP_DOCKERFILE_GRADLE_LOC="${OUTERLOOP_DOCKERFILE_GRADLE_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/gradle-0.6.0/Dockerfile}"
OUTERLOOP_DOCKERFILE_GRADLE_LOC="${OUTERLOOP_DOCKERFILE_GRADLE_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/gradle-0.1.0/Dockerfile}"

#
# URL at which your outer loop deploy YAML template is hosted
#
DEVFILE_DEPLOY_YAML_MAVEN_LOC="${DEVFILE_DEPLOY_YAML_MAVEN_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/maven-0.6.0/app-deploy.yaml}"
DEVFILE_DEPLOY_YAML_GRADLE_LOC="${DEVFILE_DEPLOY_YAML_GRADLE_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/gradle-0.6.0/app-deploy.yaml}"
DEVFILE_DEPLOY_YAML_GRADLE_LOC="${DEVFILE_DEPLOY_YAML_GRADLE_LOC:-https://github.com/OpenLiberty/application-stack/releases/download/gradle-0.1.0/app-deploy.yaml}"

#
# The previous major microprofile spec API version supported by the stack.
Expand Down
7 changes: 3 additions & 4 deletions stackimage/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Application Stack Gradle

Application stack built with gradle.
# Application Stack

* [Build](#build)
* [Test](#test)

## Build

### Prereq
- Gradle 6.8.3 or later to build artiafcts.
- Gradle 6.8.3 or later.
- Maven 3.6.3 or later.

### Procedure

Expand Down
2 changes: 1 addition & 1 deletion stackimage/priming-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'

dependencies {
providedCompile 'org.eclipse.microprofile:microprofile:4.0'
providedCompile 'org.eclipse.microprofile:microprofile:4.0.1'
providedCompile 'jakarta.platform:jakarta.jakartaee-api:8.0.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testImplementation 'org.microshed:microshed-testing-liberty:0.9'
Expand Down
4 changes: 2 additions & 2 deletions stackimage/scripts/gradle/devbuild-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if [ -e /projects/.disable-bld-cmd ]; then
echo "Found the disable-bld-cmd file" && echo "The devBuild command will not run" && exit 0;
elif [ ! -e /projects/build.gradle ]; then
echo " ERROR: This project does not contain a pom.xml or a build.gradle file. Please correct the issue and try again.";
echo " ERROR: This project does not contain a build.gradle file. Please correct the issue and try again.";
exit 1
else
echo "will run the devBuild command using gradle" && mkdir -p /projects/build
Expand All @@ -12,7 +12,7 @@ else
elif [[ -d /projects/build/wlp && ! -e /projects/.liberty-mv ]]; then
echo "STACK WARNING - LIBERTY RUNTIME WAS LOADED FROM HOST";
fi
gradle -Dgradle.user.home=/.gradle assemble
gradle -Dgradle.user.home=/.gradle assemble -Pliberty.runtime.version=$1
fi

touch ./.disable-bld-cmd
2 changes: 1 addition & 1 deletion stackimage/scripts/maven/devbuild-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if [ -e /projects/.disable-bld-cmd ]; then
echo "Found the disable-bld-cmd file" && echo "The devBuild command will not run" && exit 0;
elif [ ! -e /projects/pom.xml ]; then
echo " ERROR: This project does not contain a pom.xml or a build.gradle file. Please correct the issue and try again.";
echo " ERROR: This project does not contain a pom.xml file. Please correct the issue and try again.";
exit 1
else
echo "will run the devBuild command using maven" && mkdir -p /projects/target/liberty
Expand Down
4 changes: 2 additions & 2 deletions templates/devfiles/gradle/devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
schemaVersion: 2.0.0
metadata:
name: java-openliberty-gradle
version: 0.6.0
version: 0.1.0
description: Java application Gradle built stack using the Open Liberty runtime
alpha.build-dockerfile: "{{.OUTERLOOP_DOCKERFILE_GRADLE_LOC}}"
alpha.deployment-manifest: "{{.DEVFILE_DEPLOY_YAML_GRADLE_LOC}}"
Expand All @@ -42,7 +42,7 @@ commands:
- id: build
exec:
component: devruntime
commandLine: /stack/ol/scripts/gradle/devbuild-cmd.sh
commandLine: /stack/ol/scripts/gradle/devbuild-cmd.sh {{.OL_RUNTIME_VERSION}}
workingDir: /projects
hotReloadCapable: true
group:
Expand Down
2 changes: 1 addition & 1 deletion templates/outer-loop/maven/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ COPY --chown=1001:0 ./pom.xml /work/outer-loop-app/pom.xml
RUN cd /work/outer-loop-app && \
echo "QUICK START SECURITY IS NOT SECURE FOR PRODUCTION ENVIRONMENTS. IT IS BEING REMOVED" && \
rm -f src/main/liberty/config/configDropins/defaults/quick-start-security.xml && \
mvn -e package liberty:create -Dliberty.runtime.version={{.OL_RUNTIME_VERSION}}
mvn -e liberty:create package -Dliberty.runtime.version={{.OL_RUNTIME_VERSION}}

# Process any resources or shared libraries - if they are present in the dependencies block for this project (there may be none potentially)
# test to see if each is present and move to a well known location for later processing in the next stage.
Expand Down
18 changes: 16 additions & 2 deletions test/inner-loop/base-inner-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ while ! echo $livenessResults | grep -qF '{"checks":[{"data":{},"name":"SampleLi
echo "Waiting for liveness check to pass... " && sleep 3
count=`expr $count + 1`
if [ $count -eq 20 ]; then
echo "Timed out waiting for liveness check to pass. Liveness results:"
# Last attempt to perform a liveness check using the health endpoint:
healthEndpointResult=$(curl http://${COMP_NAME}.$(minikube ip).nip.io/health)
if echo $healthEndpointResult | grep -qF '{"data":{},"name":"SampleLivenessCheck","status":"UP"}'; then
break
fi

# Print debug data and exit.
echo "Timed out waiting for the liveness check to pass."
echo $healthEndpointResult
echo $livenessResults
./../../test/utils.sh printLibertyDebugData "component=$COMP_NAME" $PROJ_NAME $LIBERTY_SERVER_LOGS_DIR_PATH
exit 12
Expand All @@ -70,7 +78,13 @@ while ! echo $readinessResults | grep -qF '{"checks":[{"data":{},"name":"SampleR
echo "Waiting for readiness check to pass... " && sleep 3
count=`expr $count + 1`
if [ $count -eq 20 ]; then
echo "Timed out waiting for Readiness check to pass. Readiness results:"
# Last attempt to perform a readiness check using the health endpoint:
healthEndpointResult=$(curl http://${COMP_NAME}.$(minikube ip).nip.io/health)
if echo $healthEndpointResult | grep -qF '{"data":{},"name":"SampleReadinessCheck","status":"UP"}'; then
break
fi
echo "Timed out waiting for the readiness check to pass."
echo $healthEndpointResult
echo $readinessResults
./../../test/utils.sh printLibertyDebugData "component=$COMP_NAME" $PROJ_NAME $LIBERTY_SERVER_LOGS_DIR_PATH
exit 12
Expand Down
24 changes: 20 additions & 4 deletions test/outer-loop/base-outer-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,18 @@ echo -e "\n> Test liveness endpoint"
livenessResults=$(curl http://${COMP_NAME}.$(minikube ip).nip.io/health/live)
count=1
while ! echo $livenessResults | grep -qF '{"checks":[{"data":{},"name":"SampleLivenessCheck","status":"UP"}],"status":"UP"}'; do
echo "Waiting for liveness check to pass... " && sleep 5;
echo "Waiting for the liveness check to pass... " && sleep 5;
count=`expr $count + 1`
if [ $count -eq 20 ]; then
echo "Timed out waiting for liveness check to pass. Liveness results:"
# Last attempt to perform a liveness check using the health endpoint:
healthEndpointResult=$(curl http://${COMP_NAME}.$(minikube ip).nip.io/health)
if echo $healthEndpointResult | grep -qF '{"data":{},"name":"SampleLivenessCheck","status":"UP"}'; then
break
fi

# Print debug data and exit.
echo "Timed out waiting for the liveness check to pass."
echo $healthEndpointResult
echo $livenessResults
echo "App service resource config:"
kubectl describe service ${COMP_NAME} -n ${NAMESPACE}
Expand All @@ -77,10 +85,18 @@ echo -e "\n> Test readiness endpoint"
readinessResults=$(curl http://${COMP_NAME}.$(minikube ip).nip.io/health/ready)
count=1
while ! echo $readinessResults | grep -qF '{"checks":[{"data":{},"name":"SampleReadinessCheck","status":"UP"}],"status":"UP"}'; do
echo "Waiting for readiness check to pass... " && sleep 5;
echo "Waiting for the readiness check to pass... " && sleep 5;
count=`expr $count + 1`
if [ $count -eq 20 ]; then
echo "Timed out waiting for Readiness check to pass. Readiness results:"
# Last attempt to perform a readiness check using the health endpoint:
healthEndpointResult=$(curl http://${COMP_NAME}.$(minikube ip).nip.io/health)
if echo $healthEndpointResult | grep -qF '{"data":{},"name":"SampleReadinessCheck","status":"UP"}'; then
break
fi

# Print debug data and exit.
echo "Timed out waiting for the readiness check to pass."
echo $healthEndpointResult
echo $readinessResults
./../../test/utils.sh printLibertyDebugData "app.kubernetes.io/name=${COMP_NAME}" ${NAMESPACE} $LIBERTY_SERVER_LOGS_DIR_PATH
exit 12
Expand Down

0 comments on commit 51d83a7

Please sign in to comment.