Match Pool
Learn how to dynamically match pool assignment rules for intelligent environment selection in PR validation and deployment workflows
The matchPool action provides dynamic pool selection based on configured assignment rules in sfp server. It enables sophisticated environment routing where different branches or domains can be assigned to different scratch org or sandbox pools.
Overview
In complex Salesforce development environments, you may need different review environments for different scenarios - hotfix branches might need a dedicated pool, while feature branches use a shared pool. The match pool action provides:
Rule-based matching using patterns configured in sfp server
Branch and domain awareness for precise environment selection
Fallback support when no rules match
Pool type detection distinguishing scratch orgs from sandboxes
This makes it perfect for:
Dynamic PR validation environment assignment
Multi-tenant review environment strategies
Branch-specific pool routing (hotfix vs feature)
Domain-specific environment allocation
Cost optimization through intelligent pool selection
How It Works
The action queries sfp server's review environment rules API to find the best matching pool:
Prerequisites
Before using this action:
sfp server is configured with review environment rules:
SFP_SERVER_URLas a variableSFP_SERVER_TOKENas a secret
Pool assignment rules exist in sfp server - Rules define which pools to use for which branch/domain combinations
Your workflow uses the sfops Docker image:
Referencing the Action
The matchPool action is located in your sfops repository:
Basic Usage
Simple Pool Matching
Match a pool for PR validation:
With Fallback Pool
Provide a default pool when no rules match:
Dynamic Domain Matching
Match pools for different domains in a matrix build:
Input Reference
repository
Yes
-
Repository identifier (owner/repo)
branch
Yes
-
Branch to match against rules
domain
Yes
-
Domain to match against rules
fallback-pool
No
-
Pool to use if no rules match
sfp-server-url
Yes
-
URL to sfp server instance
sfp-server-token
Yes
-
Authentication token for sfp server
sfp-cli-version
No
latest
Version of sfp CLI to use
Output Reference
pool-tag
The matched or fallback pool tag
hotfix-pool, feature-pool
pool-type
Type of pool
SANDBOX or SCRATCH_ORG
matched
Whether a rule matched
true or false
match-result
Full match result as JSON
{"matched":true,"poolTag":...}
Understanding Pool Assignment Rules
Pool assignment rules in sfp server define patterns for matching branches and domains to pools. Rules are evaluated in priority order.
Rule Structure
Rules typically include:
Branch pattern: Regex or glob pattern matching branch names
Domain pattern: Regex or glob pattern matching domain names
Pool tag: The pool to assign when rule matches
Pool type: SANDBOX or SCRATCH_ORG
Priority: Order of evaluation (higher priority wins)
Example Rules
With these rules:
hotfix/urgent-fix+ any domain →hotfix-sandbox-poolrelease/v2.0+coredomain →release-core-poolfeature/new-feature+salesdomain →default-scratch-pool
Common Use Cases
Hotfix Priority Routing
Route hotfix branches to dedicated pools:
Domain-Specific Environments
Use different pools for different domains:
Conditional Workflow Based on Pool Type
Adjust workflow based on whether pool is sandbox or scratch org:
Full Match Result Processing
Access the complete match result for advanced scenarios:
Best Practices
Always Provide Fallback Pools
Ensure workflows don't fail when no rules match:
Use Descriptive Pool Tags
Configure pools with meaningful names:
Log Pool Assignments
Add visibility into pool selection for debugging:
Troubleshooting
No Match Found
If matching fails without a fallback:
Verify rules exist in sfp server for the branch/domain combination
Check branch name matches rule patterns (case-sensitive)
Ensure domain name is correct
Add a fallback pool for safety
Wrong Pool Selected
If unexpected pool is assigned:
Review rule priorities in sfp server
Check for overlapping patterns
Verify branch and domain values being passed
Review
match-resultoutput for debugging
Authentication Errors
If sfp server connection fails:
Verify
SFP_SERVER_URLis correctCheck
SFP_SERVER_TOKENis valid and not expiredEnsure the token has permissions for review-envs API
Last updated