From b6a408b38c2037f4d0d596a19abb37724f1c99ee Mon Sep 17 00:00:00 2001 From: Tony Williams Date: Tue, 24 May 2016 10:05:14 +0100 Subject: [PATCH] Added basic support for bitbuckets piplines CI: https://blog.bitbucket.org/2016/05/24/introducing-bitbucket-pipelines-beta-continuous-delivery-built-within-bitbucket/ --- src/app/FakeLib/BitbucketPipelines.fs | 21 +++++++++++++++++++++ src/app/FakeLib/BuildServerHelper.fs | 3 +++ src/app/FakeLib/FakeLib.fsproj | 1 + 3 files changed, 25 insertions(+) create mode 100644 src/app/FakeLib/BitbucketPipelines.fs diff --git a/src/app/FakeLib/BitbucketPipelines.fs b/src/app/FakeLib/BitbucketPipelines.fs new file mode 100644 index 00000000000..955cd253879 --- /dev/null +++ b/src/app/FakeLib/BitbucketPipelines.fs @@ -0,0 +1,21 @@ +/// Contains code to configure FAKE for Bitbucket Pipelines integration +module Fake.BitbucketPipelines + +/// Bitbucket Pipelines environment variables as [described](https://confluence.atlassian.com/bitbucket/environment-variables-in-bitbucket-pipelines-794502608.html) +type BitbucketPipelinesEnvironment = + + /// The commit hash of a commit that kicked off the build + static member Commit = environVar "BITBUCKET_COMMIT" + + /// The branch on which the build was kicked off. This value is only available on branches. + static member Branch = environVar "BITBUCKET_BRANCH" + + /// The tag of a commit that kicked off the build. This value is only available on tags. + static member Tag = environVar "BITBUCKET_TAG" + + /// The URL-friendly version of a repository name. + static member RepoSlug = environVar "BITBUCKET_REPO_SLUG" + + /// The name of the account in which the repository lives + static member RepoOwner = environVar "BITBUCKET_REPO_OWNER" + diff --git a/src/app/FakeLib/BuildServerHelper.fs b/src/app/FakeLib/BuildServerHelper.fs index 15a4aa06ccd..39537d6b5b8 100644 --- a/src/app/FakeLib/BuildServerHelper.fs +++ b/src/app/FakeLib/BuildServerHelper.fs @@ -12,6 +12,7 @@ type BuildServer = | AppVeyor | GitLabCI | Bamboo + | BitbucketPipelines | LocalBuild /// The trace mode option. @@ -88,6 +89,7 @@ let buildServer = elif isGitlabCI then GitLabCI elif isTFBuild then TeamFoundation elif isBambooBuild then Bamboo + elif hasBuildParam "BITBUCKET_COMMIT" then BitbucketPipelines else LocalBuild /// The current build version as detected from the current build server. @@ -103,6 +105,7 @@ let buildVersion = | TeamFoundation -> getVersion tfBuildNumber | Bamboo -> getVersion bambooBuildNumber | LocalBuild -> getVersion localBuildLabel + | BitbucketPipelines -> getVersion "" /// Is true when the current build is a local build. let isLocalBuild = LocalBuild = buildServer diff --git a/src/app/FakeLib/FakeLib.fsproj b/src/app/FakeLib/FakeLib.fsproj index 762eb3f2b6b..ff37a666859 100644 --- a/src/app/FakeLib/FakeLib.fsproj +++ b/src/app/FakeLib/FakeLib.fsproj @@ -61,6 +61,7 @@ +