Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Support Bitbucket Cloud Pipelines commit sha detection #524

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ object CommitUUIDProvider extends LogSupport {
ArgoCDProvider,
AWSCodeBuildProvider,
AzurePipelinesProvider,
BitbucketCloudProvider,
BitriseCIProvider,
BuildkiteCIProvider,
CircleCIProvider,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.codacy.rules.commituuid.providers

import com.codacy.model.configuration.CommitUUID
import com.codacy.rules.commituuid.CommitUUIDProvider

/** Bitbucket Cloud Pipeline provider */
object BitbucketCloudProvider extends CommitUUIDProvider {
val name: String = "Bitbucket Cloud Pipeline"

override def validateEnvironment(environment: Map[String, String]): Boolean = {
// CI is a bit generic and could be used by other CI Providers as well
// Check on Bitbucket Build Number as well
environment.contains("CI") && environment.contains("BITBUCKET_BUILD_NUMBER")
}

override def getValidCommitUUID(environment: Map[String, String]): Either[String, CommitUUID] =
parseEnvironmentVariable(environment.get("BITBUCKET_COMMIT"))
}