Skip to content

Commit 7cda977

Browse files
authored
Merge pull request #525 from codacy/bitbucket-sha-detector
feature: Support Bitbucket Cloud Pipelines
2 parents 5fe7aa4 + b533654 commit 7cda977

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/main/scala/com/codacy/rules/commituuid/CommitUUIDProvider.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ object CommitUUIDProvider extends LogSupport {
6565
ArgoCDProvider,
6666
AWSCodeBuildProvider,
6767
AzurePipelinesProvider,
68+
BitbucketCloudProvider,
6869
BitriseCIProvider,
6970
BuildkiteCIProvider,
7071
CircleCIProvider,
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.codacy.rules.commituuid.providers
2+
3+
import com.codacy.model.configuration.CommitUUID
4+
import com.codacy.rules.commituuid.CommitUUIDProvider
5+
6+
/** Bitbucket Cloud Pipeline provider */
7+
object BitbucketCloudProvider extends CommitUUIDProvider {
8+
val name: String = "Bitbucket Cloud Pipeline"
9+
10+
override def validateEnvironment(environment: Map[String, String]): Boolean = {
11+
// CI is a bit generic and could be used by other CI Providers as well
12+
// Check on Bitbucket Build Number as well
13+
environment.contains("CI") && environment.contains("BITBUCKET_BUILD_NUMBER")
14+
}
15+
16+
override def getValidCommitUUID(environment: Map[String, String]): Either[String, CommitUUID] =
17+
parseEnvironmentVariable(environment.get("BITBUCKET_COMMIT"))
18+
}

0 commit comments

Comments
 (0)