docs(core): enterprise conformance rules docs (#29046)
Co-authored-by: JamesHenry <james@henry.sc>
This commit is contained in:
parent
1bf0e67e1b
commit
c7894d7579
@ -39,12 +39,12 @@
|
|||||||
],
|
],
|
||||||
"executors": [
|
"executors": [
|
||||||
{
|
{
|
||||||
"description": "Compile and bundle an Nx Conformance Rule",
|
"description": "Compile and bundle one or more Nx Conformance Rules",
|
||||||
"file": "external-generated/packages/powerpack-conformance/executors/bundle-rule.json",
|
"file": "external-generated/packages/powerpack-conformance/executors/bundle-rules.json",
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"name": "bundle-rule",
|
"name": "bundle-rules",
|
||||||
"originalFilePath": "/libs/nx-packages/powerpack-conformance/src/executors/bundle-rule/schema.json",
|
"originalFilePath": "/libs/nx-packages/powerpack-conformance/src/executors/bundle-rules/schema.json",
|
||||||
"path": "powerpack-conformance/executors/bundle-rule",
|
"path": "powerpack-conformance/executors/bundle-rules",
|
||||||
"type": "executor"
|
"type": "executor"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "bundle-rules",
|
||||||
|
"implementation": "/libs/nx-packages/powerpack-conformance/src/executors/bundle-rules/executor.ts",
|
||||||
|
"schema": {
|
||||||
|
"$schema": "https://json-schema.org/schema",
|
||||||
|
"version": 2,
|
||||||
|
"title": "BundleNxConformanceRules",
|
||||||
|
"description": "Compile and bundle one or more Nx Conformance Rules",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"outputPath": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The output path for the bundled rules to be written to"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["outputPath"],
|
||||||
|
"presets": []
|
||||||
|
},
|
||||||
|
"description": "Compile and bundle one or more Nx Conformance Rules",
|
||||||
|
"aliases": [],
|
||||||
|
"hidden": false,
|
||||||
|
"path": "/libs/nx-packages/powerpack-conformance/src/executors/bundle-rules/schema.json",
|
||||||
|
"type": "executor"
|
||||||
|
}
|
||||||
@ -847,6 +847,40 @@
|
|||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"path": "/ci/recipes/enterprise/dte",
|
"path": "/ci/recipes/enterprise/dte",
|
||||||
"tags": []
|
"tags": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "conformance",
|
||||||
|
"name": "Conformance",
|
||||||
|
"description": "Conformance features that are available to Nx Cloud Enterprise customers",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "",
|
||||||
|
"itemList": [
|
||||||
|
{
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance",
|
||||||
|
"tags": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
@ -1420,6 +1454,40 @@
|
|||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"path": "/ci/recipes/enterprise/dte",
|
"path": "/ci/recipes/enterprise/dte",
|
||||||
"tags": []
|
"tags": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "conformance",
|
||||||
|
"name": "Conformance",
|
||||||
|
"description": "Conformance features that are available to Nx Cloud Enterprise customers",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "",
|
||||||
|
"itemList": [
|
||||||
|
{
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance",
|
||||||
|
"tags": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
@ -1736,6 +1804,62 @@
|
|||||||
"path": "/ci/recipes/enterprise/dte/jenkins-dte",
|
"path": "/ci/recipes/enterprise/dte/jenkins-dte",
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
|
"/ci/recipes/enterprise/conformance": {
|
||||||
|
"id": "conformance",
|
||||||
|
"name": "Conformance",
|
||||||
|
"description": "Conformance features that are available to Nx Cloud Enterprise customers",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "",
|
||||||
|
"itemList": [
|
||||||
|
{
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance",
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud": {
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
},
|
||||||
|
"/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud": {
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"description": "",
|
||||||
|
"mediaImage": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"itemList": [],
|
||||||
|
"isExternal": false,
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"tags": ["conformance"]
|
||||||
|
},
|
||||||
"/ci/recipes/other": {
|
"/ci/recipes/other": {
|
||||||
"id": "other",
|
"id": "other",
|
||||||
"name": "Other",
|
"name": "Other",
|
||||||
|
|||||||
@ -6041,6 +6041,31 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Conformance",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance",
|
||||||
|
"id": "conformance",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"disableCollapsible": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
@ -6459,6 +6484,31 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Conformance",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance",
|
||||||
|
"id": "conformance",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"disableCollapsible": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
@ -6689,6 +6739,47 @@
|
|||||||
"children": [],
|
"children": [],
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Conformance",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance",
|
||||||
|
"id": "conformance",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"isExternal": false,
|
||||||
|
"children": [],
|
||||||
|
"disableCollapsible": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Other",
|
"name": "Other",
|
||||||
"path": "/ci/recipes/other",
|
"path": "/ci/recipes/other",
|
||||||
@ -10643,9 +10734,9 @@
|
|||||||
"name": "executors",
|
"name": "executors",
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "bundle-rule",
|
"id": "bundle-rules",
|
||||||
"path": "/nx-api/powerpack-conformance/executors/bundle-rule",
|
"path": "/nx-api/powerpack-conformance/executors/bundle-rules",
|
||||||
"name": "bundle-rule",
|
"name": "bundle-rules",
|
||||||
"children": [],
|
"children": [],
|
||||||
"isExternal": false,
|
"isExternal": false,
|
||||||
"disableCollapsible": false
|
"disableCollapsible": false
|
||||||
|
|||||||
@ -3681,13 +3681,13 @@
|
|||||||
"root": "/libs/nx-packages/powerpack-conformance",
|
"root": "/libs/nx-packages/powerpack-conformance",
|
||||||
"source": "/libs/nx-packages/powerpack-conformance/src",
|
"source": "/libs/nx-packages/powerpack-conformance/src",
|
||||||
"executors": {
|
"executors": {
|
||||||
"/nx-api/powerpack-conformance/executors/bundle-rule": {
|
"/nx-api/powerpack-conformance/executors/bundle-rules": {
|
||||||
"description": "Compile and bundle an Nx Conformance Rule",
|
"description": "Compile and bundle one or more Nx Conformance Rules",
|
||||||
"file": "external-generated/packages/powerpack-conformance/executors/bundle-rule.json",
|
"file": "external-generated/packages/powerpack-conformance/executors/bundle-rules.json",
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
"name": "bundle-rule",
|
"name": "bundle-rules",
|
||||||
"originalFilePath": "/libs/nx-packages/powerpack-conformance/src/executors/bundle-rule/schema.json",
|
"originalFilePath": "/libs/nx-packages/powerpack-conformance/src/executors/bundle-rules/schema.json",
|
||||||
"path": "/nx-api/powerpack-conformance/executors/bundle-rule",
|
"path": "/nx-api/powerpack-conformance/executors/bundle-rules",
|
||||||
"type": "executor"
|
"type": "executor"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1235,6 +1235,20 @@
|
|||||||
"id": "conformance",
|
"id": "conformance",
|
||||||
"name": "Run Language-Agnostic Conformance Rules",
|
"name": "Run Language-Agnostic Conformance Rules",
|
||||||
"path": "/nx-enterprise/powerpack/conformance"
|
"path": "/nx-enterprise/powerpack/conformance"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/configure-conformance-rules-in-nx-cloud",
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "",
|
||||||
|
"file": "nx-cloud/enterprise/conformance/publish-conformance-rules-to-nx-cloud",
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"path": "/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"owners": [
|
"owners": [
|
||||||
|
|||||||
@ -1953,6 +1953,25 @@
|
|||||||
"file": "nx-cloud/enterprise/dte/jenkins-dte"
|
"file": "nx-cloud/enterprise/dte/jenkins-dte"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Conformance",
|
||||||
|
"id": "conformance",
|
||||||
|
"description": "Conformance features that are available to Nx Cloud Enterprise customers",
|
||||||
|
"itemList": [
|
||||||
|
{
|
||||||
|
"name": "Configure Conformance Rules in Nx Cloud",
|
||||||
|
"id": "configure-conformance-rules-in-nx-cloud",
|
||||||
|
"tags": ["conformance"],
|
||||||
|
"file": "nx-cloud/enterprise/conformance/configure-conformance-rules-in-nx-cloud"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Publish Conformance Rules to Nx Cloud",
|
||||||
|
"id": "publish-conformance-rules-to-nx-cloud",
|
||||||
|
"tags": ["conformance"],
|
||||||
|
"file": "nx-cloud/enterprise/conformance/publish-conformance-rules-to-nx-cloud"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@ -0,0 +1,56 @@
|
|||||||
|
# Configure Conformance Rules in Nx Cloud
|
||||||
|
|
||||||
|
[Nx Cloud Enterprise](/enterprise) allows you to publish your organization's [Nx Conformance](/nx-enterprise/powerpack/conformance) rules to your Nx Cloud Organization, and consume them in any of your other Nx Workspaces without having to deal with the complexity and friction of dealing with a private NPM registry or similar. Authentication is handled automatically through your Nx Cloud connection and rules are downloaded and applied based on your preferences configured in the Nx Cloud UI.
|
||||||
|
|
||||||
|
To learn about how to create and publish custom rules to your Nx Cloud Organization, please refer to the [Publish Conformance Rules to Nx Cloud](/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud) recipe.
|
||||||
|
|
||||||
|
Once you have one or more rules published to your Nx Cloud Organization, you can configure your Nx Cloud Organization to use them in the Nx Cloud UI by visiting:
|
||||||
|
|
||||||
|
https://nx.app/go/organization/conformance-rules
|
||||||
|
|
||||||
|
## Choose the Scope of Configured Rules
|
||||||
|
|
||||||
|
The value in the dropdown will determine what workspace(s) the rules will be applied to. By default, "All Workspaces" is the selected value, but you can change this to focus on a specific workspace instead.
|
||||||
|
|
||||||
|
## Configure a Rule for the Chosen Workspace Scope
|
||||||
|
|
||||||
|
After choosing the target workspace(s), click on the "Configure rule" to open the rule configuration dialog.
|
||||||
|
|
||||||
|
Here you will choose which of the rules published to your Nx Cloud Organization should be applied to the chosen workspace(s), and configure any options that the chosen rule supports.
|
||||||
|
|
||||||
|
### Rule Options
|
||||||
|
|
||||||
|
{% callout title="Rule Options UI" %}
|
||||||
|
The rule options are currently provided via JSON, but in the near future we will dynamically generate a UI for configuring the options of each rule.
|
||||||
|
{% /callout %}
|
||||||
|
|
||||||
|
The rule options will be validated against the rule's JSON schema definition before being saved, and you will be notified of any validation errors.
|
||||||
|
|
||||||
|
### Rule Status
|
||||||
|
|
||||||
|
Here you will choose whether or not the rule should be:
|
||||||
|
|
||||||
|
- **Enabled**
|
||||||
|
- The rule will be executed in the chosen workspace(s) when `nx-cloud conformance`/`nx-cloud conformance:check` is run and any violations will cause the process to fail (exit with a non-zero exit code).
|
||||||
|
- **Evaluated**
|
||||||
|
- The rule will be executed in the chosen workspace(s) when `nx-cloud conformance`/`nx-cloud conformance:check` is run, but any violations will not cause the process to fail (i.e. the process will exit with a zero exit code).
|
||||||
|
- This status is useful for exposing violations to allow them to be addressed but without blocking the CI process in the meantime.
|
||||||
|
- You can combine this with the [Scheduled Status](#scheduled-status) feature to set a deadline for the chosen workspace(s) to become compliant with the rule.
|
||||||
|
- **Disabled**
|
||||||
|
- The rule will not be executed at all in the chosen workspace(s) and violations will therefore not be reported.
|
||||||
|
|
||||||
|
### Scheduled Status
|
||||||
|
|
||||||
|
By toggling on the "Schedule configuration", you can choose to set a future date on which the rule should be automatically transitioned to an alternate status.
|
||||||
|
|
||||||
|
Most commonly this would be used to transition a rule from **Evaluated** to **Enabled** after a grace period, to allow contributors to address the violations before enforcement begins, but any combination of current and scheduled statuses is supported.
|
||||||
|
|
||||||
|
## Notes on the Application of Rules at Runtime
|
||||||
|
|
||||||
|
When `nx-cloud conformance` or `nx-cloud conformance:check` are run, any configured rules for the current workspace will be dynamically downloaded from your Nx Cloud Organization and applied to the resolved conformance configuration. This means that the conformance configuration itself is completely optional when using it with Nx Cloud, but it can still be useful if the workspace wants to combine cloud rules with other locally-defined rules.
|
||||||
|
|
||||||
|
{% callout title="Organization Rules Override Local Rules" %}
|
||||||
|
By design, the workspace cannot choose to disable the rules configured in Nx Cloud - any conflict between local and cloud rules will result in the local configuration being overridden by the cloud configuration.
|
||||||
|
{% /callout %}
|
||||||
|
|
||||||
|
If the cloud rules were written to depend on a different version of Nx or Nx Powerpack than is installed within the current workspace, Nx Cloud will handle installing applicable versions dynamically at runtime.
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
# Publish Conformance Rules to Nx Cloud
|
||||||
|
|
||||||
|
[Nx Cloud Enterprise](/enterprise) allows you to publish your organization's [Nx Conformance](/nx-enterprise/powerpack/conformance) rules to your Nx Cloud Organization, and consume them in any of your other Nx Workspaces without having to deal with the complexity and friction of dealing with a private NPM registry or similar. Authentication is handled automatically through your Nx Cloud connection and rules are downloaded and applied based on your preferences configured in the Nx Cloud UI.
|
||||||
|
|
||||||
|
Let's create a custom rule which we can then publish to Nx Cloud. We will first create a new library project to contain our rule (and any others we might create in the future):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nx generate @nx/js:library cloud-conformance-rules
|
||||||
|
```
|
||||||
|
|
||||||
|
The Nx Cloud distribution mechanism expects each rule to be created in a named subdirectory in the `src/` directory of our new project, and each rule directory to contain an `index.ts` and a `schema.json` file.
|
||||||
|
|
||||||
|
E.g.
|
||||||
|
|
||||||
|
```
|
||||||
|
cloud-conformance-rules/
|
||||||
|
├── src/
|
||||||
|
│ ├── test-cloud-rule/
|
||||||
|
│ │ ├── index.ts // Our rule implementation
|
||||||
|
│ │ └── schema.json // The schema definition for the options supported by our rule
|
||||||
|
```
|
||||||
|
|
||||||
|
Our simple rule implementation in `test-cloud-rule/index.ts`, that will currently not report any violations, might look like this:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
import { createConformanceRule } from '@nx/powerpack-conformance';
|
||||||
|
|
||||||
|
export default createConformanceRule<object>({
|
||||||
|
name: 'test-cloud-rule',
|
||||||
|
category: 'reliability',
|
||||||
|
description: 'A test cloud rule',
|
||||||
|
reporter: 'non-project-files-reporter',
|
||||||
|
implementation: async () => {
|
||||||
|
return {
|
||||||
|
severity: 'low',
|
||||||
|
details: {
|
||||||
|
violations: [],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
And because we do not yet have any options that we want to support for our rule, our `schema.json` file will looks like this (using the [JSON Schema](https://json-schema.org/) format):
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We now have a valid implementation of a rule and we are ready to build it and publish it to Nx Cloud. The [`@nx/powerpack-conformance` plugin](/nx-api/powerpack-conformance) provides a [dedicated executor called `bundle-rules`](/nx-api/powerpack-conformance/executors/bundle-rules) for creating appropriate build artifacts for this purpose, so we will wire that executor up to a new build target in our `cloud-conformance-rules` project's `project.json` file:
|
||||||
|
|
||||||
|
```jsonc {% fileName="cloud-conformance-rules/project.json" %}
|
||||||
|
{
|
||||||
|
// ...any existing project.json content
|
||||||
|
"targets": {
|
||||||
|
// ...any existing targets
|
||||||
|
"build": {
|
||||||
|
"executor": "@nx/powerpack-conformance:bundle-rules",
|
||||||
|
"outputs": ["{options.outputPath}"],
|
||||||
|
"options": {
|
||||||
|
"outputPath": "{projectRoot}/dist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We can now run `nx build cloud-conformance-rules` to build our rule and create the build artifacts in the `cloud-conformance-rules/dist` directory (or wherever you prefer to configure that `outputPath` location). If we take a look at the output path location we will see the same structure of one named subdirectory per rule, now containing the (bundled) `index.js` and `schema.json` files.
|
||||||
|
|
||||||
|
Our final step is to publish the rule artifacts to Nx Cloud. We achieve this by running the `publish-conformance-rules` command on the `nx-cloud` CLI, passing the output path location as the first positional argument:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
nx-cloud publish-conformance-rules cloud-conformance-rules/dist
|
||||||
|
```
|
||||||
|
|
||||||
|
Subsequent calls to this command will overwrite the previously published rule artifacts for that rule, including implementation and schema changes. Effectively, the rules are always "at HEAD" and do not therefore have explicit versioning. If you need to support different versions of various setups, you should write the rule implementation to handle it at runtime. This approach helps reduce a lot of complexity and friction when managing Nx Conformance configurations across your organization.
|
||||||
|
|
||||||
|
Because publishing the rules is a relatively common operation, you can also wire up a target in your `cloud-conformance-rules` project to wrap the CLI command. Therefore, including our build target from before, our `project.json` file now looks like this:
|
||||||
|
|
||||||
|
```jsonc {% fileName="cloud-conformance-rules/project.json" %}
|
||||||
|
{
|
||||||
|
// ...any existing project.json content
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "@nx/powerpack-conformance:bundle-rules",
|
||||||
|
"outputs": ["{options.outputPath}"],
|
||||||
|
"options": {
|
||||||
|
"outputPath": "{projectRoot}/dist"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"publish": {
|
||||||
|
"dependsOn": ["build"],
|
||||||
|
"command": "npx nx-cloud publish-conformance-rules {projectRoot}/dist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
We can now run `nx publish cloud-conformance-rules` to both build and publish our rule (and any future rules in this project) to Nx Cloud.
|
||||||
@ -314,6 +314,9 @@
|
|||||||
- [Bitbucket Pipelines Custom DTE](/ci/recipes/enterprise/dte/bitbucket-dte)
|
- [Bitbucket Pipelines Custom DTE](/ci/recipes/enterprise/dte/bitbucket-dte)
|
||||||
- [GitLab Custom DTE](/ci/recipes/enterprise/dte/gitlab-dte)
|
- [GitLab Custom DTE](/ci/recipes/enterprise/dte/gitlab-dte)
|
||||||
- [Jenkins Custom DTE](/ci/recipes/enterprise/dte/jenkins-dte)
|
- [Jenkins Custom DTE](/ci/recipes/enterprise/dte/jenkins-dte)
|
||||||
|
- [Conformance](/ci/recipes/enterprise/conformance)
|
||||||
|
- [Configure Conformance Rules in Nx Cloud](/ci/recipes/enterprise/conformance/configure-conformance-rules-in-nx-cloud)
|
||||||
|
- [Publish Conformance Rules to Nx Cloud](/ci/recipes/enterprise/conformance/publish-conformance-rules-to-nx-cloud)
|
||||||
- [Other](/ci/recipes/other)
|
- [Other](/ci/recipes/other)
|
||||||
- [Record Non-Nx Commands](/ci/recipes/other/record-commands)
|
- [Record Non-Nx Commands](/ci/recipes/other/record-commands)
|
||||||
- [Prepare applications for deployment via CI](/ci/recipes/other/ci-deployment)
|
- [Prepare applications for deployment via CI](/ci/recipes/other/ci-deployment)
|
||||||
@ -785,7 +788,7 @@
|
|||||||
- [documents](/nx-api/powerpack-conformance/documents)
|
- [documents](/nx-api/powerpack-conformance/documents)
|
||||||
- [Overview](/nx-api/powerpack-conformance/documents/overview)
|
- [Overview](/nx-api/powerpack-conformance/documents/overview)
|
||||||
- [executors](/nx-api/powerpack-conformance/executors)
|
- [executors](/nx-api/powerpack-conformance/executors)
|
||||||
- [bundle-rule](/nx-api/powerpack-conformance/executors/bundle-rule)
|
- [bundle-rules](/nx-api/powerpack-conformance/executors/bundle-rules)
|
||||||
- [powerpack-enterprise-cloud](/nx-api/powerpack-enterprise-cloud)
|
- [powerpack-enterprise-cloud](/nx-api/powerpack-enterprise-cloud)
|
||||||
- [generators](/nx-api/powerpack-enterprise-cloud/generators)
|
- [generators](/nx-api/powerpack-enterprise-cloud/generators)
|
||||||
- [init](/nx-api/powerpack-enterprise-cloud/generators/init)
|
- [init](/nx-api/powerpack-enterprise-cloud/generators/init)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user