Commands
Documentation for all the commands in the DevGrid CLI
Below are the different commands supported in the DevGrid CLI.
Version
$ ./devgrid-cli version
This will return the current version of the DevGrid CLI. This is a helpful command to ensure the CLI is appropriately installed and up to date.
Help
$ ./devgrid-cli help
Returns a list of commands and short descriptions.
Init
$ ./devgrid-cli init --name [project name]
Initializes a devgrid.yml for the project. Note: This will overwrite any devgrid.yml that already exists.
Lint
$ ./devgrid-cli lint
Will validate and lint the devgrid.yml in the current project/repo.
The JSON schema that is used to validate the file:
{
"$id": "root",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"project": {
"type": "object",
"properties": {
"appID": {
"type": "string",
"default": "abc123",
"examples": [
"abc123"
]
},
"components": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "component",
"examples": [
"component"
]
},
"name": {
"type": "string",
"default": "my-cool-api",
"examples": [
"my-cool-api"
]
},
"shortId": {
"type": "string",
"default": "ab123",
"examples": [
"ab123"
]
},
"attributes": {
"type": "object",
"properties": {},
"additionalProperties": true
},
"api": {
"type": "string",
"default": "swagger.yml",
"examples": [
"swagger.yml"
]
},
"manifest": {
"type": "string",
"default": "package.json",
"examples": [
"package.json"
]
},
"relationships": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "component_has_dependency",
"examples": [
"component_has_dependency"
]
},
"to": {
"type": "string",
"default": "qwe312",
"examples": [
"qwe312"
]
},
"attributes": {
"type": "object",
"properties": {},
"additionalProperties": true
}
},
"required": [
"type",
"to"
],
"additionalProperties": false
}
}
},
"required": [
"type",
"name",
"shortId",
"attributes",
"api",
"manifest"
],
"additionalProperties": false
}
}
},
"required": [
"appID",
"components"
],
"additionalProperties": false
}
},
"required": [
"project"
],
"additionalProperties": false
}Sync
$ ./devgrid-cli sync
Syncs the current local project with the DevGrid API. Very useful for CICD integrations and other automation.
Note: requires DEVGRID_API_KEY env variable to be set.
Event
$ ./devgrid-cli event --type [<event_type>] --entityShortId [<string>] --attributes [<json>]
Sends an event to the DevGrid system. See here for more details on the Events API
Event Types & Attributes
Build
{
"type": "event-build",
"entityShortId": "DevGrid Entity ID to map to the event.",
"attributes": {
"build_url": "URL to the specific pipeline/build job",
"build_id": "ID of the build instance instance in CICD platform",
"build_commit_sha": "Git SHA of the build is run against",
"success": "true|false",
}
}
Deploy
{
"type": "event-deploy",
"entityShortId": "DevGrid Entity ID to map to the event.",
"attributes": {
"build_url": "URL to the specific pipeline/build job",
"build_id": "ID of the build instance instance in CICD platform",
"build_commit_sha": "Git SHA of the build is run against",
"env": "dev|prod|etc",
"description":"Text to describe the deploy.",
"initiator": "Text to describe the person doing the deployment.",
"status":"failed|success",
"change_id":"ID in the Change Management System of Record",
"change_url","url to the change ticket",
"change_title":"TEXT",
"change_author":"TEXT",
"change_approver":"TEXT",
"change_window_start":"DATETIME",
"change_window_end":"DATETIME",
"deployment_start_time":"DATETIME"
}
}Error
Used to denote a runtime error with your component. Note: Should not be used to show a build error; for that use the Build Event with success:false.
{
"type": "event-error",
"entityShortId": "DevGrid Entity ID to map to the event.",
"attributes": {
"level": "warn|error|critical"
}
}
Test Coverage Event
{
"type": "test-run-event",
"entityShortId": "DevGrid Entity ID to map to the event.",
"entityType": "component|application",
"attributes": {
"test_type": "unit|integration|e2e",
"coverage": 74.13,
"success": true,
}
}
Task
$devgrid-cli task --type [<task_type>] --data [<json>]
Sends a task to the DevGrid system. See tasks for more details on the Tasks API
Updated 9 days ago
