Skip to content

Commit f7d139a

Browse files
committed
Added Oracle GraalVM for JDK 17 and 20
1 parent f99a240 commit f7d139a

File tree

3 files changed

+103
-12
lines changed

3 files changed

+103
-12
lines changed

oci-build-examples/oci_devops_build_with_graalenterprise/README.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Using GraalVM Enterprise in OCI DevOps Build Pipelines to build a Java App
1+
# Using Oracle GraalVM in OCI DevOps Build Pipelines to build a Java App
22

3-
This sample shows how to use `Oracle GraalVM Enterprise Edition` in `OCI DevOps build pipelines` to build a Java hello world application. You can use this approach to build any high-performance Java application with GraalVM Enterprise and OCI DevOps.
3+
This sample shows how to use `Oracle GraalVM` in `OCI DevOps build pipelines` to build a Java hello world application. You can use this approach to build any high performance Java application with Oracle GraalVM and OCI DevOps.
44

55
## What is GraalVM?
66

7-
- Oracle GraalVM Enterprise is a high-performance JDK distribution that can accelerate any Java workload running on the HotSpot JVM.
7+
- GraalVM is a high performance JDK distribution that can accelerate any Java workload running on the HotSpot JVM.
88

9-
- Oracle GraalVM Enterprise Native Image ahead-of-time compilation enables you to build lightweight Java applications that are smaller, faster, and use less memory and CPU. At build time, GraalVM Native Image analyzes a Java application and its dependencies to identify just what classes, methods, and fields are necessary and generates optimized machine code for just those elements.
9+
- GraalVM Native Image ahead-of-time compilation enables you to build lightweight Java applications that are smaller, faster, and use less memory and CPU. At build time, GraalVM Native Image analyzes a Java application and its dependencies to identify just what classes, methods, and fields are necessary and generates optimized machine code for just those elements.
1010

11-
- Oracle GraalVM Enterprise Edition is available for use on Oracle Cloud Infrastructure (OCI) at no additional cost.
11+
- Oracle GraalVM is available for use on Oracle Cloud Infrastructure (OCI) at no additional cost.
1212

1313

1414

@@ -27,7 +27,7 @@ This sample shows how to use `Oracle GraalVM Enterprise Edition` in `OCI DevOps
2727
## Objectives
2828

2929
- Create an OCI build pipeline.
30-
- Make a build using Oracle GraalVM Enterprise edition.
30+
- Make a build using Oracle GraalVM.
3131
- Here the focus will be on the build specification and DevOps build pipeline
3232

3333

@@ -77,6 +77,7 @@ Allow dynamic-group <YOUR_DynamicGroup_NAME> to use ons-topics in compartment <
7777
![](images/oci_buildpipeline_managedbuild.png)
7878

7979
- Click `Next` and provide the details.
80+
- In the `Build spec file path`, enter `build_spec.yaml` to use the [GraalVM Enterprise 22.x Java 17 build spec](build_spec.yaml). Alternatively, you can enter `build_spec_oracle_graalvm_jdk17.yaml` to use the [Oracle GraalVM for JDK 17 build spec](./build_spec_oracle_graalvm_jdk17.yaml) or `build_spec_oracle_graalvm_jdk20.yaml` to use the [Oracle GraalVM for JDK 20 build spec](./build_spec_oracle_graalvm_jdk20.yaml).
8081

8182
![](images/oci_buildstage_1.png)
8283

@@ -91,14 +92,14 @@ Allow dynamic-group <YOUR_DynamicGroup_NAME> to use ons-topics in compartment <
9192

9293
## Take a closer look at the build instructions below
9394

94-
To install and use GraalVM Enterprise in the DevOps build pipeline, the build specification file is as follows:
95+
To install and use Oracle GraalVM in the DevOps build pipeline, the build specification file is as follows:
9596

96-
1. Add the following command to install one or more required GraalVM Enterprise components. For example, this command installs Native Image along with the Java Development Kit (JDK) and other necessary dependencies.
97+
1. Add the following command to install the required Oracle GraalVM components. For example, this command installs Native Image along with the Java Development Kit (JDK) and other necessary dependencies.
9798

9899
```shell
99100
steps:
100101
- type: Command
101-
name: "Install GraalVM Enterprise 22.x Native Image for Java17"
102+
name: "Install Oracle GraalVM Enterprise 22.x Native Image for Java17"
102103
command: |
103104
yum -y install graalvm22-ee-17-native-image
104105
```
@@ -144,7 +145,9 @@ To install and use GraalVM Enterprise in the DevOps build pipeline, the build sp
144145
location: target/my-app
145146
```
146147

147-
Here's the complete [build specification](build_spec.yaml) file.
148+
Here's the complete [build specification for GraalVM Enterprise 22.x Java 17](build_spec.yaml) file. Alternatively, you can use the
149+
[build specification for Oracle GraalVM for JDK 17](./build_spec_oracle_graalvm_jdk17.yaml) or
150+
[build specification for Oracle GraalVM for JDK 20](./build_spec_oracle_graalvm_jdk20.yaml).
148151
149152
150153
## How to export the executable file outside of the build pipeline stage.
@@ -286,9 +289,9 @@ The following instructions will help you to export the `executable app file` to
286289
References
287290
==========
288291

289-
- Using GraalVM Enterprise in DevOps Build Pipelines - https://docs.oracle.com/en-us/iaas/Content/devops/using/graalvm.htm
292+
- Using Oracle GraalVM in DevOps Build Pipelines - https://docs.oracle.com/en-us/iaas/Content/devops/using/graalvm.htm
290293
- Oracle Cloud Infrastructure DevOps - https://docs.oracle.com/en-us/iaas/Content/devops/using/home.htm
291-
- Oracle Graal VM Enterprise - https://www.oracle.com/java/graalvm/
294+
- Oracle GraalVM - https://www.oracle.com/java/graalvm/
292295

293296
Contributors
294297
===========
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 0.1
2+
component: build
3+
timeoutInSeconds: 600
4+
runAs: root
5+
shell: bash
6+
env:
7+
exportedVariables:
8+
- BUILDRUN_HASH
9+
variables:
10+
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm-java17"
11+
# PATH is a reserved variable and cannot be defined as a variable.
12+
# However, PATH can be changed in a build step and the change is visible in subsequent steps.
13+
steps:
14+
- type: Command
15+
name: "Define unique tag"
16+
timeoutInSeconds: 40
17+
command: |
18+
export BUILDRUN_HASH=`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-7`
19+
echo "BUILDRUN_HASH: " $BUILDRUN_HASH
20+
21+
- type: Command
22+
name: "Install Oracle GraalVM for JDK 17 (Native Image and JDK)"
23+
command: |
24+
yum -y install graalvm-17-native-image
25+
- type: Command
26+
name: "Set PATH Variable"
27+
command: |
28+
export PATH=$JAVA_HOME/bin:$PATH
29+
# - type: Command
30+
# name: "Build a Jar"
31+
# command: |
32+
# mvn --no-transfer-progress clean package
33+
- type: Command
34+
name: "Build a native executable "
35+
command: |
36+
mvn --no-transfer-progress -Pnative -DskipTests package
37+
38+
outputArtifacts:
39+
# - name: app_jar
40+
# type: BINARY
41+
# location: target/my-app-1.0-SNAPSHOT.jar
42+
- name: app_native_executable
43+
type: BINARY
44+
location: target/my-app
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 0.1
2+
component: build
3+
timeoutInSeconds: 600
4+
runAs: root
5+
shell: bash
6+
env:
7+
exportedVariables:
8+
- BUILDRUN_HASH
9+
variables:
10+
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm-java20"
11+
# PATH is a reserved variable and cannot be defined as a variable.
12+
# However, PATH can be changed in a build step and the change is visible in subsequent steps.
13+
steps:
14+
- type: Command
15+
name: "Define unique tag"
16+
timeoutInSeconds: 40
17+
command: |
18+
export BUILDRUN_HASH=`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-7`
19+
echo "BUILDRUN_HASH: " $BUILDRUN_HASH
20+
21+
- type: Command
22+
name: "Install Oracle GraalVM for JDK 20 (Native Image and JDK)"
23+
command: |
24+
yum -y install graalvm-20-native-image
25+
- type: Command
26+
name: "Set PATH Variable"
27+
command: |
28+
export PATH=$JAVA_HOME/bin:$PATH
29+
# - type: Command
30+
# name: "Build a Jar"
31+
# command: |
32+
# mvn --no-transfer-progress clean package
33+
- type: Command
34+
name: "Build a native executable "
35+
command: |
36+
mvn --no-transfer-progress -Pnative -DskipTests package
37+
38+
outputArtifacts:
39+
# - name: app_jar
40+
# type: BINARY
41+
# location: target/my-app-1.0-SNAPSHOT.jar
42+
- name: app_native_executable
43+
type: BINARY
44+
location: target/my-app

0 commit comments

Comments
 (0)