Skip to content

Commit 3cf4c66

Browse files
committed
Merge branch 'main' into oci-security-health-check-standard-2503
2 parents 1b5a766 + 7c8e6d3 commit 3cf4c66

File tree

60 files changed

+1793
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1793
-89
lines changed

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/README.md

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3636
SOFTWARE.
3737
-->
3838

39-
# Terraform Stack to be used in OCI Resource Manager to create OCI DevOps pipelines for OCI Functions
39+
# OCI Resource Manager Terraform Stack to create OCI DevOps CI/CD pipelines for OCI Functions
4040

4141
Reviewed: 11.2.2025
4242

@@ -50,32 +50,44 @@ The DevOps project is not specific to any programming language but includes <a h
5050

5151
# How to use this asset?
5252

53-
Clone this repo locally. In OCI Console click <code>Create Stack</code> under <code>Resource Manager</code> in your project compartment. Drag-n-drop the <a href="./files">files -folder</a> to <code>Stack Configuration</code> (<b>folder type</b>).
53+
Clone this repo locally. In OCI Console click <code>Create Stack</code> under <code>Resource Manager</code> in your project compartment. Drag-n-drop the <a href="./files">files</a> -folder to <code>Stack Configuration</code> (<b>folder type</b>) or click this button below to create the stack on your OCI tenancy:
54+
5455
<p>
55-
OCI DevOps IAM Policies are not part of the stack, please refer to <a href="https://docs.oracle.com/en-us/iaas/Content/devops/using/devops_iampolicies.htm">docs</a> how to create them first.
56+
57+
[![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?zipUrl=https://github.com/oracle-devrel/technology-engineering/releases/download/latest/devops-tf-stack.zip)
58+
5659
<p>
57-
Important! Before running the stack it is manadatory to create the OCI Registry repository for the OCI Function container and upload a dummy X86 architecture container to it. The <b>name</b> of the OCIR repo needs to match to the <code>image_name</code> of the Stack variables e.g. <b>helloworldai-java</b>. The image tag must be '<b>1</b>'.
58-
<br>
59-
The reason for this is that the Stack cannot create the Function without pointing to an image in OCIR.
60+
Note! OCI DevOps <code>IAM Policies</code> are not part of the stack, please refer to <a href="https://docs.oracle.com/en-us/iaas/Content/devops/using/devops_iampolicies.htm">docs</a> how to create them before running the devops project pipelines.
6061
<p>
61-
This can be done by doing the following in OCI Cloud Shell (assuming the image name is 'helloworldai-java'):
62-
<pre>
63-
oci artifacts container repository create --display-name helloworldai-java --compartment-id ocid1.compartment.oc1.....gq
64-
docker pull hello-world
65-
docker tag hello-world fra.ocir.io/&lt;YOUR_TENANCY_NAMESPACE&gt;/helloworldai-java:1
66-
docker push fra.ocir.io/&lt;YOUR_TENANCY_NAMESPACE&gt;/helloworldai-java:1
67-
</pre>
68-
Unless doing this the Stack will run into an error:
69-
<pre>
70-
Error: 400-InvalidParameter, Invalid Image fra.ocir.io/&lt;YOUR_TENANCY_NAMESPACE&gt;/&lt;image_name&gt:1 does not exist or you do not have access to use it
71-
</pre>
72-
After doing this the Stack can be run to create the OCI DevOps project. After the project creation the build pipelines can be run to build and deploy the OCI Function with real Function code like <a href="https://github.com/oracle-devrel/technology-engineering/blob/main/app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/README.md">this one</a> (the dummy hello-world image won't run properly).
62+
63+
### Stack settings
64+
65+
Creating the stack in OCI Resource Manger fill in the vars:
66+
67+
![Stack](./files/stack.jpg)
68+
69+
<ul>
70+
<li><i>initial_image</i> that is used to create the OCI Function as target environment for the OCI DevOps deployment pipeline.
71+
By default it is loaded from Dockerhub, but you can use any X86 arch image if want to replace this</li>
72+
<li><i>docker_user</i> is your OCIR Docker user to push the initial image (above) to OCIR repo for the Function. Replace &lt;namespace&gt; with your <code>tenancy namespace</code>. <code>oracleidentitycloudservice</code> is only used for federated domains/users, not local</li>
73+
<li><i>docker_password</i> is an <code>auth token</code> in your OCI user profile, <i>create one for this</i></li>
74+
</ul>
75+
76+
Docker credentials are only used during the DevOps project creation to push the initial Function image and the DevOps project won't need them after it's been created by Terraform. <i>Hence, you can delete the auth token from your profile after the stack has been run.</i>
77+
<p>
78+
79+
After creation run Stacks's Apply to create the OCI DevOps project.
7380
<p>
7481
The Stack creates only a <i>private subnet</i> in the VCN and hence the Function cannot be called outside the tenancy by default after the build and deploy.
75-
<br>
76-
However, the Function invocation can be done from OCI Cloud Shell either by connecting to the VCN private subnet or to OCI Service Network, both options will work. The invocation can be done as follows using the Stack <code>project_name</code> e.g. :
82+
<p>
83+
However, the Function invocation can be done from <code>OCI Cloud Shell</code> either by connecting to the <b>VCN private subnet</b> or to <b>OCI Service Network</b>, both options will work. The invocation can be done as follows using the Stack <code>project_name</code> e.g. :
84+
<pre>
85+
fn invoke helloworldai-java helloworldai-java
86+
</pre>
87+
88+
Since the stack creates the DevOps project with a target Function with the intial image it should already run and return:
7789
<pre>
78-
fn invoke helloworldai-java-project helloworldai-java-project
90+
Hello, world!
7991
</pre>
8092

8193
# Useful Links

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/artifacts.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
resource oci_artifacts_container_configuration export_container_configuration {
44
compartment_id = var.compartment_ocid
5-
is_repository_created_on_first_push = "true"
5+
is_repository_created_on_first_push = "false"
66
}
77

88
resource oci_artifacts_container_repository export_project {
99
compartment_id = oci_artifacts_container_configuration.export_container_configuration.compartment_id
1010

11-
display_name = "${var.project_name}-image"
11+
display_name = "${var.image_name}"
1212
freeform_tags = {
1313
}
1414
is_immutable = "false"
1515
is_public = "false"
16+
provisioner "local-exec" {
17+
command = "docker login ${var.registry} -u '${var.docker_user}' -p '${var.docker_pwd}' && docker pull ${var.initial_image} && docker tag ${var.initial_image} ${var.registry}/${data.oci_objectstorage_namespace.tenancy_namespace.namespace}/${var.image_name}:1 && docker push ${var.registry}/${data.oci_objectstorage_namespace.tenancy_namespace.namespace}/${var.image_name}:1"
18+
}
1619
}

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/build_pipeline_specs/build_spec_native.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ steps:
1212
echo "Build ID: $buildId"
1313
- type: Command
1414
command: |
15-
# This replaces the default open-jdk
16-
export GRAALVM_VERSION="21"
17-
export JAVA_VERSION="17"
18-
yum -y install graalvm${GRAALVM_VERSION}-ee-${JAVA_VERSION}-jdk;
19-
export JAVA_HOME=/usr/lib64/graalvm/graalvm${GRAALVM_VERSION}-ee-java${JAVA_VERSION};
20-
java -version
21-
22-
mvn clean install
23-
2415
docker build -f Dockerfile.native -t ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME} .
2516
docker tag ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:$buildId
2617
outputArtifacts:

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/devops.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ resource oci_devops_build_pipeline_stage export_build {
402402
build_pipeline_stage_type = "BUILD"
403403
build_runner_shape_config {
404404
build_runner_type = "CUSTOM"
405-
memory_in_gbs = "512"
406-
ocpus = "8"
405+
memory_in_gbs = "8"
406+
ocpus = "2"
407407
}
408408
build_source_collection {
409409
items {

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/functions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ resource oci_functions_function export_project_2 {
4040
trace_config {
4141
is_enabled = "false"
4242
}
43+
depends_on = [oci_artifacts_container_repository.export_project]
4344
}
44-
124 KB
Loading

app-dev/devops-and-containers/devops/oci-devops-terraform-function-java-graalvm/files/vars.tf

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ variable region { default = "eu-frankfurt-1" }
22
variable registry { default = "fra.ocir.io" }
33
variable compartment_ocid { }
44
variable project_name {
5-
default = "helloworldai-java-project"
5+
default = "helloworldai-java"
66
description = "Name of the OCI DevOps project and related resources"
77
}
88
variable image_name {
9-
default = "helloworldai-java"
10-
description = "Name of the Docker image in OCIR. Important! Create/Push this into the OCIR repo for this before running this Stack, otherwise the stack will fail due to empty image in the function definition You can do this in OCI Cloud Shell using hello-world image from Docker Hub and then tagging and pushing it accordingly."
9+
default = "helloworldai"
10+
description = "Name of the image that is built by the pipelines and deployed in the target OCI Function"
11+
}
12+
variable docker_user {
13+
description = "Your docker user to login OCIR to create the initial Function image"
14+
}
15+
variable docker_pwd {
16+
description = "Your docker password (auth token) to login OCIR to create the initial Function image"
17+
}
18+
variable initial_image {
19+
default = "docker.io/mikarinneoracle/hello-world-java-graalvm"
20+
description = "Intial native X86 Hello-world public image that is used to deploy the initial OCI Function"
1121
}

app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/Dockerfile.native

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
FROM fnproject/fn-java-fdk-build:jdk17-1.0-latest as build-stage
2+
WORKDIR /function
3+
ENV MAVEN_OPTS -Dhttp.proxyHost= -Dhttp.proxyPort= -Dhttps.proxyHost= -Dhttps.proxyPort= -Dhttp.nonProxyHosts= -Dmaven.repo.local=/usr/share/maven/ref/repository
4+
ADD pom.xml /function/pom.xml
5+
RUN ["mvn", "package", "dependency:copy-dependencies", "-DincludeScope=runtime", "-DskipTests=true", "-Dmdep.prependGroupId=true", "-DoutputDirectory=target", "--fail-never"]
6+
ADD src /function/src
7+
RUN ["mvn", "package"]
8+
19
FROM container-registry.oracle.com/graalvm/native-image:23-ol8 AS native
210
WORKDIR /app
3-
4-
COPY target .
11+
COPY --from=build-stage /function/target .
512
ADD reflection.json .
613

714
RUN native-image \
815
-H:ReflectionConfigurationFiles=/app/reflection.json \
916
-Ob \
1017
-H:Name=Hello \
11-
-cp "/app/Hellofunc-1.0-SNAPSHOT.jar:/app/lib/*" \
18+
-cp "/app/Hellofunc-1.0-SNAPSHOT.jar:/app/*" \
1219
com.fnproject.fn.runtime.EntryPoint
1320

14-
FROM fnproject/fn-java-fdk:jre17-1.0.198 as fdk
21+
FROM fnproject/fn-java-fdk:jre17-latest as fdk
1522

1623
FROM container-registry.oracle.com/os/oraclelinux:8-slim
1724
COPY --from=native /app/Hello .

app-dev/devops-and-containers/functions/java-helloworld-AI-with-local-dev-and-oci-functions/files/build_spec_native.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,6 @@ steps:
1212
echo "Build ID: $buildId"
1313
- type: Command
1414
command: |
15-
# This replaces the default open-jdk
16-
export GRAALVM_VERSION="21"
17-
export JAVA_VERSION="17"
18-
yum -y install graalvm${GRAALVM_VERSION}-ee-${JAVA_VERSION}-jdk;
19-
export JAVA_HOME=/usr/lib64/graalvm/graalvm${GRAALVM_VERSION}-ee-java${JAVA_VERSION};
20-
java -version
21-
22-
mvn clean install
23-
2415
docker build -f Dockerfile.native -t ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME} .
2516
docker tag ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:latest ${REGISTRY}/${NAMESPACE}/${IMAGE_NAME}:$buildId
2617
outputArtifacts:

cloud-architecture/oracle-apps-hyperion-siebel-gbu/gbu/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ These resources aim to offer guidance throughout your migration, enabling you to
66

77
Explore these materials to enhance your migration strategy. We appreciate your participation and are committed to supporting your cloud migration journey.
88

9-
Reviewed: 24.10.2024
9+
Reviewed: 26.02.2025
1010

1111
# Table of Contents
1212

0 commit comments

Comments
 (0)