Decoupling Build and Release: Mastering Bamboo Deployment Projects
Stop rebuilding code for every environment. Learn how to use Bamboo Deployment Projects to promote immutable artifacts using environment-specific variables for a stable CD pipeline.
13 Dec 2025, 08:12 UTC

The 'Build-to-Deploy' Bottleneck
A common friction point in CI/CD pipelines is the tendency to bundle deployment logic directly into the build plan. When the same script that compiles code also pushes it to production, you lose the ability to promote a specific, verified artifact through a sequence of environments. You end up rebuilding the code for each stage, which introduces the risk that what you tested in Staging is not identical to what reaches Production.
The solution is the Bamboo Deployment Project. By separating the build phase (CI) from the release phase (CD), you can treat a build artifact as an immutable package that is promoted across environments using environment-specific configurations.
The Mechanics of Artifact Promotion
In Bamboo, a Build Plan produces an artifact (a ZIP, WAR, or JAR file). A Deployment Project then consumes this artifact. This separation allows you to decouple the frequency of builds from the cadence of releases.
Deployment Projects organize the workflow into Environments (e.g., Development, QA, Production). Each environment contains a set of Deployment Tasks—such as shell scripts or plugin-based actions—that define how the artifact is installed and started on the target server. Because the artifact is the same across all environments, you eliminate "it worked in QA but failed in Prod" errors caused by compilation differences.
Handling Environment-Specific Variables
The primary challenge of using a single artifact across multiple servers is configuration. You cannot hardcode a database URL into your binary; instead, you use Deployment Variables.
Bamboo utilizes a hierarchical variable system. You can define a variable at the Project level (global to all environments) and then override it at the Environment level. When a deployment task runs, Bamboo resolves the variable to the most specific value available for that target environment.
Example: Database Connection Configuration
Consider a scenario where your application requires a db.connection.string. You can configure this in the Bamboo UI as follows:
| Scope | Variable Name | Value | Purpose |
|---|---|---|---|
| Deployment Project | db.connection.string |
jdbc:mysql://localhost:3306/default |
Fallback value |
| Staging Environment | db.connection.string |
jdbc:mysql://staging-db:3306/app_stage |
Staging override |
| Production Environment | db.connection.string |
jdbc:mysql://prod-db:3306/app_prod |
Production override |
To use this in a deployment task, you would reference the variable using Bamboo's syntax: ${bamboo.db.connection.string}. If you are running a shell script task on a remote agent, the command might look like this:
# Run on the target deployment agent with 'sudo' or app-user permissions
echo "Updating config with ${bamboo.db.connection.string}" > /etc/app/config.properties
systemctl restart my-application
Risk: Ensure the agent executing the task has the necessary SSH keys or sudo permissions to modify files on the target server. Incorrect permissions will result in a "Permission Denied" error in the Bamboo logs.
Trade-offs and Limitations
While Deployment Projects provide structure, they introduce specific overheads:
- Storage Pressure: Because Bamboo retains artifacts for each release version to enable rollbacks, the shared home directory can grow rapidly. You must configure Artifact Retention policies to prune old versions.
- Variable Complexity: Deeply nested variable overrides can make it difficult to diagnose why a specific value was applied. Always check the "Variables" tab of the specific environment during a failure.
- Environment Drift: If developers manually change configurations on a server without updating the Bamboo variable, the environment drifts. The only way to prevent this is to treat the Deployment Project as the single source of truth and disable manual server access.
Verifying the Deployment
To verify that your configuration is working correctly, follow these steps:
- Create a Deployment Project and link it to your Build Plan.
- Define a test variable (e.g.,
test.env.name) at both the Project and Environment levels. - Create a simple "Script" task that executes
echo "Deploying to ${bamboo.test.env.name}". - Run the deployment for two different environments and verify that the logs show the unique environment name rather than the global project value.
If the deployment fails or the wrong variable is used, you can perform a Rollback by selecting a previous successful release version from the environment history and clicking "Deploy." This replaces the current state with the previous stable artifact and its associated variables.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.