From 94f9ed5fd46456b62bca7fca04b5a7cf76ffc53c Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Wed, 22 Oct 2025 21:26:49 +0000 Subject: [PATCH 1/8] added docs for new selectors for pre-filtering builds from Jenkins API Signed-off-by: Dennis Bilson --- .../_example_jenkins_build_blueprint.mdx | 3 + .../_example_jenkins_build_configuration.mdx | 83 ++++ ..._jenkins_default_mapping_configuration.mdx | 60 +++ .../_example_jenkins_job_blueprint.mdx | 3 + .../_example_jenkins_job_configuration.mdx | 23 + .../_example_jenkins_stage_blueprint.mdx | 65 +++ .../_example_jenkins_stage_configuration.mdx | 83 ++++ .../_example_jenkins_user_blueprint.mdx | 32 ++ .../_example_jenkins_user_configuration.mdx | 21 + .../cicd/jenkins/jenkins.md | 466 +----------------- 10 files changed, 397 insertions(+), 442 deletions(-) create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_configuration.mdx create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_blueprint.mdx create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_blueprint.mdx create mode 100644 docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_blueprint.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_blueprint.mdx index 37f06787b1..a07df1025d 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_blueprint.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_blueprint.mdx @@ -1,3 +1,5 @@ +
+Build blueprint (click to expand) ```json showLineNumbers { "identifier": "jenkinsBuild", @@ -47,3 +49,4 @@ } } ``` +
diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx new file mode 100644 index 0000000000..0cb05c4f9f --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx @@ -0,0 +1,83 @@ +import Tabs from "@theme/Tabs" +import TabItem from "@theme/TabItem" + +
+Integration configuration (click to expand) +```yaml showLineNumbers + createMissingRelatedEntities: true + deleteDependentEntities: true + resources: + - kind: build + selector: + query: "true" + maxBuildsPerJob: 100 + daysSince: 1 + jobFilter: [] + port: + entity: + mappings: + identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] + title: .displayName + blueprint: '"jenkinsBuild"' + properties: + buildStatus: .result + buildUrl: .url + buildDuration: .duration + timestamp: '.timestamp / 1000 | todate' + relations: + parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "") + previousBuild: >- + if .previousBuild then (.previousBuild.url | split("://")[1] | + sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | + gsub("/"; "-") | .[:-1]) else null end +``` +
+ + + + + +The `maxBuildsPerJob` selector is an optional parameter that allows you to limit the number of builds to fetch for each job. +By default, this selector is set to `100` which means the last 100 builds of each job will be fetched. + +```yaml + - kind: build + selector: + query: 'true' + # highlight-next-line + maxBuildsPerJob: 100 +``` + + + + + +The `daysSince` selector is an optional parameter that allows you to limit the number of days to look back from the current time to fetch dependency data. +By default, this selector is set to `1` day which means the last day of builds will be fetched. + +```yaml + - kind: build + selector: + query: 'true' + # highlight-next-line + daysSince: 1 +``` + + + + + +The `jobFilter` selector is an optional parameter that allows you to filter the jobs to fetch data from. +By default, this selector is set to `[]` which means all jobs will be fetched. + +```yaml + - kind: build + selector: + query: 'true' + # highlight-next-line + jobFilter: [] +``` + + + + \ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx new file mode 100644 index 0000000000..3a4a76073b --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx @@ -0,0 +1,60 @@ +
+Default mapping configuration (Click to expand) + +```yaml showLineNumbers +createMissingRelatedEntities: true +deleteDependentEntities: true +resources: + - kind: job + selector: + query: 'true' + port: + entity: + mappings: + identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] + title: .fullName + blueprint: '"jenkinsJob"' + properties: + jobName: .name + url: .url + jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]' + timestamp: .time + parentJob: .__parentJob + - kind: build + selector: + query: 'true' + maxBuildsPerJob: 100 + daysSince: 1 + jobFilter: [] + port: + entity: + mappings: + identifier: >- + .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] + title: .displayName + blueprint: '"jenkinsBuild"' + properties: + buildStatus: .result + buildUrl: .url + buildDuration: .duration + timestamp: .timestamp / 1000 | todate + relations: + parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "") + previousBuild: >- + if .previousBuild then (.previousBuild.url | split("://")[1] | + sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | + gsub("/"; "-") | .[:-1]) else null end + - kind: user + selector: + query: 'true' + port: + entity: + mappings: + identifier: .user.id + title: .user.fullName + blueprint: '"jenkinsUser"' + properties: + url: .user.absoluteUrl + lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ") +``` +
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_blueprint.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_blueprint.mdx index c03c1d95ee..d1c7164f46 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_blueprint.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_blueprint.mdx @@ -1,3 +1,5 @@ +
+Job blueprint (click to expand) ```json showLineNumbers { "identifier": "jenkinsJob", @@ -45,3 +47,4 @@ "relations": {} } ``` +
diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_configuration.mdx new file mode 100644 index 0000000000..7bb1dcdb43 --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_job_configuration.mdx @@ -0,0 +1,23 @@ +
+Integration configuration (click to expand) +```yaml showLineNumbers + createMissingRelatedEntities: true + deleteDependentEntities: true + resources: + - kind: job + selector: + query: "true" + port: + entity: + mappings: + identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] + title: .fullName + blueprint: '"jenkinsJob"' + properties: + jobName: .name + url: .url + jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]' + timestamp: .time + parentJob: .__parentJob +``` +
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_blueprint.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_blueprint.mdx new file mode 100644 index 0000000000..98b1d73020 --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_blueprint.mdx @@ -0,0 +1,65 @@ +
+Stage blueprint (click to expand) + +```json showLineNumbers +{ + "identifier": "jenkinsStage", + "description": "This blueprint represents a stage in a Jenkins build", + "title": "Jenkins Stage", + "icon": "Jenkins", + "schema": { + "properties": { + "status": { + "type": "string", + "title": "Stage Status", + "enum": [ + "SUCCESS", + "FAILURE", + "UNSTABLE", + "ABORTED", + "IN_PROGRESS", + "NOT_BUILT", + "PAUSED_PENDING_INPUT" + ], + "enumColors": { + "SUCCESS": "green", + "FAILURE": "red", + "UNSTABLE": "yellow", + "ABORTED": "darkGray", + "IN_PROGRESS": "blue", + "NOT_BUILT": "lightGray", + "PAUSED_PENDING_INPUT": "orange" + } + }, + "startTimeMillis": { + "type": "number", + "title": "Start Time (ms)", + "description": "Timestamp in milliseconds when the stage started" + }, + "durationMillis": { + "type": "number", + "title": "Duration (ms)", + "description": "Duration of the stage in milliseconds" + }, + "stageUrl": { + "type": "string", + "title": "Stage URL", + "description": "URL to the stage" + } + }, + "required": [] + }, + "mirrorProperties": {}, + "calculationProperties": {}, + "relations": { + "parentBuild": { + "title": "Jenkins Build", + "target": "jenkinsBuild", + "required": true, + "many": false + } + } +} +``` + +
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx new file mode 100644 index 0000000000..1bb51861b0 --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx @@ -0,0 +1,83 @@ +
+Integration configuration (click to expand) + +:::note Control Stage Fetching +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. + +**Important**: The integration will also fetch stages from all nested jobs within the specified job. +::: + +```yaml showLineNumbers +- kind: stage + selector: + query: 'true' + # Example jobUrl - replace with your own Jenkins job URL + jobUrl: http://your-jenkins-server/job/your-project/job/your-job + port: + entity: + mappings: + identifier: >- + ._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") | + gsub("%252F"; "-") | gsub("/"; "-") + title: .name + blueprint: '"jenkinsStage"' + properties: + status: .status + startTimeMillis: .startTimeMillis + durationMillis: .durationMillis + stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href + relations: + parentBuild: >- + ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; + "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | + gsub("/"; "-") +# Additional stage configurations follow the same pattern. +# Make sure to replace the jobUrl with your own Jenkins job URLs for each configuration. +- kind: stage + selector: + query: 'true' + # Example jobUrl - replace with your own Jenkins job URL + jobUrl: http://your-jenkins-server/job/your-project/job/another-job + port: + entity: + mappings: + identifier: >- + ._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") | + gsub("%252F"; "-") | gsub("/"; "-") + title: .name + blueprint: '"jenkinsStage"' + properties: + status: .status + startTimeMillis: .startTimeMillis + durationMillis: .durationMillis + stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href + relations: + parentBuild: >- + ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; + "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | + gsub("/"; "-") +- kind: stage + selector: + query: 'true' + # Example jobUrl - replace with your own Jenkins job URL + jobUrl: http://your-jenkins-server/job/your-project/job/third-job + port: + entity: + mappings: + identifier: >- + ._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") | + gsub("%252F"; "-") | gsub("/"; "-") + title: .name + blueprint: '"jenkinsStage"' + properties: + status: .status + startTimeMillis: .startTimeMillis + durationMillis: .durationMillis + stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href + relations: + parentBuild: >- + ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; + "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | + gsub("/"; "-") +``` +
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_blueprint.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_blueprint.mdx new file mode 100644 index 0000000000..59fe9949a8 --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_blueprint.mdx @@ -0,0 +1,32 @@ +
+User blueprint (click to expand) + +```json showLineNumbers +{ + "identifier": "jenkinsUser", + "description": "This blueprint represents a jenkins user", + "title": "Jenkins User", + "icon": "Jenkins", + "schema": { + "properties": { + "url": { + "type": "string", + "title": "URL", + "format": "url" + }, + "lastUpdateTime": { + "type": "string", + "format": "date-time", + "title": "Last Update", + "description": "Last updated timestamp of the user" + } + }, + "required": [] + }, + "mirrorProperties": {}, + "calculationProperties": {}, + "relations": {} +} +``` + +
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx new file mode 100644 index 0000000000..0ea9b12384 --- /dev/null +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx @@ -0,0 +1,21 @@ +
+Integration configuration (click to expand) +```yaml showLineNumbers +createMissingRelatedEntities: true +deleteDependentEntities: true +resources: + - kind: user + selector: + query: "true" + port: + entity: + mappings: + identifier: .user.id + title: .user.fullName + blueprint: '"jenkinsUser"' + properties: + url: .user.absoluteUrl + lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ") + +``` +
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md index e47f6fca69..afbc94d440 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md @@ -11,8 +11,15 @@ import AdvancedConfig from '../../../../generalTemplates/_ocean_advanced_configu import PortApiRegionTip from "/docs/generalTemplates/_port_region_parameter_explanation_template.md" import OceanSaasInstallation from "/docs/build-your-software-catalog/sync-data-to-catalog/templates/_ocean_saas_installation.mdx" import JenkinsBuildBlueprint from './\_example_jenkins_build_blueprint.mdx' +import JenkinsBuildIntegration from './\_example_jenkins_build_configuration.mdx' import JenkinsBuildWebhookConfig from './\_example_jenkins_build_webhook_configuration.mdx' import JenkinsJobBlueprint from './\_example_jenkins_job_blueprint.mdx' +import JenkinsJobIntegration from './\_example_jenkins_job_configuration.mdx' +import JenkinsUserBlueprint from './\_example_jenkins_user_blueprint.mdx' +import JenkinsUserIntegration from './\_example_jenkins_user_configuration.mdx' +import JenkinsStageBlueprint from './\_example_jenkins_stage_blueprint.mdx' +import JenkinsStageIntegration from './\_example_jenkins_stage_configuration.mdx' +import JenkinsDefaultConfig from './\_example_jenkins_default_mapping_configuration.mdx' import JenkinsJobWebhookConfig from './\_example_jenkins_job_webhook_configuration.mdx' import OceanRealtimeInstallation from "/docs/build-your-software-catalog/sync-data-to-catalog/templates/_ocean_realtime_installation.mdx" import MetricsAndSyncStatus from "/docs/build-your-software-catalog/sync-data-to-catalog/templates/_metrics_and_sync_status.mdx" @@ -430,60 +437,7 @@ The mapping makes use of the [JQ JSON processor](https://stedolan.github.io/jq/m This is the default mapping configuration for this integration: -
-Default mapping configuration (Click to expand) - -```yaml showLineNumbers -createMissingRelatedEntities: true -deleteDependentEntities: true -resources: -- kind: job - selector: - query: 'true' - port: - entity: - mappings: - identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] - title: .fullName - blueprint: '"jenkinsJob"' - properties: - jobName: .name - url: .url - jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]' - timestamp: .time - parentJob: .__parentJob -- kind: build - selector: - query: 'true' - port: - entity: - mappings: - identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] - title: .displayName - blueprint: '"jenkinsBuild"' - properties: - buildStatus: .result - buildUrl: .url - buildDuration: .duration - timestamp: .timestamp / 1000 | todate - relations: - parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "") - previousBuild: .previousBuild.url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] -- kind: user - selector: - query: 'true' - port: - entity: - mappings: - identifier: .user.id - title: .user.fullName - blueprint: '"jenkinsUser"' - properties: - url: .user.absoluteUrl - lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ") -``` - -
+ @@ -494,87 +448,9 @@ Examples of blueprints and the relevant integration configurations: ### Job -
-Job blueprint - -```json showLineNumbers -{ - "identifier": "jenkinsJob", - "description": "This blueprint represents a job in Jenkins", - "title": "Jenkins Job", - "icon": "Jenkins", - "schema": { - "properties": { - "jobName": { - "type": "string", - "title": "Job Name" - }, - "jobStatus": { - "type": "string", - "title": "Job Status", - "enum": [ - "created", - "unknown", - "passing", - "failing" - ], - "enumColors": { - "passing": "green", - "created": "darkGray", - "failing": "red", - "unknown": "orange" - } - }, - "timestamp": { - "type": "string", - "format": "date-time", - "title": "Timestamp", - "description": "Last updated timestamp of the job" - }, - "url": { - "type": "string", - "title": "Project URL" - }, - "parentJob": { - "type": "object", - "title": "Parent Job" - } - }, - "required": [] - }, - "mirrorProperties": {}, - "calculationProperties": {}, - "relations": {} -} -``` - -
- -
-Integration configuration + -```yaml showLineNumbers -createMissingRelatedEntities: true -deleteDependentEntities: true -resources: - - kind: job - selector: - query: "true" - port: - entity: - mappings: - identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] - title: .fullName - blueprint: '"jenkinsJob"' - properties: - jobName: .name - url: .url - jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]' - timestamp: .time - parentJob: .__parentJob -``` - -
+ ### Build @@ -582,315 +458,21 @@ resources: The integration fetches up to 100 builds per Jenkins job, allowing you to view the 100 latest builds in Port for each job. ::: -
-Build blueprint - -```yaml showLineNumbers -{ - "identifier": "jenkinsBuild", - "description": "This blueprint represents a build event from Jenkins", - "title": "Jenkins Build", - "icon": "Jenkins", - "schema": { - "properties": { - "buildStatus": { - "type": "string", - "title": "Build Status", - "enum": [ - "SUCCESS", - "FAILURE", - "UNSTABLE" - ], - "enumColors": { - "SUCCESS": "green", - "FAILURE": "red", - "UNSTABLE": "yellow" - } - }, - "buildUrl": { - "type": "string", - "title": "Build URL", - "description": "URL to the build" - }, - "timestamp": { - "type": "string", - "format": "date-time", - "title": "Timestamp", - "description": "Last updated timestamp of the build" - }, - "buildDuration": { - "type": "number", - "title": "Build Duration", - "description": "Duration of the build" - } - }, - "required": [] - }, - "mirrorProperties": { - "previousBuildStatus": { - "title": "Previous Build Status", - "path": "previousBuild.buildStatus" - } - }, - "calculationProperties": {}, - "relations": { - "parentJob": { - "title": "Jenkins Job", - "target": "jenkinsJob", - "required": false, - "many": false - }, - "previousBuild": { - "title": "Previous Build", - "target": "jenkinsBuild", - "required": false, - "many": false - } - } -} -``` - -
- -
-Integration configuration - -```yaml showLineNumbers -createMissingRelatedEntities: true -deleteDependentEntities: true -resources: - - kind: build - selector: - query: "true" - port: - entity: - mappings: - identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] - title: .displayName - blueprint: '"jenkinsBuild"' - properties: - buildStatus: .result - buildUrl: .url - buildDuration: .duration - timestamp: '.timestamp / 1000 | todate' - relations: - parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "") - previousBuild: .previousBuild.url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] -``` + -
+ ### User -
-User blueprint - -```json showLineNumbers -{ - "identifier": "jenkinsUser", - "description": "This blueprint represents a jenkins user", - "title": "Jenkins User", - "icon": "Jenkins", - "schema": { - "properties": { - "url": { - "type": "string", - "title": "URL", - "format": "url" - }, - "lastUpdateTime": { - "type": "string", - "format": "date-time", - "title": "Last Update", - "description": "Last updated timestamp of the user" - } - }, - "required": [] - }, - "mirrorProperties": {}, - "calculationProperties": {}, - "relations": {} -} -``` - -
- -
-Integration configuration - -```yaml showLineNumbers -createMissingRelatedEntities: true -deleteDependentEntities: true -resources: - - kind: user - selector: - query: "true" - port: - entity: - mappings: - identifier: .user.id - title: .user.fullName - blueprint: '"jenkinsUser"' - properties: - url: .user.absoluteUrl - lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ") - -``` + -
+ ### Stage -
-Stage blueprint + -```json showLineNumbers -{ - "identifier": "jenkinsStage", - "description": "This blueprint represents a stage in a Jenkins build", - "title": "Jenkins Stage", - "icon": "Jenkins", - "schema": { - "properties": { - "status": { - "type": "string", - "title": "Stage Status", - "enum": [ - "SUCCESS", - "FAILURE", - "UNSTABLE", - "ABORTED", - "IN_PROGRESS", - "NOT_BUILT", - "PAUSED_PENDING_INPUT" - ], - "enumColors": { - "SUCCESS": "green", - "FAILURE": "red", - "UNSTABLE": "yellow", - "ABORTED": "darkGray", - "IN_PROGRESS": "blue", - "NOT_BUILT": "lightGray", - "PAUSED_PENDING_INPUT": "orange" - } - }, - "startTimeMillis": { - "type": "number", - "title": "Start Time (ms)", - "description": "Timestamp in milliseconds when the stage started" - }, - "durationMillis": { - "type": "number", - "title": "Duration (ms)", - "description": "Duration of the stage in milliseconds" - }, - "stageUrl": { - "type": "string", - "title": "Stage URL", - "description": "URL to the stage" - } - }, - "required": [] - }, - "mirrorProperties": {}, - "calculationProperties": {}, - "relations": { - "parentBuild": { - "title": "Jenkins Build", - "target": "jenkinsBuild", - "required": true, - "many": false - } - } -} -``` - -
- -
-Integration configuration - -:::note Control Stage Fetching -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. - -**Important**: The integration will also fetch stages from all nested jobs within the specified job. -::: - -```yaml showLineNumbers -- kind: stage - selector: - query: 'true' - # Example jobUrl - replace with your own Jenkins job URL - jobUrl: http://your-jenkins-server/job/your-project/job/your-job - port: - entity: - mappings: - identifier: >- - ._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") | - gsub("%252F"; "-") | gsub("/"; "-") - title: .name - blueprint: '"jenkinsStage"' - properties: - status: .status - startTimeMillis: .startTimeMillis - durationMillis: .durationMillis - stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href - relations: - parentBuild: >- - ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; - "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | - gsub("/"; "-") -# Additional stage configurations follow the same pattern. -# Make sure to replace the jobUrl with your own Jenkins job URLs for each configuration. -- kind: stage - selector: - query: 'true' - # Example jobUrl - replace with your own Jenkins job URL - jobUrl: http://your-jenkins-server/job/your-project/job/another-job - port: - entity: - mappings: - identifier: >- - ._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") | - gsub("%252F"; "-") | gsub("/"; "-") - title: .name - blueprint: '"jenkinsStage"' - properties: - status: .status - startTimeMillis: .startTimeMillis - durationMillis: .durationMillis - stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href - relations: - parentBuild: >- - ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; - "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | - gsub("/"; "-") -- kind: stage - selector: - query: 'true' - # Example jobUrl - replace with your own Jenkins job URL - jobUrl: http://your-jenkins-server/job/your-project/job/third-job - port: - entity: - mappings: - identifier: >- - ._links.self.href | sub("^.*?/"; "") | gsub("%20"; "-") | - gsub("%252F"; "-") | gsub("/"; "-") - title: .name - blueprint: '"jenkinsStage"' - properties: - status: .status - startTimeMillis: .startTimeMillis - durationMillis: .durationMillis - stageUrl: env.OCEAN__INTEGRATION__CONFIG__JENKINS_HOST + ._links.self.href - relations: - parentBuild: >- - ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; - "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | - gsub("/"; "-") -``` - -
+ ## Let's Test It @@ -901,7 +483,7 @@ This section includes a sample response data from Jenkins. In addition, it inclu Here is an example of the payload structure from Jenkins:
-Job response data +Job response data (click to expand) ```json showLineNumbers { @@ -942,7 +524,7 @@ Here is an example of the payload structure from Jenkins:
-Build response data +Build response data (click to expand) ```json showLineNumbers { @@ -961,7 +543,7 @@ Here is an example of the payload structure from Jenkins:
-User response data +User response data (click to expand) ```json showLineNumbers { @@ -978,7 +560,7 @@ Here is an example of the payload structure from Jenkins:
-Stage response data +Stage response data (click to expand) ```json showLineNumbers { @@ -1004,7 +586,7 @@ Here is an example of the payload structure from Jenkins: The combination of the sample payload and the Ocean configuration generates the following Port entity:
-Job entity +Job entity (click to expand) ```json showLineNumbers { @@ -1029,7 +611,7 @@ The combination of the sample payload and the Ocean configuration generates the
-Build entity +Build entity (click to expand) ```json showLineNumbers { @@ -1056,7 +638,7 @@ The combination of the sample payload and the Ocean configuration generates the
-User entity +User entity (click to expand) ```json showLineNumbers { @@ -1079,7 +661,7 @@ The combination of the sample payload and the Ocean configuration generates the
-Stage entity +Stage entity (click to expand) ```json showLineNumbers { From 3dbeff7ded4ed325c458c1db808dd508e98012e3 Mon Sep 17 00:00:00 2001 From: sivanel97 Date: Thu, 23 Oct 2025 09:36:58 +0300 Subject: [PATCH 2/8] Apply suggestion from @sivanel97 --- .../jenkins/_example_jenkins_default_mapping_configuration.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx index 3a4a76073b..87c96664bf 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx @@ -1,5 +1,5 @@
-Default mapping configuration (Click to expand) +Default mapping configuration (click to expand) ```yaml showLineNumbers createMissingRelatedEntities: true From ffeed828534d84c5ca038ba76c8a44fdb508be33 Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Thu, 23 Oct 2025 17:15:30 +0000 Subject: [PATCH 3/8] Make `maxBuildsPerJob` configurable in Jenkins integration and refine examples. --- .../_example_jenkins_build_configuration.mdx | 36 ++----------------- .../_example_jenkins_user_configuration.mdx | 22 ++++++------ .../cicd/jenkins/jenkins.md | 2 +- 3 files changed, 14 insertions(+), 46 deletions(-) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx index 0cb05c4f9f..78176df411 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_build_configuration.mdx @@ -11,12 +11,10 @@ import TabItem from "@theme/TabItem" selector: query: "true" maxBuildsPerJob: 100 - daysSince: 1 - jobFilter: [] port: entity: mappings: - identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] + identifier: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] title: .displayName blueprint: '"jenkinsBuild"' properties: @@ -25,7 +23,7 @@ import TabItem from "@theme/TabItem" buildDuration: .duration timestamp: '.timestamp / 1000 | todate' relations: - parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "") + parentJob: .url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1] | gsub("-[0-9]+$"; "") previousBuild: >- if .previousBuild then (.previousBuild.url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | @@ -50,34 +48,4 @@ By default, this selector is set to `100` which means the last 100 builds of eac - - -The `daysSince` selector is an optional parameter that allows you to limit the number of days to look back from the current time to fetch dependency data. -By default, this selector is set to `1` day which means the last day of builds will be fetched. - -```yaml - - kind: build - selector: - query: 'true' - # highlight-next-line - daysSince: 1 -``` - - - - - -The `jobFilter` selector is an optional parameter that allows you to filter the jobs to fetch data from. -By default, this selector is set to `[]` which means all jobs will be fetched. - -```yaml - - kind: build - selector: - query: 'true' - # highlight-next-line - jobFilter: [] -``` - - - \ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx index 0ea9b12384..cb4819ab05 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_user_configuration.mdx @@ -5,17 +5,17 @@ createMissingRelatedEntities: true deleteDependentEntities: true resources: - kind: user - selector: - query: "true" - port: - entity: - mappings: - identifier: .user.id - title: .user.fullName - blueprint: '"jenkinsUser"' - properties: - url: .user.absoluteUrl - lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ") + selector: + query: "true" + port: + entity: + mappings: + identifier: .user.id + title: .user.fullName + blueprint: '"jenkinsUser"' + properties: + url: .user.absoluteUrl + lastUpdateTime: if .lastChange then (.lastChange/1000) else now end | strftime("%Y-%m-%dT%H:%M:%SZ") ```
\ No newline at end of file diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md index afbc94d440..f2985c6545 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/jenkins.md @@ -455,7 +455,7 @@ Examples of blueprints and the relevant integration configurations: ### Build :::note Build Limit -The integration fetches up to 100 builds per Jenkins job, allowing you to view the 100 latest builds in Port for each job. +By default, the integration fetches up to 100 builds per Jenkins job. This limit is configurable using the `maxBuildsPerJob` selector. See the configuration options below for more details. ::: From 7fff52207109e91dfaf065e49e67b6aa449aeaf9 Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Fri, 24 Oct 2025 07:02:47 +0000 Subject: [PATCH 4/8] Remove unused `daysSince` and `jobFilter` fields from Jenkins mapping configuration example. --- .../jenkins/_example_jenkins_default_mapping_configuration.mdx | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx index 87c96664bf..4108fb63f6 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx @@ -24,8 +24,6 @@ resources: selector: query: 'true' maxBuildsPerJob: 100 - daysSince: 1 - jobFilter: [] port: entity: mappings: From a3391db5323d55eaab09e2c5218aa33ca1e7c72c Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Fri, 24 Oct 2025 15:38:34 +0000 Subject: [PATCH 5/8] Update _example_jenkins_stage_configuration.mdx Co-authored-by: Jaden Kodjo Miles <87667954+kodjomiles@users.noreply.github.com> --- .../cicd/jenkins/_example_jenkins_stage_configuration.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx index 1bb51861b0..dd95f2c25c 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx @@ -32,7 +32,6 @@ To prevent overwhelming your Ocean instance with potentially thousands of stages "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") # Additional stage configurations follow the same pattern. -# Make sure to replace the jobUrl with your own Jenkins job URLs for each configuration. - kind: stage selector: query: 'true' From ba5fcd782d138565f838b3f3dd9b68cfb6b6b1ba Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Fri, 24 Oct 2025 15:38:52 +0000 Subject: [PATCH 6/8] Update _example_jenkins_stage_configuration.mdx Co-authored-by: Jaden Kodjo Miles <87667954+kodjomiles@users.noreply.github.com> --- .../cicd/jenkins/_example_jenkins_stage_configuration.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx index dd95f2c25c..aeb4e851b3 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_stage_configuration.mdx @@ -55,6 +55,7 @@ To prevent overwhelming your Ocean instance with potentially thousands of stages ._links.self.href | sub("/execution/node/[0-9]+/wfapi/describe$"; "") | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") + - kind: stage selector: query: 'true' From 23d3bd1511b038c1508cbb6ae06186fa202233f1 Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Fri, 24 Oct 2025 15:39:03 +0000 Subject: [PATCH 7/8] Update _example_jenkins_default_mapping_configuration.mdx Co-authored-by: Jaden Kodjo Miles <87667954+kodjomiles@users.noreply.github.com> --- .../jenkins/_example_jenkins_default_mapping_configuration.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx index 4108fb63f6..f8870a1b2b 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx @@ -42,6 +42,7 @@ resources: if .previousBuild then (.previousBuild.url | split("://")[1] | sub("^.*?/"; "") | gsub("%20"; "-") | gsub("%252F"; "-") | gsub("/"; "-") | .[:-1]) else null end + - kind: user selector: query: 'true' From d4291e2a18ab4b6ce7f79dbdb7acb5d87cde5e52 Mon Sep 17 00:00:00 2001 From: Dennis Bilson Date: Fri, 24 Oct 2025 15:39:11 +0000 Subject: [PATCH 8/8] Update _example_jenkins_default_mapping_configuration.mdx Co-authored-by: Jaden Kodjo Miles <87667954+kodjomiles@users.noreply.github.com> --- .../jenkins/_example_jenkins_default_mapping_configuration.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx index f8870a1b2b..11a20e6f9b 100644 --- a/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx +++ b/docs/build-your-software-catalog/sync-data-to-catalog/cicd/jenkins/_example_jenkins_default_mapping_configuration.mdx @@ -20,6 +20,8 @@ resources: jobStatus: '{"notbuilt": "created", "blue": "passing", "red": "failing"}[.color]' timestamp: .time parentJob: .__parentJob + + - kind: build selector: query: 'true'