Built-in CIE Codebase Variables Reference

Updated 1 day ago by Manish Jaiswal

This topic describes the default CIE-specific (built-in) Harness expressions for Codebase. Refer to the following CIE Codebase expressions in Harness to refer to various Git attributes: This list will be periodically updated when new expressions are added to Harness.

Expression Example

Here is a simple example of a Shell Script step echoing some common Codebase variable expressions:

echo <+codebase.commitSha>
echo <+codebase.targetBranch>
echo <+codebase.sourceBranch>
echo <+codebase.prNumber>
echo <+codebase.prTitle>
echo <+codebase.commitRef>
echo <+codebase.repoUrl>
echo <+codebase.gitUserId>
echo <+codebase.gitUserEmail>
echo <+codebase.gitUser>
echo <+codebase.gitUserAvatar>
echo <+codebase.pullRequestLink>
echo <+codebase.pullRequestBody>
echo <+codebase.state>

Here is the output of the example expressions:

+ echo 85116fa2f04858cd5e946d69f24d7359205a0737
85116fa2f04858cd5e946d69f24d7359205a0737
+ echo main
main
+ echo **************-patch-5-1
**************-patch-5-1
+ echo 8
8
+ echo Update README.md
Update README.md
+ echo https://github.com/**************/CI-How-Tos
https://github.com/**************/CI-How-Tos
+ echo **************
**************
+ echo

+ echo

+ echo 'https://avatars.githubusercontent.com/u/89968129?v=4'
https://avatars.githubusercontent.com/u/89968129?v=4
+ echo https://github.com/**************/CI-How-Tos/pull/8
https://github.com/**************/CI-How-Tos/pull/8
+ echo open
Open

Expression in Harness UI:

Manual Tag Build

<+codebase.build.type> == “tag”

Use the following expressions in Harness to refer to the following Git attributes for manual tag builds:

<+codebase.tag>

Git tag of the build.

<+codebase.commitSha>

Git commit Id of the build.

Manual Branch Build

<+codebase.build.type> == “branch”

Use the following expressions in Harness to refer to the following Git attributes for manual branch builds:

<+codebase.branch>

Git branch name of the build.

<+codebase.commitSha>

Git commit id of the build.

Pull Request Webhook Event or Manual Pull Request Build

<+codebase.build.type> == “PR”

Use the following expressions in Harness to refer to the following Git attributes for pull request webhook events, or manual pull request builds:

<+codebase.branch>

Git branch name of the pull request.

<+codebase.tag>

Git tag of the build. 

<+codebase.commitSha>

Git commit id of the build. 

<+codebase.targetBranch>

Git Target branch of the build.

<+codebase.sourceBranch>

Git Source branch of the build.

<+codebase.prNumber>

Git pull request number. 

<+codebase.prTitle>

Git pull request name. 

<+codebase.commitSha>

Git commit id of the build. 

<+codebase.baseCommitSha>

Git base commit id of the build.

<+codebase.commitRef>

Git Commit ID Reference.

<+codebase.repoUrl>

Git repo url of the build. 

<+codebase.gitUserId>

Git user id.

<+codebase.gitUserEmail>

User email of the Git account.

<+codebase.gitUser>

User name of the Git account.

<+codebase.gitUserAvatar>

User avatar of the Git account.

Git pull request link.

<+codebase.pullRequestBody>

Git pull request body.

<+codebase.state>

State of the Git working directory.

Push Webhook Event

<+codebase.build.type> == “Push”

Use the following expressions in Harness to refer to the following Git attributes for push event webhook builds:

<+codebase.branch>

Git branch name of the Push webhook event. 

<+codebase.tag>

Git tag of the build for the Push webhook event.

<+codebase.commitSha>

Git commit ID of the build for the Push webhook event.

<+codebase.targetBranch>

Git Target branch of the build for the Push webhook event.

<+codebase.repoUrl>

Git repo URL of the build for the Push webhook event.

<+codebase.gitUserId>

User ID of the Git account for the Push webhook event.

<+codebase.gitUserEmail>

User email of the Git account for the Push webhook event.

<+codebase.gitUser>

User name of the Git account for Push webhook event. 

<+codebase.gitUserAvatar>

User avatar of the Git account for Push webhook event.

See Also

Built-in Git Trigger Reference


Please Provide Feedback