diff --git a/README.md b/README.md index d6c7495..4c7341d 100644 --- a/README.md +++ b/README.md @@ -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/) diff --git a/build.sh b/build.sh index bfd8c74..9051d29 100755 --- a/build.sh +++ b/build.sh @@ -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. diff --git a/stackimage/README.md b/stackimage/README.md index 8f05013..e31d9fa 100644 --- a/stackimage/README.md +++ b/stackimage/README.md @@ -1,6 +1,4 @@ -# Application Stack Gradle - -Application stack built with gradle. +# Application Stack * [Build](#build) * [Test](#test) @@ -8,7 +6,8 @@ Application stack built with gradle. ## Build ### Prereq -- Gradle 6.8.3 or later to build artiafcts. +- Gradle 6.8.3 or later. +- Maven 3.6.3 or later. ### Procedure diff --git a/stackimage/priming-app/build.gradle b/stackimage/priming-app/build.gradle index b27a4a8..1456705 100644 --- a/stackimage/priming-app/build.gradle +++ b/stackimage/priming-app/build.gradle @@ -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' diff --git a/stackimage/priming-app/pom.xml b/stackimage/priming-app/pom.xml index ad18759..62138d0 100644 --- a/stackimage/priming-app/pom.xml +++ b/stackimage/priming-app/pom.xml @@ -28,7 +28,7 @@ 3.0.0-M1 3.0.0-M1 3.3.4 - 4.0 + 4.0.1 8.0.0 ${project.artifactId} diff --git a/stackimage/scripts/gradle/devbuild-cmd.sh b/stackimage/scripts/gradle/devbuild-cmd.sh index 34a848a..bb6fb19 100644 --- a/stackimage/scripts/gradle/devbuild-cmd.sh +++ b/stackimage/scripts/gradle/devbuild-cmd.sh @@ -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 @@ -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 \ No newline at end of file diff --git a/stackimage/scripts/maven/devbuild-cmd.sh b/stackimage/scripts/maven/devbuild-cmd.sh index 1139ef8..ff2d554 100644 --- a/stackimage/scripts/maven/devbuild-cmd.sh +++ b/stackimage/scripts/maven/devbuild-cmd.sh @@ -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 diff --git a/templates/devfiles/gradle/devfile.yaml b/templates/devfiles/gradle/devfile.yaml index e000e3e..547c2d7 100644 --- a/templates/devfiles/gradle/devfile.yaml +++ b/templates/devfiles/gradle/devfile.yaml @@ -17,8 +17,12 @@ schemaVersion: 2.0.0 metadata: name: java-openliberty-gradle - version: 0.6.0 + version: 0.1.0 + displayName: "Open Liberty Gradle" description: Java application Gradle built stack using the Open Liberty runtime + tags: ["Java", "Gradle"] + language: "java" + projectType: "docker" alpha.build-dockerfile: "{{.OUTERLOOP_DOCKERFILE_GRADLE_LOC}}" alpha.deployment-manifest: "{{.DEVFILE_DEPLOY_YAML_GRADLE_LOC}}" starterProjects: @@ -42,7 +46,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: diff --git a/templates/devfiles/maven/devfile.yaml b/templates/devfiles/maven/devfile.yaml index 52c7c9e..84930c7 100644 --- a/templates/devfiles/maven/devfile.yaml +++ b/templates/devfiles/maven/devfile.yaml @@ -18,7 +18,11 @@ schemaVersion: 2.0.0 metadata: name: java-openliberty version: 0.6.0 + displayName: "Open Liberty Maven" description: Java application stack using Open Liberty runtime + tags: ["Java", "Maven"] + language: "java" + projectType: "docker" alpha.build-dockerfile: "{{.OUTERLOOP_DOCKERFILE_MAVEN_LOC}}" alpha.deployment-manifest: "{{.DEVFILE_DEPLOY_YAML_MAVEN_LOC}}" starterProjects: diff --git a/templates/outer-loop/maven/Dockerfile b/templates/outer-loop/maven/Dockerfile index 2cb44f7..2f34545 100644 --- a/templates/outer-loop/maven/Dockerfile +++ b/templates/outer-loop/maven/Dockerfile @@ -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. diff --git a/test/inner-loop/base-inner-loop.sh b/test/inner-loop/base-inner-loop.sh index 28fdc92..871d190 100755 --- a/test/inner-loop/base-inner-loop.sh +++ b/test/inner-loop/base-inner-loop.sh @@ -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 @@ -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 diff --git a/test/outer-loop/base-outer-loop.sh b/test/outer-loop/base-outer-loop.sh index 07cb842..bec0edb 100755 --- a/test/outer-loop/base-outer-loop.sh +++ b/test/outer-loop/base-outer-loop.sh @@ -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} @@ -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