Prasenjit Roy
07/27/2025, 6:23 PMAsk Inkeep
07/27/2025, 6:23 PMPermit Support Automation
07/27/2025, 6:23 PMAsk Inkeep
07/27/2025, 6:23 PMOPAL_POLICY_REPO_MAIN_BRANCH, which defaults to master) (2) (3) , and when changes are detected, it pushes updates to subscribed clients (1) . The policy update messages include the most recent commit hash from the tracked branch .
However, OPAL does support delta bundles, where clients can present a *base hash* to the server . When the server receives a base hash, it returns only the changes (new, modified, renamed and deleted files) since that commit .
The policy bundle API endpoint supports a base_hash parameter that allows fetching only policy files changed after a specific commit :
curl --request GET 'https://opal.permit.io/policy?base_hash=503e6f9821eb036ce6a4207a45ddbe147f1a0a7b&path=.'
For your use case of deploying specific commits rather than automatically following the main branch, you would need to:
1. Configure the OPAL server to track the specific commit/branch you want to deploy
2. Use the server's branch tracking mechanism rather than client-side commit selection
The current architecture is designed for the server to control which policies are distributed, ensuring consistency across all clients subscribed to the same policy topics .Ask Inkeep
07/27/2025, 6:23 PMOr Weis
07/27/2025, 6:32 PMOr Weis
07/27/2025, 6:32 PMAsk Inkeep
07/27/2025, 6:32 PMAsk Inkeep
07/27/2025, 6:32 PMOPAL_SCOPES=1 (1) (2) . You can then create different scopes for different branches or commits using the REST API.
Here's an example of creating two scopes - one for production (stable commit) and one for staging (latest main) :
curl --request PUT 'http://opal_server/scopes'
--header 'Content-Type: application/json'
--header 'Authorization: $OPAL_TOKEN'
--data-raw '{
"scope_id": "production",
"policy": {
"source_type": "git",
"url": "https://github.com/company/policy",
"auth": {
"auth_type": "github_token",
"token": "github_token"
},
"directories": [
"."
],
"extensions": [
".rego",
".json"
],
"manifest": ".manifest",
"poll_updates": false,
"branch": "production"
},
"data": {
"entries": []
}
}'
(1)
curl --request PUT 'http://opal_server/scopes'
--header 'Content-Type: application/json'
--header 'Authorization: $OPAL_TOKEN'
--data-raw '{
"scope_id": "staging",
"policy": {
"source_type": "git",
"url": "https://github.com/company/policy",
"auth": {
"auth_type": "github_token",
"token": "github_token"
},
"directories": [
"."
],
"extensions": [
".rego",
".json"
],
"manifest": ".manifest",
"poll_updates": true,
"branch": "main"
},
"data": {
"entries": []
}
}'
Launching clients with specific scopes
OPAL clients can then be configured to use specific scopes by setting the OPAL_SCOPE_ID environment variable (1) (3) :
docker run -it \
--env OPAL_CLIENT_TOKEN \
--env OPAL_SERVER_URL \
--env OPAL_DATA_TOPICS \
--env OPAL_SCOPE_ID=production \
-p 7766:7000 \
-p 8181:8181 \
permitio/opal-client
(1)
This approach allows your customer teams to deploy specific branches or commits by:
1. Creating scopes that point to specific branches or commits
2. Setting poll_updates: false for production scopes to prevent automatic updates
3. Manually updating scope configurations when you want to deploy new commits
4. Having different client fleets connect to different scopes based on their environment
Scopes are dynamic and can be created on the fly through the scopes API , making this a flexible solution for controlled deployments.Ask Inkeep
07/27/2025, 6:33 PMAsk Inkeep
07/27/2025, 6:37 PM