Skip to content

Commit b8876e2

Browse files
authored
Merge pull request #126 from OpenLiberty/staging
Merge staging to prod - Cloud hosted adjustments (#122)
2 parents 80f9380 + a1526cf commit b8876e2

File tree

5 files changed

+115
-12
lines changed

5 files changed

+115
-12
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Rebuild cloud-hosted guide
2+
3+
# Controls when the action will run. Triggers the workflow on push
4+
# events but only for the main branch
5+
on:
6+
push:
7+
branches:
8+
- 'prod'
9+
- 'staging'
10+
11+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
12+
jobs:
13+
# This workflow contains a single job called "post"
14+
post:
15+
# The type of runner that the job will run on
16+
runs-on: ubuntu-latest
17+
18+
# Steps represent a sequence of tasks that will be executed as part of the job
19+
steps:
20+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
21+
# Uses the secrets from the organisation for credentials
22+
- uses: actions/checkout@v2
23+
24+
- name: Invoke workflow in another repo with inputs
25+
uses: benc-uk/workflow-dispatch@v1
26+
with:
27+
workflow: GuideConverter
28+
repo: OpenLiberty/cloud-hosted-guides
29+
token: ${{ secrets.GUIDECONVERSIONTOOL_PASSWORD }}
30+
inputs: '{ "branch": "${{ github.ref }}", "guide_name": "${{ github.event.repository.name }}" }'
31+
ref: "refs/heads/prod"

README.adoc

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ artists.json
6464
include::finish/src/resources/artists.json[]
6565
----
6666

67+
// Static guide instruction
68+
ifndef::cloud-hosted[]
6769
You will implement an Angular client that consumes this JSON and displays its contents
6870
at the `\http://localhost:9080/app` URL.
71+
endif::[]
72+
73+
// Cloud hosted guide instruction
74+
ifdef::cloud-hosted[]
75+
You will implement an Angular client that consumes this JSON and displays its contents.
76+
endif::[]
6977

7078
To learn more about REST services and how you can write them, see
7179
https://openliberty.io/guides/rest-intro.html[Creating a RESTful web service^].
@@ -80,7 +88,20 @@ include::{common-includes}/gitclone.adoc[]
8088
[role='command']
8189
include::{common-includes}/twyb-intro.adoc[]
8290

91+
// Static guide instruction
92+
ifndef::cloud-hosted[]
8393
Then, point your browser to the web application root http://localhost:9080/app[http://localhost:9080/app^] to see the following output:
94+
endif::[]
95+
96+
// Cloud hosted guide instruction
97+
ifdef::cloud-hosted[]
98+
Select **Launch Application** from the menu of the IDE,
99+
type **9080** to specify the port number for the microservice, and click the **OK** button.
100+
You're redirected to a URL similar to **`https://accountname-9080.theiadocker-4.proxy.cognitiveclass.ai/app/`**,
101+
where **accountname** is your account name. You will see the following output:
102+
endif::[]
103+
104+
84105

85106
[subs="quotes", role="no_copy"]
86107
----
@@ -106,11 +127,31 @@ the artist JSON is available to you.
106127

107128
Navigate to the `start` directory to begin.
108129

130+
// cloud-hosted guide instructions:
131+
ifdef::cloud-hosted[]
132+
```
133+
cd /home/project/guide-rest-client-angular/start
134+
```
135+
{: codeblock}
136+
endif::[]
137+
109138
[role='command']
110139
include::{common-includes}/devmode-lmp33-start.adoc[]
111140

141+
// Static guide instruction
142+
ifndef::cloud-hosted[]
112143
You can find your artist JSON at the
113144
http://localhost:9080/artists[http://localhost:9080/artists^] URL.
145+
endif::[]
146+
147+
// Cloud hosted guide instruction
148+
ifdef::cloud-hosted[]
149+
You can find your artist JSON by running the following command at a terminal:
150+
```
151+
curl -s http://localhost:9080/artists | jq
152+
```
153+
{: codeblock}
154+
endif::[]
114155

115156
// =================================================================================================
116157
// Project configuration
@@ -328,18 +369,41 @@ used to display each [hotspot=albumDiv]`album` by each artist.
328369
== Building the front end
329370

330371
The Open Liberty server is already started, and the REST service is running. In a new
331-
command-line session, build the front end by running the following command:
372+
command-line session, build the front end by running the following command in the `start` directory:
332373

374+
// Static guide instruction
375+
ifndef::cloud-hosted[]
333376
[role='command']
334377
```
335378
mvn generate-resources
336379
```
380+
endif::[]
381+
// Cloud hosted guide instruction
382+
ifdef::cloud-hosted[]
383+
```
384+
cd /home/project/guide-rest-client-angular/start
385+
mvn generate-resources
386+
```
387+
{: codeblock}
388+
endif::[]
337389

390+
The build might take a few minutes to complete.
338391
You can rebuild the front end at any time with the `generate-resources` Maven goal.
339392
Any local changes to your TypeScript or HTML are picked up when you build the front end.
340393

394+
// Static guide instruction
395+
ifndef::cloud-hosted[]
341396
Point your browser to the http://localhost:9080/app[http://localhost:9080/app^]
342397
web application root to see the following output:
398+
endif::[]
399+
400+
// Cloud hosted guide instruction
401+
ifdef::cloud-hosted[]
402+
Select **Launch Application** from the menu of the IDE,
403+
type **9080** to specify the port number for the microservice, and click the **OK** button.
404+
You're redirected to a URL similar to **`https://accountname-9080.theiadocker-4.proxy.cognitiveclass.ai/app/`**,
405+
where **accountname** is your account name. You will see the following output:
406+
endif::[]
343407

344408
[subs="quotes", role="no_copy"]
345409
----
@@ -362,9 +426,18 @@ A web browser runs JavaScript, and the `curl` command doesn't.
362426
No explicit code directly uses the consumed artist JSON, so you don't need to write
363427
any test cases.
364428

429+
// Static guide instruction
430+
ifndef::cloud-hosted[]
365431
Whenever you change and build your Angular implementation, the application root at
366432
http://localhost:9080/app[http://localhost:9080/app^] reflects the changes
367433
automatically.
434+
endif::[]
435+
436+
// Cloud hosted guide instruction
437+
ifdef::cloud-hosted[]
438+
Whenever you change and build your Angular implementation, the changes are automatically reflected
439+
at the URL for the launched application.
440+
endif::[]
368441

369442
When you are done checking the application root, exit development mode by
370443
pressing `CTRL+C` in the command-line session where you ran the server,
@@ -378,7 +451,6 @@ https://angular.io/guide/testing[official Angular page^].
378451

379452
== Great work! You're done!
380453

381-
You just accessed a simple RESTful web service and consumed its resources by using
382-
Angular in Open Liberty.
454+
You just accessed a simple RESTful web service and consumed its resources by using Angular in Open Liberty.
383455

384456
include::{common-includes}/attribution.adoc[subs="attributes"]

finish/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<!-- tag::microprofile[] -->
2929
<artifactId>microprofile</artifactId>
3030
<!-- end::microprofile[] -->
31-
<version>4.0.1</version>
31+
<version>4.1</version>
3232
<type>pom</type>
3333
<scope>provided</scope>
3434
</dependency>
@@ -40,19 +40,19 @@
4040
<plugin>
4141
<groupId>org.apache.maven.plugins</groupId>
4242
<artifactId>maven-war-plugin</artifactId>
43-
<version>3.3.1</version>
43+
<version>3.3.2</version>
4444
</plugin>
4545
<!-- Enable liberty-maven plugin -->
4646
<plugin>
4747
<groupId>io.openliberty.tools</groupId>
4848
<artifactId>liberty-maven-plugin</artifactId>
49-
<version>3.3.4</version>
49+
<version>3.5.1</version>
5050
</plugin>
5151
<!-- tag::frontend-plugin[] -->
5252
<plugin>
5353
<groupId>com.github.eirslett</groupId>
5454
<artifactId>frontend-maven-plugin</artifactId>
55-
<version>1.11.3</version>
55+
<version>1.12.0</version>
5656
<configuration>
5757
<!-- tag::working-dir[] -->
5858
<workingDirectory>src/main/frontend</workingDirectory>

finish/src/main/frontend/src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class ArtistsService {
3131
// end::httpInstanceAndAwaitFeatureAndHttpGetAndToPromise[]
3232
return data;
3333
} catch (error) {
34-
console.error(`Error occurred: ${error}`);
34+
console.error('Error occurred: ' + error);
3535
}
3636
}
3737
// end::fetchArtistsMethod[]

start/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<!-- tag::microprofile[] -->
2929
<artifactId>microprofile</artifactId>
3030
<!-- end::microprofile[] -->
31-
<version>4.0.1</version>
31+
<version>4.1</version>
3232
<type>pom</type>
3333
<scope>provided</scope>
3434
</dependency>
@@ -40,18 +40,18 @@
4040
<plugin>
4141
<groupId>org.apache.maven.plugins</groupId>
4242
<artifactId>maven-war-plugin</artifactId>
43-
<version>3.3.1</version>
43+
<version>3.3.2</version>
4444
</plugin>
4545
<!-- Enable liberty-maven plugin -->
4646
<plugin>
4747
<groupId>io.openliberty.tools</groupId>
4848
<artifactId>liberty-maven-plugin</artifactId>
49-
<version>3.3.4</version>
49+
<version>3.5.1</version>
5050
</plugin>
5151
<plugin>
5252
<groupId>com.github.eirslett</groupId>
5353
<artifactId>frontend-maven-plugin</artifactId>
54-
<version>1.11.3</version>
54+
<version>1.12.0</version>
5555
<configuration>
5656
<workingDirectory>src/main/frontend</workingDirectory>
5757
</configuration>

0 commit comments

Comments
 (0)