Skip to content

Commit a208d6b

Browse files
committed
finished pass #1
1 parent 04a48ca commit a208d6b

11 files changed

+1821
-60
lines changed

docs/jenkinsx/java-native-prod/01-intro.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
2-
description: Creating a Java Native Image application and run it as Production with Jenkins X - Introduction - 1/8
3-
hero: Introduction - 1/8
2+
description: Creating a Java Native Image application and run it as Production with Jenkins X - Introduction - 1/9
3+
hero: Introduction - 1/9
44

55
# Introduction
66

@@ -16,6 +16,7 @@ hero: Introduction - 1/8
1616
* **Quarkus**: our Java framework
1717
* Spring Data JPA for ORM
1818
* Spring Web for the REST API
19+
* **Flyway**: to manage our Database schema (introduced in [Previews & Integration Tests](/jenkinsx/java-native-prod/08-preview-int-test/))
1920
* **Java 11**
2021
* **GraalVM**: compiler/runtime to create a native executable of our Java code
2122

docs/jenkinsx/java-native-prod/02-cloud-sql.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
22
description: Creating a Java Native Image application and run it as Production with Jenkins X - Cloud SQL - 2/8
3-
hero: Cloud SQL - 2/8
3+
hero: Cloud SQL - 2/9
44

55
# Google Cloud SQL
66

docs/jenkinsx/java-native-prod/03-quarkus.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
2-
description: Creating a Java Native Image application and run it as Production with Jenkins X - Quarkus - 3/8
3-
hero: Quarkus - 3/8
2+
description: Creating a Java Native Image application and run it as Production with Jenkins X - Quarkus - 3/9
3+
hero: Quarkus - 3/9
44

55
# Create Quarkus Application
66

@@ -220,6 +220,22 @@ And add `quarkus-resteasy-jackson`.
220220
</dependency>
221221
```
222222
223+
## Update FruitResource findAll
224+
225+
If you have tested our application, you might have noticed our `findAll()` method no longer works. This is because the `RestEasy Jackson` library doesn't properly marshall the Fruit's iterator. To solve this, we make and return a List instead.
226+
227+
!!! example "FruitResource.java"
228+
229+
```java
230+
public List<Fruit> findAll() {
231+
var it = fruitRepository.findAll();
232+
List<Fruit> fruits = new ArrayList<Fruit>();
233+
it.forEach(fruits::add);
234+
return fruits;
235+
}
236+
```
237+
238+
223239
## Next Steps
224240
225241
Running `mvn clean test` should result in a succesful build, with two tests testing most of our application.

docs/jenkinsx/java-native-prod/04-jx-import.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
2-
description: Creating a Java Native Image application and run it as Production with Jenkins X - Jenkins X Import - 4/8
3-
hero: Jenkins X Import - 4/8
2+
description: Creating a Java Native Image application and run it as Production with Jenkins X - Jenkins X Import - 4/9
3+
hero: Jenkins X Import - 4/9
44

55
# Jenkins X Import
66

docs/jenkinsx/java-native-prod/05-jx-secrets.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
2-
description: Creating a Java Native Image application and run it as Production with Jenkins X -Database Connection And Secrets - 5/8
3-
hero:Database Connection And Secrets - 5/8
2+
description: Creating a Java Native Image application and run it as Production with Jenkins X -Database Connection And Secrets - 5/9
3+
hero:Database Connection And Secrets - 5/9
44

55
# Database Connection And Secrets
66

docs/jenkinsx/java-native-prod/06-native-image.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
2-
description: Creating a Java Native Image application and run it as Production with Jenkins X - Native Image - 6/8
3-
hero: Native Image - 6/8
2+
description: Creating a Java Native Image application and run it as Production with Jenkins X - Native Image - 6/9
3+
hero: Native Image - 6/9
44

55
# Build Native Image
66

docs/jenkinsx/java-native-prod/07-pipeline-improvements.md

+52-47
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
title: Jenkins X - Java Native Image Prod
2-
description: Creating a Java Native Image application and run it as Production with Jenkins X - Pipeline Improvements - 7/8
3-
hero: Pipeline Improvements - 7/8
2+
description: Creating a Java Native Image application and run it as Production with Jenkins X - Pipeline Improvements - 7/9
3+
hero: Pipeline Improvements - 7/9
44

55
# Pipeline Improvements
66

@@ -10,7 +10,7 @@ There are a dozen additional checks I'd like to add to the pipeline to increase
1010

1111
1. Static Code Analysis with SonarQube
1212
1. Dependency Vulnerability Scan with OSS Index
13-
1. Integration Test with PostMan
13+
1. [Integration Test with PostMan](/jenkinsx/java-native-prod/08-preview-int-test/) (next page)
1414

1515
## Static Code Analysis with SonarQube
1616

@@ -142,29 +142,31 @@ There are various ways to do it, in this case I'm using the `overrides` mechanic
142142

143143
We can add any Kubernetes container configuration to our stage's container, via Jenkins X's `containerOptions` key.
144144

145-
```yaml hl_lines="21"
146-
pipelineConfig:
147-
pipelines:
148-
overrides:
149-
- name: mvn-deploy
150-
pipeline: release
151-
stage: build
152-
containerOptions:
153-
envFrom:
154-
- secretRef:
155-
name: my-sonar-token
156-
step:
157-
name: sonar
158-
command: mvn
159-
args:
160-
- compile
161-
- org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar
162-
- -Dsonar.host.url=$SONAR_HOST_URL
163-
- -e
164-
- --show-version
165-
- -DskipTests=true
166-
type: after
167-
```
145+
!!! example "jenkins-x.yml"
146+
147+
```yaml hl_lines="21"
148+
pipelineConfig:
149+
pipelines:
150+
overrides:
151+
- name: mvn-deploy
152+
pipeline: release
153+
stage: build
154+
containerOptions:
155+
envFrom:
156+
- secretRef:
157+
name: my-sonar-token
158+
step:
159+
name: sonar
160+
command: mvn
161+
args:
162+
- compile
163+
- org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar
164+
- -Dsonar.host.url=$SONAR_HOST_URL
165+
- -e
166+
- --show-version
167+
- -DskipTests=true
168+
type: after
169+
```
168170

169171
For more syntax details, see the [Jenkins X Pipeline page](https://jenkins-x.io/docs/reference/pipeline-syntax-reference/#containerOptions).
170172

@@ -223,26 +225,28 @@ envFrom:
223225
In this case, we're going to run this build step after our `sonar` analysis.
224226
So the name we match on, is set to `sonar` and type to `after`.
225227

226-
```yaml
227-
- name: sonar
228-
stage: build
229-
containerOptions:
230-
envFrom:
231-
- secretRef:
232-
name: sonatype-oss-index
233-
step:
234-
name: sonatype-ossindex
235-
command: mvn
236-
args:
237-
- org.sonatype.ossindex.maven:ossindex-maven-plugin:audit
238-
- -f
239-
- pom.xml
240-
- -Dossindex.scope=compile
241-
- -Dossindex.reportFile=ossindex.json
242-
- -Dossindex.cvssScoreThreshold=4.0
243-
- -Dossindex.fail=false
244-
type: after
245-
```
228+
!!! example "jenkins-x.yml"
229+
230+
```yaml
231+
- name: sonar
232+
stage: build
233+
containerOptions:
234+
envFrom:
235+
- secretRef:
236+
name: sonatype-oss-index
237+
step:
238+
name: sonatype-ossindex
239+
command: mvn
240+
args:
241+
- org.sonatype.ossindex.maven:ossindex-maven-plugin:audit
242+
- -f
243+
- pom.xml
244+
- -Dossindex.scope=compile
245+
- -Dossindex.reportFile=ossindex.json
246+
- -Dossindex.cvssScoreThreshold=4.0
247+
- -Dossindex.fail=false
248+
type: after
249+
```
246250

247251
### Analysis Error
248252

@@ -258,5 +262,6 @@ So, we can:
258262

259263
In the example I've gone for option #4, but I recommend you make your own choice.
260264

261-
## Integration Test with PostMan
265+
## Next Steps
262266

267+
The next step is to add Integration Tests via Preview Environments, so we increase the confidence in our application's stability prior to promoting it to (semi-)permanent environments - such as Staging and Production.

0 commit comments

Comments
 (0)