Skip to content

Commit 93a5cc0

Browse files
authored
Merge pull request #64 from sachin-pikle/main
Using Oracle GraalVM for JDK 17 and 20
2 parents f99a240 + 103eb80 commit 93a5cc0

File tree

13 files changed

+248
-46
lines changed

13 files changed

+248
-46
lines changed

AIO.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
- A way (workaround) to execute commands on to a Windows machine using OCI Run command agent from OCI Build pipeline. - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-devops-connect-to-windows-from-buildmachines
55
- Access resource with Private IP from OCI Build runner - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-devops-pa-with-private-oke
66
- Build Caching - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-build-caching
7-
- Build Native image with Graal VM Enterprise edition - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci_devops_build_with_graalenterprise
8-
- Build a micronaut restapi application with Graal VM Enterprise - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci_devops_graalee_micronaut
7+
- Build Native image with Oracle GraalVM - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci_devops_build_with_graalenterprise
8+
- Build a micronaut restapi application with Oracle GraalVM - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci_devops_graalee_micronaut
99
- Build and Deploy a Golang application using OCI Devops - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-devops-golan-sample
1010
- Build and Deploy a RUST application using OCI Devops - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-devops-cicd-rust-sample
1111
- Build and deploy a JAVA - Graal EE - Micronaut application on to Instances - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-devops-graal-micronaut-deploy-to-instances
12-
- Build and run a OCI devops pipeline with JAVA and Graal VM framework. - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-java-graalvm-devops-example
13-
- Build and run a OCI devops pipeline with Java-Micronaut framework. - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-java-micronaut-devops-example
12+
- Build and run a OCI devops pipeline with JAVA and GraalVM - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-java-graalvm-devops-example
13+
- Build and run a OCI devops pipeline with Java-Micronaut framework - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-java-micronaut-devops-example
1414
- Cascade delete of OCI Project - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-config-examples/oci-project-cascadedelete
1515
- Cascaded Pipelines - With in the Region - https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-pipeline-examples/oci-cascaded-pipelines/same-region
1616
- Container image scan before deploy - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci_imagescan_before_deploy

oci-build-examples/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ All about OCI devops build samples ..
3636
</details>
3737

3838
<details>
39-
<summary>Graal VM Enterprise - click to expand</summary>
39+
<summary>Oracle GraalVM - click to expand</summary>
4040

41-
* [Build a native executable application with Graal VM Enterprise](./oci_devops_build_with_graalenterprise/)
42-
* [Build a micronaut restapi application with Graal VM Enterprise](./oci_devops_graalee_micronaut/)
41+
* [Build a native executable application with Oracle GraalVM](./oci_devops_build_with_graalenterprise/)
42+
* [Build a micronaut restapi application with Oracle GraalVM](./oci_devops_graalee_micronaut/)
4343

4444
</details>
4545

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

oci-build-examples/oci_devops_graalee_micronaut/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 to build a Micronaut REST App
1+
# Using Oracle GraalVM in OCI DevOps to build a Micronaut REST App
22

3-
This sample shows how to use `Oracle GraalVM Enterprise Edition` in `OCI DevOps build pipelines` to build a simple Micronaut hello world REST application. You can use this approach to build any high-performance Java application with Micronaut, GraalVM Enterprise and OCI DevOps.
3+
This sample shows how to use `Oracle GraalVM` in `OCI DevOps build pipelines` to build a simple Micronaut hello world REST application. You can use this approach to build any high performance Java application with Micronaut, 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
## What is Micronaut
1414

@@ -32,7 +32,7 @@ This sample shows how to use `Oracle GraalVM Enterprise Edition` in `OCI DevOps
3232
## Objectives
3333

3434
- Create an OCI build pipeline.
35-
- Make a build using Oracle GraalVM Enterprise Edition.
35+
- Make a build using Oracle GraalVM.
3636
- Here the focus will be on the build specification and DevOps build pipeline
3737

3838

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

8484
- Click `Next` and provide the details.
85+
- 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).
8586

8687
![](images/oci_buildstage_1.png)
8788

@@ -96,14 +97,14 @@ Allow dynamic-group <YOUR_DynamicGroup_NAME> to use ons-topics in compartment <
9697

9798
## Take a closer look at the build instructions below
9899

99-
To install and use GraalVM Enterprise with Micronaut REST in the DevOps build pipeline, the build specification file is as follows:
100+
To install and use Oracle GraalVM with Micronaut REST in the DevOps build pipeline, the build specification file is as follows:
100101

101-
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.
102+
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.
102103

103104
```shell
104105
steps:
105106
- type: Command
106-
name: "Install GraalVM Enterprise 22.x Native Image for Java17"
107+
name: "Install Oracle GraalVM Enterprise 22.x Native Image for Java17"
107108
command: |
108109
yum -y install graalvm22-ee-17-native-image
109110
```
@@ -170,7 +171,9 @@ To install and use GraalVM Enterprise with Micronaut REST in the DevOps build pi
170171
type: DOCKER_IMAGE
171172
location: ${TAG}
172173
```
173-
Here's the complete [build specification](build_spec.yaml) file.
174+
Here's the complete [build specification for GraalVM Enterprise 22.x Java 17](build_spec.yaml) file. Alternatively, you can use the
175+
[build specification for Oracle GraalVM for JDK 17](./build_spec_oracle_graalvm_jdk17.yaml) or
176+
[build specification for Oracle GraalVM for JDK 20](./build_spec_oracle_graalvm_jdk20.yaml).
174177
175178
176179
## How to export the executable file outside of the build pipeline stage.
@@ -338,9 +341,9 @@ You can create an OCI Container registry and push the build container image whic
338341
References
339342
==========
340343

341-
- Using GraalVM Enterprise in DevOps Build Pipelines - https://docs.oracle.com/en-us/iaas/Content/devops/using/graalvm.htm
344+
- Using Oracle GraalVM in DevOps Build Pipelines - https://docs.oracle.com/en-us/iaas/Content/devops/using/graalvm.htm
342345
- Oracle Cloud Infrastructure DevOps - https://docs.oracle.com/en-us/iaas/Content/devops/using/home.htm
343-
- Oracle Graal VM Enterprise - https://www.oracle.com/java/graalvm/
346+
- Oracle GraalVM - https://www.oracle.com/java/graalvm/
344347

345348
Contributors
346349
===========
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: 0.1
2+
component: build
3+
timeoutInSeconds: 900
4+
runAs: root
5+
shell: bash
6+
env:
7+
variables:
8+
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm-java17"
9+
# PATH is a reserved variable and cannot be defined as a variable.
10+
# However, PATH can be changed in a build step and the change is visible in subsequent steps.
11+
TAG: "mn-hello-ni:0.0.1"
12+
APP_FILE: "MnHelloRest"
13+
14+
# exportedVariables are made available to use as parameters in sucessor Build Pipeline stages
15+
# For this Build to run, the Build Pipeline needs to have a BUILDRUN_HASH parameter set
16+
exportedVariables:
17+
- BUILDRUN_HASH
18+
19+
steps:
20+
- type: Command
21+
name: "Define unique image tag"
22+
timeoutInSeconds: 140
23+
command: |
24+
echo "OCI_BUILD_RUN_ID: ${OCI_BUILD_RUN_ID}"
25+
export BUILDRUN_HASH=`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-7`
26+
echo "BUILDRUN_HASH: " $BUILDRUN_HASH
27+
- type: Command
28+
name: "Install Oracle GraalVM for JDK 17 (Native Image and JDK)"
29+
command: |
30+
yum -y install graalvm-17-native-image
31+
- type: Command
32+
name: "Set PATH Variable."
33+
command: |
34+
export PATH=$JAVA_HOME/bin:$PATH
35+
- type: Command
36+
name: "Build a native executable"
37+
command: |
38+
./mvnw --no-transfer-progress package -Dpackaging=native-image
39+
- type: Command
40+
name: "Build a container image with Native executable"
41+
command: |
42+
docker build -f ./Dockerfile \
43+
--build-arg APP_FILE=${APP_FILE} \
44+
-t ${TAG} .
45+
outputArtifacts:
46+
- name: app_native_executable
47+
type: BINARY
48+
location: target/MnHelloRest
49+
- name: runtime_image
50+
type: DOCKER_IMAGE
51+
# this is only the locally exported container image name
52+
# this location tag doesn't affect the tag used to deliver the container image
53+
# to the Container Registry.
54+
location: ${TAG}

0 commit comments

Comments
 (0)