github.com/khulnasoft/codebase@v0.0.0-20231214144635-a707781cbb24/cienv/bitbucket_pipelines.go (about)

     1  package cienv
     2  
     3  import "os"
     4  
     5  // IsInBitbucketPipeline returns true if codebase is running in Bitbucket Pipelines.
     6  func IsInBitbucketPipeline() bool {
     7  	// https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/#Default-variables
     8  	return os.Getenv("BITBUCKET_PIPELINE_UUID") != ""
     9  }
    10  
    11  // IsInBitbucketPipe returns true if codebase is running in a Bitbucket Pipe.
    12  func IsInBitbucketPipe() bool {
    13  	// https://support.atlassian.com/bitbucket-cloud/docs/write-a-pipe-for-bitbucket-pipelines/
    14  	// this env variables are not really documented, but they are present in the build environment
    15  	return os.Getenv("BITBUCKET_PIPE_STORAGE_DIR") != "" || os.Getenv("BITBUCKET_PIPE_SHARED_STORAGE_DIR") != ""
    16  }