Skip to content

Commit 8583fa1

Browse files
committed
Added Oracle GraalVM for JDK 21
1 parent 2f43027 commit 8583fa1

File tree

3 files changed

+64
-22
lines changed

3 files changed

+64
-22
lines changed

oci-build-examples/oci_devops_build_with_graalenterprise/README.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +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).
80+
- In the `Build spec file path`, enter `build_spec_oracle_graalvm_jdk21.yaml` to use [Oracle GraalVM for JDK 21](./build_spec_oracle_graalvm_jdk21.yaml) or `build_spec_oracle_graalvm_jdk17.yaml` to use [Oracle GraalVM for JDK 17](./build_spec_oracle_graalvm_jdk17.yaml). Alternatively, you can enter `build_spec.yaml` to use the legacy [GraalVM Enterprise 22.x Java 17](build_spec.yaml).
8181

8282
![](images/oci_buildstage_1.png)
8383

@@ -99,17 +99,17 @@ To install and use Oracle GraalVM in the DevOps build pipeline, the build specif
9999
```shell
100100
steps:
101101
- type: Command
102-
name: "Install Oracle GraalVM Enterprise 22.x Native Image for Java17"
102+
name: "Install Oracle GraalVM for JDK 21 (Native Image and JDK)"
103103
command: |
104-
yum -y install graalvm22-ee-17-native-image
104+
yum -y install graalvm-21-native-image
105105
```
106106

107107
2. Set the JAVA_HOME environment variable.
108108

109109
```shell
110110
env:
111111
variables:
112-
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm22-ee-java17"
112+
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm-java21"
113113
```
114114

115115
3. Set the PATH environment variable.
@@ -139,15 +139,13 @@ To install and use Oracle GraalVM in the DevOps build pipeline, the build specif
139139

140140
5. The executable file can be found under `target/my-app`.
141141

142-
```markdown
143-
- name: app_native_executable
144-
type: BINARY
145-
location: target/my-app
146-
```
142+
```markdown
143+
- name: app_native_executable
144+
type: BINARY
145+
location: target/my-app
146+
```
147147

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).
148+
Here's the complete [build specification for Oracle GraalVM for JDK 21](./build_spec_oracle_graalvm_jdk21.yaml). Alternatively, you can use the [build specification for Oracle GraalVM for JDK 17](./build_spec_oracle_graalvm_jdk17.yaml) or the legacy [build specification for GraalVM Enterprise 22.x Java 17](build_spec.yaml) file.
151149
152150
153151
## How to export the executable file outside of the build pipeline stage.
@@ -171,7 +169,7 @@ The following instructions will help you to export the `executable app file` to
171169
172170
- Use option `Set Custom Location` as Artifact location.
173171
- Provide a path and version as `${BUILDRUN_HASH}`, this is to maintain immutable artifacts.
174-
- The variable `BUILDRUN_HASH` is derived during managed build stage and exported as an exportedVariables.You may use any other name ,but ensure to update the file [build_spec.yaml](build_spec.yaml).
172+
- The variable `BUILDRUN_HASH` is derived during managed build stage and exported as an exportedVariables.You may use any other name, but ensure to update the corresponding build specification file.
175173
- Select `Yes, substitute placeholders` as an option and click `Add`.
176174
177175
![](images/oci_devops_artifact_3.png)
@@ -186,7 +184,7 @@ The following instructions will help you to export the `executable app file` to
186184
187185
188186
- Use `app_native_executable` result artifact name.
189-
- The name `app_native_executable` is a reference to the outputArtifact defined under the the file [build_spec.yaml](build_spec.yaml).
187+
- The name `app_native_executable` is a reference to the outputArtifact defined under the corresponding build specification file.
190188
- Click `Add` and add the stage.
191189
192190
![](images/oci_upload_artifact.png)
@@ -217,7 +215,7 @@ The following instructions will help you to export the `executable app file` to
217215
## Optional - Run build with more verbose output.
218216

219217
- An additional build instruction file as [build_spec_verbose.yaml](build_spec_verbose.yaml)
220-
can be used for more verbose output with the managed build.
218+
can be used for more verbose output with the managed build.
221219
- To do so, switch to `OCI DevOps project` > `OCI Build pipeline ` > Click `3 dots` on the `Managed Build` stage and click on `View details` and then `Edit Stage`.
222220

223221
![](images/oci_buildstage_details.png)
@@ -298,7 +296,7 @@ Contributors
298296

299297
- Author: [Rahul M R](https://github.com/RahulMR42).
300298
- Collaborators: [Sachin Pikle](https://github.com/sachin-pikle)
301-
- Last release: July 2022
299+
- Last updated: July 2025
302300

303301
### Back to examples.
304302
----
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-java21"
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 21 (Native Image and JDK)"
23+
command: |
24+
yum -y install graalvm-21-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_build_with_graalenterprise/build_spec_verbose.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env:
1010
exportedVariables:
1111
- BUILDRUN_HASH
1212
variables:
13-
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm22-ee-java17"
13+
"JAVA_HOME" : "/usr/lib64/graalvm/graalvm-java21"
1414
# PATH is a reserved variable and cannot be defined as a variable.
1515
# However, PATH can be changed in a build step and the change is visible in subsequent steps.
1616
steps:
@@ -24,15 +24,15 @@ steps:
2424
- type: Command
2525
name: "Pre-yum repo checks"
2626
command: |
27-
printf "\n\n Contents of graal_spec.yaml file:\n $(cat graal_spec.yaml) \n\n"
27+
printf "\n\n Contents of build_spec_verbose.yaml file:\n $(cat build_spec_verbose.yaml) \n\n"
2828
printf "Contents of /etc/pki/rpm-gpg/:\n $(ls -alh /etc/pki/rpm-gpg/) \n"
2929
printf "Contents of /etc/yum.repos.d/:\n $(ls -alh /etc/yum.repos.d/) \n"
3030
printf "Contents of etc/yum.repos.d/oci-included-ol7.repo file:\n $(cat "etc/yum.repos.d/oci-included-ol7.repo") \n"
31-
printf "Output of yum list graalvm22-ee-17* :\n $(yum list graalvm22-ee-17*) \n"
31+
printf "Output of yum list graalvm-21* :\n $(yum list graalvm-21*) \n"
3232
- type: Command
33-
name: "Install GraalVM 22.x Native Image for Java17"
33+
name: "Install Oracle GraalVM for JDK 21 (Native Image and JDK)"
3434
command: |
35-
yum -y install graalvm22-ee-17-native-image
35+
yum -y install graalvm-21-native-image
3636
- type: Command
3737
name: "Set PATH Variable"
3838
command: |
@@ -49,7 +49,7 @@ steps:
4949
printf "Maven version:\n $(mvn --version) \n"
5050
echo "Current dir: $(pwd)"
5151
printf "Current dir contents:\n $(ls -alh)"
52-
printf "Output of yum list graalvm22-ee-17* :\n $(yum list graalvm22-ee-17*) \n"
52+
printf "Output of yum list graalvm-21* :\n $(yum list graalvm-21*) \n"
5353
- type: Command
5454
name: "Build a Jar"
5555
command: |

0 commit comments

Comments
 (0)