During the custom policy development cycle, you can upload your policy to Exchange to create a new Exchange asset to manage the policy’s version and to distribute it to other users. For more information about Exchange, see exchange::index.adoc.
For custom policies running in Local Mode, it is not required to publish your policy to Exchange. However, Exchange is a useful version control tool. It is your responsibility to distribute custom policies for Local Mode use.
When uploading your policy to Exchange, you can choose to either:
-
Publish a Custom Policy
Publish a policy if the policy version is still in development. This enables you to test and edit the policy version. -
Release a Custom Policy
Release the policy to create a definitive version of the policy. After releasing the policy, you must create a new policy version to edit the policy.
Every time you publish or release a policy, you create a new stable
asset in Exchange. For more information about stable
state assets, see Stable State Assets.
After you upload your policy to Exchange, see policies-pdk-apply-policies.adoc.
-
Ensure that the Connected App you used to authenticate to the Anypoint Platform CLI has the
Exchange Contributor
scope applied.
To publish a custom policy, run the make publish
command from the policy’s root folder:
make publish
After publishing the asset, a new asset labeled DEV
appears in Exchange:
The asset’s group ID, asset ID, and asset version (GAV) appear, similar to the following:
-
groupID:
<organizationId>
-
assetID:
my-custom-policy-dev
When publishing a policy,
-dev
appears appended to the assetID. -
version:
1.0.0-20230618115723
When publishing a policy, a timestamp appears appended to the version.
Rerunning the publish command creates a new version of the policy asset with an updated timestamp. Previously published policy versions are still available.
To release a custom policy, run the make release
command from the policy’s root folder:
make release
Released policies are not labeled DEV
. The asset’s GAV appears similar to the following:
-
groupID:
<organizationId>
-
assetID:
my-custom-policy
Released policies do not have
-dev
appended to their assetID. -
version:
1.0.0
Released policies do not have a timestamp appended to their assetID.
After releasing the asset, rerunning the make release
command results in a conflict error.
To begin working on the next version of your policy, update the version number in the Cargo.toml
file.
For example, if the latest version is 1.0.0
, update the Cargo.toml
file as follows to begin working on a minor release:
name = "my-custom-policy"
version = "1.1.0"