CloudTruth Documentation
Sign InAPIIntegrationsGitHubVisit our website
  • Overview
  • Getting Started
  • Architecture
    • 🔒Security Overview
  • Copilot
  • 🏢Org management
    • Account Setup
    • Access Control
      • 🔑API Tokens
      • 🌐Protecting Projects and Environments
      • 👥Users
    • Audit Log
  • 🛠️Config Management
    • Projects
    • Parameters
      • Sharing Config Data
      • Parameter Management
        • Internal Values
          • Dynamic Values
        • External Values
          • Terraform Remote State Files
        • Parameter Override
        • Environment Value Override
      • Parameter and Parameter Value Inheritance
      • Value Comparison
      • Value History
      • Value Validation
      • Value Expiration
    • Environments and Tags
    • Templates
      • 📒Sample Templates
    • Actions
      • Import Actions
      • Push Actions
    • CLI & API
      • CloudTruth CLI
      • Rest API
    • Integrations
      • Argo CD
      • Atlassian Compass
      • AWS
        • AWS Connection
        • AWS Role
          • CloudFormation
          • Terrraform
          • AWS Console
        • Parameter Store (SSM)
        • S3
        • Secrets Manager
      • Azure Key Vault
      • Bitbucket Pipelines
      • Docker
      • Docker Compose
      • GitHub
      • GitHub Actions
      • GitLab
      • Harness
      • Jenkins
      • Kubernetes
      • Pulumi
      • Terraform
      • Terragrunt
      • Explorer
      • Circle CI
    • Events, Notifications, Webhooks
    • Types
  • 🔎REPORTING
    • Compare
    • History
    • Expirations
  • 🚀PRODUCT
    • What is CloudTruth?
    • Interactive Demo
    • Kubernetes
    • Terraform
    • CI/CD Pipeline Configuration
    • Cloud CMDB
    • Secrets Management
    • GitOps
    • Our Manifesto
    • Open Source
    • FAQs
    • Our Mission
  • 📚Reference
    • 🎓Quick Start Videos
      • What is CloudTruth?
      • CloudTruth in Action
      • Environments and Projects
      • Secrets, Parameters, ENV variables
      • Audit Logs, RBAC, SSO
      • Containers - Kubernetes, Docker
      • Infrastructure as Code (IaC) - Terraform, Cloudformation, CDK, Azure Bicep, Pulumi
      • CICD Pipelines - GitHub Actions, ArgoCD, Jenkins, CircleCI, Harness, GitLab Pipelines
      • AWS Videos - Secret Manager, Parameter Store, S3, IAM
      • Azure Videos - Azure DevOps, Azure Bicep, PowerShell
    • Knowledge Base
      • Best Practices
        • Versioned Releases
      • CLI
        • History comparison of deleted parameters with null values
      • Integrations
        • Advanced AWS IAM policy permissions
        • K8s pull image from private Docker registry
        • S3 Region Selection
      • Templates
        • Templates render quotations in key values as quot
    • Roadmap and New Features
    • JMESPath Reference
    • REST API
Powered by GitBook

Copyright© 2023 CloudTruth

On this page
  • Prerequisites
  • Provide Bitbucket Pipelines CloudTruth Access
  • Configure a Bitbucket Pipeline with CloudTruth Parameters
  • Using the CloudTruth CLI
  • Passing CloudTruth parameters across Bitbucket Pipeline steps
  • Using CloudTruth parameters across Bitbucket Pipeline steps

Was this helpful?

  1. Config Management
  2. Integrations

Bitbucket Pipelines

This walkthrough shows you how to use CloudTruth parameters with Bitbucket Pipelines.

PreviousAzure Key VaultNextDocker

Last updated 7 months ago

Was this helpful?

Prerequisites

  • You have a .

  • You have created one or more .

  • You have created a .

Provide Bitbucket Pipelines CloudTruth Access

You can get started with Bitbucket using a .

Add your generated CloudTruth API access token as a namedCLOUDTRUTH_API_KEY in your Repository settings > Pipelines > Repository variables. This allows the Bitbucket repository to securely access parameters stored in CloudTruth across all deployment environments.

Configure a Bitbucket Pipeline with CloudTruth Parameters

Using the CloudTruth CLI

You can install the CLI with the following code snippet as part of a Bitbucket step in bitbucket-pipelines.yml. This will install the latest supported version and also verify the CLI is installed correctly by printing the version.

We then use the CloudTruth CLI run command to print only CloudTruth variables that can now be accessed in your pipeline.

image: atlassian/default-image:2

pipelines:
  default:
      - step:
          name: 'Install CloudTruth CLI:'
          script:
            - (curl -sL https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh || wget -qO- https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh) | sh      
            
            - cloudtruth -V
            - cloudtruth --project MyFirstProject run -i none -- printenv 

Running this pipeline will install the CloudTruth CLI and print parameter values retrieved from CloudTruth.

Passing CloudTruth parameters across Bitbucket Pipeline steps

            - cloudtruth --project MyFirstProject parameter export shell --export > dotenv
          
          # Passes environment variables between stages  
          artifacts:
            - dotenv

Using CloudTruth parameters across Bitbucket Pipeline steps

In future pipeline steps you can source the dotenv artifact. The command source dotenv will execute the dotenv export allowing you to reference the variables in downstream stages without the CloudTruth CLI.

      - step:
          name: 'CloudTruth Variables Deployment to Staging'
          deployment: staging
          script:
            - echo "Test CloudTruth Staging Step"
            - source dotenv
            - printenv

The complete bitbucket-pipelines.yml passing variables between steps.

image: atlassian/default-image:2

pipelines:
  default:
      - step:
          name: 'Install CloudTruth CLI:'
          script:
            - (curl -sL https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh || wget -qO- https://github.com/cloudtruth/cloudtruth-cli/releases/latest/download/install.sh) | sh      
              
            - cloudtruth -V
            - cloudtruth --project MyFirstProject run -i none -- printenv 
            - cloudtruth --project MyFirstProject parameter export shell --export > dotenv
          
          # Passes environment variables between stages  
          artifacts:
            - dotenv

      - step:
          name: 'CloudTruth Variables Deployment to Staging'
          deployment: staging
          script:
            - echo "Test CloudTruth Staging Step"
            - source dotenv
            - printenv

Running this pipeline will install the CloudTruth CLI and print the parameter values across multiple steps.

You can use variables across Bitbucket pipeline steps by creating an export formatted environment file and storing the file using . This snippet uses the CloudTruth CLI to create an export dotenv file with values pulled from CloudTruth.

🛠️
Bitbucket artifacts
Bitbucket account
CloudTruth Parameters
starter pipeline template
Bitbucket repository variable
CloudTruth API Access token