Skip to main content

Usual Command Flows - Sprint Release and Change Flow

This flow describes the process when code is promoted through environments during sprint releases.

1. Pre-Release - Complete Feature Work


Bash
# Ensure all changes are committed
git status
sf project retrieve start --target-org my-scratch-org
git add .
git commit -m "TICKET-123: Final implementation"
git push origin feature/my-ticket-branch

2. Create Pull Request

Via BitBucket UI:

  • Navigate to your repository in BitBucket
  • Click "Create Pull Request"
  • Source: feature/my-ticket-branch
  • Destination: main (or current sprint branch)
  • Add description and link to ticket

3. Pipeline Validation (Automated)

BitBucket automatically triggers:

Yaml
# This happens automatically in the pipeline
# Code Analyzer steps
pmd-analyzer: Check Apex code quality
eslint: Check JavaScript/LWC quality
sf scanner run: Security and quality scans

# Validation deployment
sf project deploy validate --target-org target-sandbox --test-level RunLocalTests

If validation fails: Technical Architect reviews and adds fixes to PR branch.

4. Pull Request Merge

Once validation passes and PR is approved:Bash

# Via BitBucket UI - Click "Merge" button

5. Post-Merge Deployment (Automated)

Option A: Simple Deployment (No Destructive Changes)


Bash
# Automated pipeline command
sf project deploy start --target-org target-sandbox --test-level RunLocalTests --wait 30

Option B: SGD - Salesforce Git Delta Deploy (With Destructive Changes)


Bash
# Automated pipeline using SGD tool
# Generates delta packages between commits

# Install SGD (if not already in pipeline)
sf plugins install sfdx-git-delta

# Generate delta package
sf sgd source delta --to "HEAD" --from "HEAD~1" --output-dir "sgd"

# Deploy with destructive changes
sf project deploy start -x sdg/package/package.xml --post-destructive-changes sdg/destructiveChanges/destructiveChanges.xml

9. Rollback (If Needed)


Bash
# Quick rollback using git
git revert <commit-hash>
git push origin main

# Or restore from previous deployment
sf project deploy start --manifest path/to/previous-package.xml --target-org target-sandbox