Skip to content

Commit 3579b6e

Browse files
authored
Merge pull request #58 from oracle-devrel/ci
fix format
2 parents 9a984e0 + 171efae commit 3579b6e

File tree

15 files changed

+185
-44
lines changed

15 files changed

+185
-44
lines changed

AIO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## All in One reference for samples - In Alphabetical (A to Z) order.
22
- A sample to run OCI AI Anomaly detection from OCI Build-pipeline - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-devops-anomaly-detection
3+
- A sample to use `Custom Shapes` within OCI Build pipelines - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-build-custom-shapes
34
- 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
45
- 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
56
- Build Caching - https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-build-caching

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The service also provides private Git repositories to store your code and it sup
1111

1212
## OCI Devops examples (Catogorical view )
1313

14-
- [⚡ CICD with OCI Devops services - samples](./oci-pipeline-examples/README.md)
14+
- [⚡ CICD with OCI Devops services - samples](./oci-pipeline-examples/README.md)
1515
- [⚡ OCI Devops Build service - samples](./oci-build-examples/README.md)
1616
- [⚡ OCI Devops Deployment service - samples](./oci-deployment-examples/README.md)
1717
- [⚡ OCI Source Code Management service - sample](./oci-coderepo-examples/README.md)
@@ -21,7 +21,7 @@ The service also provides private Git repositories to store your code and it sup
2121
- 🛎[Sample illustration of deployment on to *OCI Container instance* using OCI DevOps.]( https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-deployment-examples/oci-devops-deploy-containerinstance
2222
)
2323
- 🛎️[Sample illustration of verifying the *integrity of Helm chart* before the deployment](https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-deployment-examples/oci-deployment-with-helm-attestation)
24-
- 🛎️[Sample illustration of OCI DevOps deployment pipeline with DevOps Deploy Shell stage.]( https://github.com/oracle-devrel/oci-devops-examples/blob/main/oci-deployment-examples/oci-deployment-shell-stages)
24+
- 🛎️[A sample to use `Custom Shapes` within OCI Build pipelines]( https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-build-custom-shapes)
2525
- 🛎️[A sample to run OCI AI Anomaly detection from OCI Build-pipeline.](https://github.com/oracle-devrel/oci-devops-examples/tree/main/oci-build-examples/oci-devops-anomaly-detection)
2626

2727

oci-build-examples/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
All about OCI devops build samples ..
22
=======
3+
<details>
4+
<summary>Anomaly detections - click to expand</summary>
5+
6+
* [Anomaly detection from buildpipeline](./oci-devops-anomaly-detection/)
7+
8+
</details>
9+
310
<details>
411
<summary>Build Caching - click to expand</summary>
512

@@ -19,6 +26,13 @@ All about OCI devops build samples ..
1926
* [Run commands on WINDOWS host from build pipeline](./oci-devops-connect-to-windows-from-buildmachines/)
2027

2128

29+
</details>
30+
<details>
31+
<summary>Custom shaped Build runner - click to expand</summary>
32+
33+
* [Use custom shape build runner machine](./oci-build-custom-shapes/)
34+
35+
2236
</details>
2337

2438
<details>
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
2+
# A sample to use `Custom Shapes` within OCI Build pipelines.
3+
4+
The feature enables developers to select their preferred CPU and memory for their managed build stage.
5+
6+
```
7+
$ git init oci-build-custom-shapes
8+
$ cd oci-build-custom-shapes
9+
$ git remote add origin <url to this git repo>
10+
$ git config core. sparse checkout true
11+
$ echo "oci-build-examples/oci-build-custom-shapes/*">>.git/info/sparse-checkout
12+
$ git pull --depth=1 origin main
13+
14+
```
15+
16+
Procedure to use the illustration
17+
-------
18+
19+
- Create OCI Notifications topic - https://docs.oracle.com/en-us/iaas/Content/Notification/Tasks/create-topic.htm#top
20+
- Create OCI DevOps projects and associate with the topic - https://docs.oracle.com/en-us/iaas/Content/devops/using/create_project.htm#create_a_project
21+
- Enables logs for the DevOps project.
22+
- Create a dynamic group with the below rules.
23+
```java
24+
ALL {resource.type = 'devopsbuildpipeline', resource.compartment.id = 'OCID OF YOUR COMPARTMENT'}
25+
```
26+
- Create an identity policy with the below statements.
27+
```java
28+
Allow dynamic-group <NAME OF THE DYNAMIC GROUP> to manage ons-topics in compartment <NAME OF THE COMPARTMENT>
29+
```
30+
- Create an `OCI Code repo`
31+
- Push the whole contents here to the OCI CODE REPO created.
32+
- Create a build pipeline.
33+
![](images/oci-build-pipeline.png)
34+
35+
- Use `+` and add a `custom managed build stage`.
36+
![](images/oci-build-stage-1.png)
37+
38+
- Select `custom shape`
39+
![](images/oci-build-stage-2.png)
40+
41+
- Choose runner shapes `OCPUs` and `Memory` using the slide bars.
42+
![](images/oci-build-stage-3.png)
43+
44+
- Associate the code repo as the `primary source code` for the stage.
45+
46+
![](images/oci-build-stage-4.png)
47+
48+
- Click `Add`
49+
- Click the `Start manual run` option and run a build stage.
50+
51+
![](images/oci-build-run.png)
52+
53+
The custom build shape option will create a build runner with the desired OCPU and Memory and start the build run. The concerned resources are managed by building service internally and are not visible to customer tenancy. Based on the resource using the concerned price will be charged back to the user.
54+
55+
![](images/oci-build-run-2.png)
56+
57+
- The build will continue and display some of the default values from the build runner machine.
58+
- Along with the custom shape option, the default build runner option will be retained for use cases that can fix within the defined resources.
59+
60+
Read more
61+
---
62+
63+
- OCI DevOps service - https://docs.oracle.com/en-us/iaas/Content/devops/using/home.htm
64+
- Details about OCI Anomaly detection and workshop -.
65+
66+
- There are reference samples available within the directory [ai-data-references](ai-data-references) to set up the anomaly detection project /model and run execution using [OCI CLI](https://apexapps.oracle.com/pls/apex/r/dbpm/livelabs/run-workshop?p210_wid=819&p210_wec=&session=107963899615339).
67+
68+
Contributors
69+
===========
70+
71+
- Author: [Rahul M R](https://github.com/RahulMR42).
72+
- Collaborators:
73+
- Last release: March 2023
74+
75+
### Back to examples.
76+
----
77+
78+
- 🍿 [Back to OCI Devops Build sample](./../README.md)
79+
- 🏝️ [Back to OCI Devops sample](./../../README.md)
80+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: 0.1
2+
component: build
3+
timeoutInSeconds: 6000
4+
runAs: root
5+
shell: bash
6+
env:
7+
# these are local variables to the build config
8+
variables:
9+
10+
# the value of a vaultVariable is the secret-id (in OCI ID format) stored in the OCI Vault service
11+
# you can then access the value of that secret in your build_spec.yaml commands
12+
vaultVariables:
13+
# EXAMPLE_SECRET: "YOUR-SECRET-OCID"
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: "Fetch Values"
22+
timeoutInSeconds: 240
23+
command: |
24+
echo "OCI_BUILD_RUN_ID => ${OCI_BUILD_RUN_ID}"
25+
echo "OCI_TRIGGER_COMMIT_HASH => ${OCI_TRIGGER_COMMIT_HASH}"
26+
echo "OCI_STAGE_ID =>${OCI_STAGE_ID}"
27+
echo "OCI_BUILD_RUN_ID=>${OCI_BUILD_RUN_ID}"
28+
echo "OCI_TRIGGER_SOURCE_BRANCH_NAME =>${OCI_TRIGGER_SOURCE_BRANCH_NAME} "
29+
echo "OCI_TRIGGER_SOURCE_URL =>${OCI_TRIGGER_SOURCE_URL} "
30+
echo "OCI_TRIGGER_EVENT_TYPE =>${OCI_TRIGGER_EVENT_TYPE} "
31+
echo "OCI_PRIMARY_SOURCE_DIR =>${OCI_PRIMARY_SOURCE_DIR} "
32+
echo "OCI_WORKSPACE_DIR => ${OCI_WORKSPACE_DIR} "
33+
echo "OCI_PRIMARY_SOURCE_NAME => ${OCI_PRIMARY_SOURCE_NAME} "
34+
echo "OCI_BUILD_STAGE_NAME => ${OCI_BUILD_STAGE_NAME}"
35+
echo "Use a custom value from predefined system variable to expose outside of the current build stage.."
36+
export BUILDRUN_HASH =`echo ${OCI_BUILD_RUN_ID} | rev | cut -c 1-7`
37+
if [ -z ${OCI_TRIGGER_COMMIT_HASH} ]
38+
then
39+
cd ${OCI_PRIMARY_SOURCE_DIR}
40+
export OCI_TRIGGER_COMMIT_HASH=`git log --format="%H" -n 1|cut -c 1-7`
41+
fi
42+
echo "OCI_TRIGGER_COMMIT_HASH =>${OCI_TRIGGER_COMMIT_HASH}"
43+
44+
# Last command is used to get the commit hash using GIT ID ,its a hack while there wont be any default commit hash by manual Run.
45+
# Until its fixed we can fetch the same via GIT Command.
26.2 KB
Loading
124 KB
Loading
79.4 KB
Loading
58.6 KB
Loading
61.5 KB
Loading

0 commit comments

Comments
 (0)