Skip to main content

Build Type: Harness

This is a SLSA Provenance buildType that describes the execution of a Harness pipeline.

This build type was inspired by the GitHub Actions build type described here.

Description

"buildType": "https://docs.cimon.build/provenance/buildtypes/harness/v1"

The Harness build type describes the execution of a Harness CI/CD pipeline that builds a software artifact.

Build Definition

External parameters

All external parameters are REQUIRED unless empty.

ParameterTypeDescription
workflowobjectThe workflow that was run
workflow.namestringThe unique name of the Harness pipeline
workflow.repositorystringURI of the git repository
workflow.refstringA git reference to the commit
jobobjectThe current stage that was running in Harness
job.jobNamestringThe stage name
job.jobIdstringThe stage name (which is also a stage ID)
buildobjectThe specific build that generated the provenance
build.buildRunstringThe build run ID
build.buildUrlstringThe full web URL for the build

Example:

"externalParameters": {
"workflow": {
"name": "Build_MyOrg_MyRepo_123123123123",
"repository": "https://github.com/MyOrg/MyRepo",
"ref": "refs/heads/main"
},
"job": {
"jobName": "build123",
"jobId": "build123"
},
"build": {
"buildRun": "11",
"buildUrl": "https://app.harness.io/ng/#/account/<account_id>/ci/orgs/default/projects/default_project/pipelines/Build_MyOrg_MyRepo_123123123123/executions/zby4kic-SOKOkQQwFCopSA/pipeline?stage=FsAsXIzKT8WeDP0F7h1vbA&amp;stageExecId"
}
}

Internal parameters

All internal parameters are OPTIONAL.

The internal parameters contain the CI environment variables as they appear in the build. More info regarding Harness environment variables can be found here. This is how the internal parameters look for this type of build type:

"internalParameters": {
"DRONE_BRANCH": "main",
"DRONE_BUILD_EVENT": "push",
"DRONE_BUILD_LINK": "https://app.harness.io/ng/#/account/<account_id>/ci/orgs/default/projects/default_project/pipelines/Build_MyOrg_MyRepo_123123123123/executions/zby4kic-SOKOkQQwFCopSA/pipeline?stage=FsAsXIzKT8WeDP0F7h1vbA&amp;stageExecId",
"DRONE_BUILD_NUMBER": "11",
"DRONE_BUILD_STARTED": "1722407153",
"DRONE_BUILD_TRIGGER": "John Doe",
"DRONE_COMMIT": "f924767a0bd8ebb0983d41ea12dfd33cca5c9e21",
"DRONE_COMMIT_AUTHOR": "john-doe",
"DRONE_COMMIT_AUTHOR_EMAIL": "john@doe",
"DRONE_COMMIT_AUTHOR_NAME": "John Doe",
"DRONE_COMMIT_BRANCH": "main",
"DRONE_COMMIT_REF": "refs/heads/main",
"DRONE_REPO_LINK": "https://github.com/MyOrg/MyRepo",
"DRONE_REPO_NAME": "MyRepo",
"DRONE_REPO_SCM": "Github",
"DRONE_REPO_VISIBILITY": "private",
"DRONE_SOURCE_BRANCH": "main",
"DRONE_STAGE_ARCH": "Amd64",
"DRONE_STAGE_MACHINE": "linux-amd64-bare-metal",
"DRONE_STAGE_NAME": "build123",
"DRONE_STAGE_OS": "Linux",
"DRONE_STAGE_TYPE": "HOSTED_VM",
"DRONE_TARGET_BRANCH": "main",
"HARNESS_ACCOUNT_ID": "<account_id>",
"HARNESS_EXECUTION_ID": "zby4kic-SOKOkQQwFCopSA",
"HARNESS_ORG_ID": "default",
"HARNESS_PIPELINE_ID": "Build_MyOrg_MyRepo_123123123123",
"HARNESS_PROJECT_ID": "default_project",
"HARNESS_STAGE_ID": "build123",
"HARNESS_STEP_ID": "Step Name"
}

Resolved Dependencies

The resolvedDependencies SHOULD contain an entry identifying the resolved git commit ID corresponding to externalParameters.workflow. The dependency's URI MUST be in SPDX Download Location format, i.e., "git+" + workflow.uri + "@" + workflow.ref.

"resolvedDependencies": [
{
"uri": "git+https://github.com/MyOrg/MyRepo@refs/heads/main",
"digest": {
"gitCommit": "f924767a0bd8ebb0983d41ea12dfd33cca5c9e21"
},
"annotations": {
"signedStatus": "unknown"
}
}
]

Each referenced commit contains signing information as well. The signedStatus field will receive one of three values:

  • signed: Confirmed that the commit is signed. In that case, gpgKeyId will also be included. The GPG Key ID should look similar to the command output: git log --show-signature -s.
  • unsigned: Confirmed that the commit is not signed.
  • unknown: The commit signing information could not be verified.

Run Details

Builder

The builder.id MUST represent the entity that generated the provenance, as per the SLSA Provenance documentation. In the case of Harness, this represents the Harness entity that running the build, and the runner type. Based on this information, the provenance consumer can decide whether the build environment is secure enough to trust the produced attestation.

Example:

"builder": {
"id": "https://developer.harness.io/docs/continuous-integration@HOSTED_VM"
}

Metadata

The invocationId SHOULD be set to the Harness Job URL.

Example:

"metadata": {
"invocationID": "https://app.harness.io/ng/#/account/<account_id>/ci/orgs/default/projects/default_project/pipelines/Build_MyOrg_MyRepo_123123123123/executions/zby4kic-SOKOkQQwFCopSA/pipeline?stage=FsAsXIzKT8WeDP0F7h1vbA&amp;stageExecId",
"startedOn": "2024-07-31T06:25:53Z"
}