Skip to content

Commit 5d66bb5

Browse files
committed
Merge pull request #1248 from TWith2Sugars/bitbucket-pipeline
Added basic support for bitbuckets piplines CI
2 parents 47b7a16 + b6a408b commit 5d66bb5

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/app/FakeLib/BitbucketPipelines.fs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// Contains code to configure FAKE for Bitbucket Pipelines integration
2+
module Fake.BitbucketPipelines
3+
4+
/// Bitbucket Pipelines environment variables as [described](https://confluence.atlassian.com/bitbucket/environment-variables-in-bitbucket-pipelines-794502608.html)
5+
type BitbucketPipelinesEnvironment =
6+
7+
/// The commit hash of a commit that kicked off the build
8+
static member Commit = environVar "BITBUCKET_COMMIT"
9+
10+
/// The branch on which the build was kicked off. This value is only available on branches.
11+
static member Branch = environVar "BITBUCKET_BRANCH"
12+
13+
/// The tag of a commit that kicked off the build. This value is only available on tags.
14+
static member Tag = environVar "BITBUCKET_TAG"
15+
16+
/// The URL-friendly version of a repository name.
17+
static member RepoSlug = environVar "BITBUCKET_REPO_SLUG"
18+
19+
/// The name of the account in which the repository lives
20+
static member RepoOwner = environVar "BITBUCKET_REPO_OWNER"
21+

src/app/FakeLib/BuildServerHelper.fs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type BuildServer =
1212
| AppVeyor
1313
| GitLabCI
1414
| Bamboo
15+
| BitbucketPipelines
1516
| LocalBuild
1617

1718
/// The trace mode option.
@@ -88,6 +89,7 @@ let buildServer =
8889
elif isGitlabCI then GitLabCI
8990
elif isTFBuild then TeamFoundation
9091
elif isBambooBuild then Bamboo
92+
elif hasBuildParam "BITBUCKET_COMMIT" then BitbucketPipelines
9193
else LocalBuild
9294

9395
/// The current build version as detected from the current build server.
@@ -103,6 +105,7 @@ let buildVersion =
103105
| TeamFoundation -> getVersion tfBuildNumber
104106
| Bamboo -> getVersion bambooBuildNumber
105107
| LocalBuild -> getVersion localBuildLabel
108+
| BitbucketPipelines -> getVersion ""
106109

107110
/// Is true when the current build is a local build.
108111
let isLocalBuild = LocalBuild = buildServer

src/app/FakeLib/FakeLib.fsproj

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
<Compile Include="ProcessHelper.fs" />
6262
<Compile Include="NpmHelper.fs" />
6363
<Compile Include="AppVeyor.fs" />
64+
<Compile Include="BitbucketPipelines.fs" />
6465
<Compile Include="TaskRunnerHelper.fs" />
6566
<Compile Include="Globbing\Globbing.fs" />
6667
<Compile Include="Globbing\FileSystem.fs" />

0 commit comments

Comments
 (0)