Skip to content

Commit

Permalink
Merge pull request #136 from OpenLiberty/staging
Browse files Browse the repository at this point in the history
Merge staging to prod - Cloud hosted adjustments (#131)
  • Loading branch information
gkwan-ibm committed Dec 3, 2021
2 parents 3447698 + 098c29f commit b376053
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 16 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/triggerConversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Rebuild cloud-hosted guide

# Controls when the action will run. Triggers the workflow on push
# events but only for the main branch
on:
push:
branches:
- 'prod'
- 'staging'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "post"
post:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# Uses the secrets from the organisation for credentials
- uses: actions/checkout@v2

- name: Invoke workflow in another repo with inputs
uses: benc-uk/workflow-dispatch@v1
with:
workflow: GuideConverter
repo: OpenLiberty/cloud-hosted-guides
token: ${{ secrets.GUIDECONVERSIONTOOL_PASSWORD }}
inputs: '{ "branch": "${{ github.ref }}", "guide_name": "${{ github.event.repository.name }}" }'
ref: "refs/heads/prod"
49 changes: 38 additions & 11 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,12 @@ automated test and configure Maven to automatically run the test.

== Installing Maven

ifndef::cloud-hosted[]
If Maven isn't already installed, https://maven.apache.org/download.cgi[download the binary zip or tar.gz file^].
Then, follow the https://maven.apache.org/install.html[installation instructions for your operating system^]
to extract the `.zip` file and add the `bin` directory, which contains the `mvn` command
to the `PATH` on your computer.
endif::[]

Run the following command to test that Maven is installed:

Expand Down Expand Up @@ -118,8 +120,20 @@ The guideServer server is ready to run a smarter planet.
----
// end::runCommand[]


ifndef::cloud-hosted[]
Navigate your browser to the http://localhost:9080/ServletSample/servlet[^] URL to access the application. The servlet returns a simple response of `Hello! How are you today?`.
endif::[]

ifdef::cloud-hosted[]
Select **Terminal** > **New Terminal** from the menu of the IDE to open another command-line session.
Run the following curl command to view the output of the application:
```
curl -s http://localhost:9080/ServletSample/servlet
```
{: codeblock}

The servlet returns a simple response of **Hello! How are you today?**.
endif::[]

[role='command']
include::{common-includes}/twyb-end.adoc[]
Expand Down Expand Up @@ -153,12 +167,19 @@ All the application source code, including the Open Liberty server configuration

== Creating the project POM file
Navigate to the `start` directory to begin.
// cloud hosted instructions
ifdef::cloud-hosted[]
```
cd /home/project/guide-maven-intro/start
```
{: codeblock}
endif::[]

Before you can build the project, define the Maven Project Object Model (POM) file, the `pom.xml`.

[role="code_command hotspot", subs="quotes"]
----
#Create the pom.xml file.#
#Create the pom.xml file in the `start` directory.#
`pom.xml`
----

Expand All @@ -174,15 +195,9 @@ element and a [hotspot=modelVersion file=0]`modelversion` element, which is alwa
A typical POM for a Liberty application contains the following sections:

* **Project coordinates**: The identifiers for this application.
* **Properties** ([hotspot=properties file=0]`properties`): Any properties for the project go here,
including compilation details and any values that are referenced during compilation of the
Java source code and generating the application.
* **Dependencies** ([hotspot=dependencies file=0]`dependencies`): Any Java dependencies that are
required for compiling, testing, and running the application are listed here.
* **Build plugins** ([hotspot=build file=0]`build`): Maven is modular and each of its
capabilities is provided by a separate plugin. This is where you specify which Maven
plugins should be used to build this project and any configuration information needed by
those plugins.
* **Properties** ([hotspot=properties file=0]`properties`): Any properties for the project go here, including compilation details and any values that are referenced during compilation of the Java source code and generating the application.
* **Dependencies** ([hotspot=dependencies file=0]`dependencies`): Any Java dependencies that are required for compiling, testing, and running the application are listed here.
* **Build plugins** ([hotspot=build file=0]`build`): Maven is modular and each of its capabilities is provided by a separate plugin. This is where you specify which Maven plugins should be used to build this project and any configuration information needed by those plugins.

The project coordinates describe the name and version of the application. The
[hotspot=artifactID file=0]`artifactId` gives a name to the web application project, which is used to
Expand Down Expand Up @@ -245,8 +260,20 @@ include::finish/src/main/liberty/config/server.xml[]
[role='command']
include::{common-includes}/devmode-lmp33-start.adoc[]

ifndef::cloud-hosted[]
Navigate your browser to the http://localhost:9080/ServletSample/servlet[^] URL to access the application. The servlet returns a simple response of `Hello! How are you today?`.
endif::[]

ifdef::cloud-hosted[]
Select **Terminal** > **New Terminal** from the menu of the IDE to open another command-line session.
Run the following curl command to view the output of the application:
```
curl -s http://localhost:9080/ServletSample/servlet
```
{: codeblock}

The servlet returns a simple response of **Hello! How are you today?**.
endif::[]
// =================================================================================================
// Testing the web application
// =================================================================================================
Expand Down
8 changes: 4 additions & 4 deletions finish/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<dependency>
<groupId>org.eclipse.microprofile</groupId>
<artifactId>microprofile</artifactId>
<version>4.0.1</version>
<version>4.1</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Expand All @@ -65,7 +65,7 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.1</version>
<version>5.8.1</version>
<!-- tag::test2[] -->
<scope>test</scope>
<!-- end::test2[] -->
Expand All @@ -81,13 +81,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.1</version>
<version>3.3.2</version>
</plugin>
<!-- tag::liberty-maven-plugin[] -->
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.3.4</version>
<version>3.5.1</version>
<!-- tag::configuration[] -->
<configuration>
<!-- tag::serverName[] -->
Expand Down
2 changes: 1 addition & 1 deletion scripts/dailyBuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ do
esac
done

sed -i "\#<artifactId>liberty-maven-plugin</artifactId>#,\#<configuration>#c<artifactId>liberty-maven-plugin</artifactId><version>3.3.4</version><configuration><install><runtimeUrl>https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/$DATE/$DRIVER</runtimeUrl></install>" pom.xml
sed -i "\#<artifactId>liberty-maven-plugin</artifactId>#,\#<configuration>#c<artifactId>liberty-maven-plugin</artifactId><version>3.5</version><configuration><install><runtimeUrl>https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/$DATE/$DRIVER</runtimeUrl></install>" pom.xml
cat pom.xml

../scripts/testApp.sh

0 comments on commit b376053

Please sign in to comment.