Skip to content

Commit 936a214

Browse files
authored
Merge branch 'main' into PORT-16488-Bug-ArgoCD-Integration-Fails-on-JQ-Processing-When-liveState-is-Null
2 parents 84d9f3e + 3ebafb0 commit 936a214

10 files changed

+367
-443
lines changed

docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_blueprint.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<details>
2+
<summary><b>Build blueprint (click to expand)</b></summary>
13
```json showLineNumbers
24
{
35
"identifier": "jenkinsBuild",
@@ -47,3 +49,4 @@
4749
}
4850
}
4951
```
52+
</details>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import Tabs from "@theme/Tabs"
2+
import TabItem from "@theme/TabItem"
3+
4+
<details>
5+
<summary><b>Integration configuration (click to expand)</b></summary>
6+
```yaml showLineNumbers
7+
createMissingRelatedEntities: true
8+
deleteDependentEntities: true
9+
resources:
10+
- kind: build
11+
selector:
12+
query: "true"
13+
maxBuildsPerJob: 100
14+
port:
15+
entity:
16+
mappings:
17+
identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1]
18+
title: .displayName
19+
blueprint: '"jenkinsBuild"'
20+
properties:
21+
buildStatus: .result
22+
buildUrl: .url
23+
buildDuration: .duration
24+
timestamp: '.timestamp / 1000 | todate'
25+
relations:
26+
parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "")
27+
previousBuild: >-
28+
if .previousBuild then (.previousBuild.url | split("://")[1] |
29+
sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") |
30+
gsub("/"; "-") | .[:-1]) else null end
31+
```
32+
</details>
33+
34+
<Tabs groupId="config" queryString="parameter">
35+
36+
<TabItem label="Include Max Builds Per Job" value="includeMaxBuildsPerJob">
37+
38+
The `maxBuildsPerJob` selector is an optional parameter that allows you to limit the number of builds to fetch for each job.
39+
By default, this selector is set to `100` which means the last 100 builds of each job will be fetched.
40+
41+
```yaml
42+
- kind: build
43+
selector:
44+
query: 'true'
45+
# highlight-next-line
46+
maxBuildsPerJob: 100
47+
```
48+
49+
</TabItem>
50+
51+
</Tabs>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<details>
2+
<summary><b>Default mapping configuration (click to expand)</b></summary>
3+
4+
```yaml showLineNumbers
5+
createMissingRelatedEntities: true
6+
deleteDependentEntities: true
7+
resources:
8+
- kind: job
9+
selector:
10+
query: 'true'
11+
port:
12+
entity:
13+
mappings:
14+
identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1]
15+
title: .fullName
16+
blueprint: '"jenkinsJob"'
17+
properties:
18+
jobName: .name
19+
url: .url
20+
jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]'
21+
timestamp: .time
22+
parentJob: .__parentJob
23+
24+
25+
- kind: build
26+
selector:
27+
query: 'true'
28+
maxBuildsPerJob: 100
29+
port:
30+
entity:
31+
mappings:
32+
identifier: >-
33+
.url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1]
34+
title: .displayName
35+
blueprint: '"jenkinsBuild"'
36+
properties:
37+
buildStatus: .result
38+
buildUrl: .url
39+
buildDuration: .duration
40+
timestamp: .timestamp / 1000 | todate
41+
relations:
42+
parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "")
43+
previousBuild: >-
44+
if .previousBuild then (.previousBuild.url | split("://")[1] |
45+
sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") |
46+
gsub("/"; "-") | .[:-1]) else null end
47+
48+
- kind: user
49+
selector:
50+
query: 'true'
51+
port:
52+
entity:
53+
mappings:
54+
identifier: .user.id
55+
title: .user.fullName
56+
blueprint: '"jenkinsUser"'
57+
properties:
58+
url: .user.absoluteUrl
59+
lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ")
60+
```
61+
</details>

docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_blueprint.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<details>
2+
<summary><b>Job blueprint (click to expand)</b></summary>
13
```json showLineNumbers
24
{
35
"identifier": "jenkinsJob",
@@ -45,3 +47,4 @@
4547
"relations": {}
4648
}
4749
```
50+
</details>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<details>
2+
<summary><b>Integration configuration (click to expand)</b></summary>
3+
```yaml showLineNumbers
4+
createMissingRelatedEntities: true
5+
deleteDependentEntities: true
6+
resources:
7+
- kind: job
8+
selector:
9+
query: "true"
10+
port:
11+
entity:
12+
mappings:
13+
identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1]
14+
title: .fullName
15+
blueprint: '"jenkinsJob"'
16+
properties:
17+
jobName: .name
18+
url: .url
19+
jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]'
20+
timestamp: .time
21+
parentJob: .__parentJob
22+
```
23+
</details>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<details>
2+
<summary><b>Stage blueprint (click to expand)</b></summary>
3+
4+
```json showLineNumbers
5+
{
6+
"identifier": "jenkinsStage",
7+
"description": "This blueprint represents a stage in a Jenkins build",
8+
"title": "Jenkins Stage",
9+
"icon": "Jenkins",
10+
"schema": {
11+
"properties": {
12+
"status": {
13+
"type": "string",
14+
"title": "Stage Status",
15+
"enum": [
16+
"SUCCESS",
17+
"FAILURE",
18+
"UNSTABLE",
19+
"ABORTED",
20+
"IN_PROGRESS",
21+
"NOT_BUILT",
22+
"PAUSED_PENDING_INPUT"
23+
],
24+
"enumColors": {
25+
"SUCCESS": "green",
26+
"FAILURE": "red",
27+
"UNSTABLE": "yellow",
28+
"ABORTED": "darkGray",
29+
"IN_PROGRESS": "blue",
30+
"NOT_BUILT": "lightGray",
31+
"PAUSED_PENDING_INPUT": "orange"
32+
}
33+
},
34+
"startTimeMillis": {
35+
"type": "number",
36+
"title": "Start Time (ms)",
37+
"description": "Timestamp in milliseconds when the stage started"
38+
},
39+
"durationMillis": {
40+
"type": "number",
41+
"title": "Duration (ms)",
42+
"description": "Duration of the stage in milliseconds"
43+
},
44+
"stageUrl": {
45+
"type": "string",
46+
"title": "Stage URL",
47+
"description": "URL to the stage"
48+
}
49+
},
50+
"required": []
51+
},
52+
"mirrorProperties": {},
53+
"calculationProperties": {},
54+
"relations": {
55+
"parentBuild": {
56+
"title": "Jenkins Build",
57+
"target": "jenkinsBuild",
58+
"required": true,
59+
"many": false
60+
}
61+
}
62+
}
63+
```
64+
65+
</details>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<details>
2+
<summary><b>Integration configuration (click to expand)</b></summary>
3+
4+
:::note Control Stage Fetching
5+
To prevent overwhelming your Ocean instance with potentially thousands of stages from Jenkins, the integration requires you to specify a specific job. This ensures that Ocean only retrieves stages related to that job, keeping things focused and efficient.
6+
7+
**Important**: The integration will also fetch stages from all nested jobs within the specified job.
8+
:::
9+
10+
```yaml showLineNumbers
11+
- kind: stage
12+
selector:
13+
query: 'true'
14+
# Example jobUrl - replace with your own Jenkins job URL
15+
jobUrl: http://your-jenkins-server/job/your-project/job/your-job
16+
port:
17+
entity:
18+
mappings:
19+
identifier: >-
20+
._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") |
21+
gsub("%252F"; "-") | gsub("/"; "-")
22+
title: .name
23+
blueprint: '"jenkinsStage"'
24+
properties:
25+
status: .status
26+
startTimeMillis: .startTimeMillis
27+
durationMillis: .durationMillis
28+
stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href
29+
relations:
30+
parentBuild: >-
31+
._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$";
32+
"") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") |
33+
gsub("/"; "-")
34+
# Additional stage configurations follow the same pattern.
35+
- kind: stage
36+
selector:
37+
query: 'true'
38+
# Example jobUrl - replace with your own Jenkins job URL
39+
jobUrl: http://your-jenkins-server/job/your-project/job/another-job
40+
port:
41+
entity:
42+
mappings:
43+
identifier: >-
44+
._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") |
45+
gsub("%252F"; "-") | gsub("/"; "-")
46+
title: .name
47+
blueprint: '"jenkinsStage"'
48+
properties:
49+
status: .status
50+
startTimeMillis: .startTimeMillis
51+
durationMillis: .durationMillis
52+
stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href
53+
relations:
54+
parentBuild: >-
55+
._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$";
56+
"") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") |
57+
gsub("/"; "-")
58+
59+
- kind: stage
60+
selector:
61+
query: 'true'
62+
# Example jobUrl - replace with your own Jenkins job URL
63+
jobUrl: http://your-jenkins-server/job/your-project/job/third-job
64+
port:
65+
entity:
66+
mappings:
67+
identifier: >-
68+
._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") |
69+
gsub("%252F"; "-") | gsub("/"; "-")
70+
title: .name
71+
blueprint: '"jenkinsStage"'
72+
properties:
73+
status: .status
74+
startTimeMillis: .startTimeMillis
75+
durationMillis: .durationMillis
76+
stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href
77+
relations:
78+
parentBuild: >-
79+
._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$";
80+
"") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") |
81+
gsub("/"; "-")
82+
```
83+
</details>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<details>
2+
<summary><b>User blueprint (click to expand)</b></summary>
3+
4+
```json showLineNumbers
5+
{
6+
"identifier": "jenkinsUser",
7+
"description": "This blueprint represents a jenkins user",
8+
"title": "Jenkins User",
9+
"icon": "Jenkins",
10+
"schema": {
11+
"properties": {
12+
"url": {
13+
"type": "string",
14+
"title": "URL",
15+
"format": "url"
16+
},
17+
"lastUpdateTime": {
18+
"type": "string",
19+
"format": "date-time",
20+
"title": "Last Update",
21+
"description": "Last updated timestamp of the user"
22+
}
23+
},
24+
"required": []
25+
},
26+
"mirrorProperties": {},
27+
"calculationProperties": {},
28+
"relations": {}
29+
}
30+
```
31+
32+
</details>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<details>
2+
<summary><b>Integration configuration (click to expand)</b></summary>
3+
```yaml showLineNumbers
4+
createMissingRelatedEntities: true
5+
deleteDependentEntities: true
6+
resources:
7+
- kind: user
8+
selector:
9+
query: "true"
10+
port:
11+
entity:
12+
mappings:
13+
identifier: .user.id
14+
title: .user.fullName
15+
blueprint: '"jenkinsUser"'
16+
properties:
17+
url: .user.absoluteUrl
18+
lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ")
19+
20+
```
21+
</details>

0 commit comments

Comments
 (0)