Skip to content

Commit

Permalink
Support v2.2 (#76)
Browse files Browse the repository at this point in the history
* Updated dependencies.

* Initial support commit for v2.2.
- Added the fields
- Fixed broken tests
- The `uuid` dependency was added because `@actions/core` requires it now

* Finished updating the field versions, tests pass now.

* Adding a bit of debug code.

* building, and adding debug.

* Adding org rules file support for `type` and `language`.

* Updating snapshots.

* Adding some minor tests, and updating docs.
- Also added `ci-pipeline-fingerprints` support in `action.yml`
- Prepping to release.
  • Loading branch information
manchicken authored Dec 21, 2023
1 parent 657aac0 commit 32b95db
Show file tree
Hide file tree
Showing 17 changed files with 974 additions and 484 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/automated-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Datadog Service Catalog Metadata Provider Manual Test
uses: ./
with:
schema-version: v2.1
schema-version: v2.2
github-token: ${{ secrets.GITHUB_TOKEN }}
datadog-hostname: api.us5.datadoghq.com
datadog-key: ${{ secrets.DATADOG_API_KEY }}
Expand All @@ -38,6 +38,11 @@ jobs:
description: This is a test of the Datadog Service Catalog Metadata Provider
lifecycle: production
tier: p3
type: function
languages: |
- javascript
- hopes
- dreams
team: Team Name Here
email: team-name-here@fakeemaildomainthatdoesntexist.com
slack-support-channel: 'https://fakeorg.slack.com/archives/A0000000000'
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog],
and this project adheres to [Semantic Versioning].

## [2.2.0] - unreleased

### Added

- Added support for schema version v2.2
- Added the `uuid` dependency since `@actions/core` insists
- Added some more edge case tests

### Changed

- Updated dependencies

## [2.1.0] - 2023-10-20

### Added
Expand Down
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ At this time, this GitHub Action supports the following versions of the Service

- `v2`
- `v2.1`
- `v2.2`

## Wait, but why?

Expand Down Expand Up @@ -69,35 +70,38 @@ Using a field which is not supported in the schema version you've selected will

| Field | Description | Required | Default | Schema Versions |
| --- | --- | --- | --- | --- |
| `service-name` | The name of the service. This must be unique across all services. | Yes | | `v2`, `v2.1` |
| `team` | The team that owns the service. | Yes | | `v2`, `v2.1` |
| `description` | A description of the service. | No | | `v2.1` |
| `application` | The application that the service belongs to. | No | | `v2.1` |
| `tier` | The importance tier of the service. This is an unconstrained text field where you can use your own tiering definitions. Examples would be `High`, `Critical`, or however you or your organization classify criticality tiers. | No | | `v2.1` |
| `lifecycle` | This is the lifecycle of the service. This text field is unconstrained, and some examples are `production`, `development`, `staging`. | No | | `v2.1` |
| `contacts` | The list of contacts for the service. Each of these contacts is an object. Keep in mind that `email` and `slack-support-channel` are already included as contacts. This list should be in addition to that. These values are supplied as objects, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. | No | `[]` | `v2`, `v2.1` |
| `contacts[].name` | The name of the contact. | Yes | | `v2`, `v2.1` |
| `contacts[].type` | The type of the contact. Acceptable values are: `email`, `slack`, and `microsoft-teams` | Yes | | `v2`, `v2.1` |
| `contacts[].contact` | The actual contact information for the contact. For example, if the type is `email`, this would be the email address. | Yes | | `v2`, `v2.1` |
| `service-name` | The name of the service. This must be unique across all services. | Yes | | `v2`, `v2.1`, `v2.2` |
| `team` | The team that owns the service. | Yes | | `v2`, `v2.1`, `v2.2` |
| `description` | A description of the service. | No | | `v2.1`, `v2.2` |
| `application` | The application that the service belongs to. | No | | `v2.1`, `v2.2` |
| `type` | The type of resource that this service constitutes. Values are constrained to one of "web", "db", "cache", "function", "browser", "mobile", or "custom". | No | | `v2.2` |
| `languages` | This is a list of the languages used in this service. This is an array, so you may supply multiple values. | No | `[]` | `v2.2` |
| `tier` | The importance tier of the service. This is an unconstrained text field where you can use your own tiering definitions. Examples would be `High`, `Critical`, or however you or your organization classify criticality tiers. | No | | `v2.1`, `v2.2` |
| `lifecycle` | This is the lifecycle of the service. This text field is unconstrained, and some examples are `production`, `development`, `staging`. | No | | `v2.1`, `v2.2` |
| `contacts` | The list of contacts for the service. Each of these contacts is an object. Keep in mind that `email` and `slack-support-channel` are already included as contacts. This list should be in addition to that. These values are supplied as objects, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. | No | `[]` | `v2`, `v2.1`, `v2.2` |
| `contacts[].name` | The name of the contact. | Yes | | `v2`, `v2.1`, `v2.2` |
| `contacts[].type` | The type of the contact. Acceptable values are: `email`, `slack`, and `microsoft-teams` | Yes | | `v2`, `v2.1`, `v2.2` |
| `contacts[].contact` | The actual contact information for the contact. For example, if the type is `email`, this would be the email address. | Yes | | `v2`, `v2.1`, `v2.2` |
| `repos` | The list of GitHub repositories that are part of the service. You must supply at least one repository. The repositories are supplied as objects, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. In `v2.1`, this field is moved under `links`. | Yes | `[]` | `v2` |
| `repos[].name` | The name of the repository. | Yes | | `v2` |
| `repos[].url` | The URL of the repository. | Yes | | `v2` |
| `repos[].provider` | The provider of the repository. Acceptable values are: `Github`. | No | | `v2` |
| `tags` | The list of tags that are associated with the service. This should be a list of key-value pairs separated by colons. | No | |
| `links` | A list of links associated with the service. These links are objects with a variety of properties, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. | No | `[]` | `v2`, `v2.1` |
| `links[].name` | The name of the link. | Yes | | `v2`, `v2.1` |
| `links[].url` | The URL of the link. | Yes | | `v2`, `v2.1` |
| `links[].type` | The type for the link. Acceptable values for the `v2` API are: `doc`, `wiki`, `runbook`, `url`, `repo`, `dashboard`, `oncall`, `code`, and `link`. Acceptable values for the `v2.1` API are: `doc`, `runbook`, `repo`, `dashboard`, and `other`. | Yes | | `v2`, `v2.1` |
| `links` | A list of links associated with the service. These links are objects with a variety of properties, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. | No | `[]` | `v2`, `v2.1`, `v2.2` |
| `links[].name` | The name of the link. | Yes | | `v2`, `v2.1`, `v2.2` |
| `links[].url` | The URL of the link. | Yes | | `v2`, `v2.1`, `v2.2` |
| `links[].type` | The type for the link. Acceptable values for the `v2` API are: `doc`, `wiki`, `runbook`, `url`, `repo`, `dashboard`, `oncall`, `code`, and `link`. Acceptable values for the `v2.1` API are: `doc`, `runbook`, `repo`, `dashboard`, and `other`. | Yes | | `v2`, `v2.1`, `v2.2` |
| `docs` | A list of documentation links associated with the service. These links are objects with a variety of properties, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. In `v2.1`, this field moved under `links`. | No | `[]` | `v2` |
| `docs[].name` | The name of the document. | Yes | | `v2` |
| `docs[].url` | The URL of the document. | Yes | | `v2` |
| `docs[].provider` | The provider for where the documentation lives. Acceptable values are: `Confluence`, `GoogleDocs`, `Github`, `Jira`, `OneNote`, `SharePoint`, and `Dropbox` | No | | `v2` |
| `integrations` | Integrations associated with the service. These integrations are objects with a variety of properties, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. | No | `{}` | `v2`, `v2.1` |
| `integrations.opsgenie` | The OpsGenie details for the service. | No | | `v2`, `v2.1` |
| `integrations.opsgenie.service-url` | The service URL for the OpsGenie integration. A team URL will work, but if you want on-call metadata then make sure that this URL is to a service, not a team. | Yes | | `v2`, `v2.1` |
| `integrations.opsgenie.region` | The region for the OpsGenie integration. Acceptable values are `US` and `EU`. | No | | `v2`, `v2.1` |
| `integrations.pagerduty` | The PagerDuty URL for the service. **Important:** In `v2`, this field is just a URL. In `v2.1` this field is a dictionary with a `service-url` property. | No | | `v2`, `v2.1` |
| `integrations.pagerduty.service-url` | The PagerDuty URL for the service. | Yes | | `v2.1` |
| `integrations` | Integrations associated with the service. These integrations are objects with a variety of properties, but due to the limitations of GitHub Actions, please supply these object properties as a multi-line string. | No | `{}` | `v2`, `v2.1`, `v2.2` |
| `integrations.opsgenie` | The OpsGenie details for the service. | No | | `v2`, `v2.1`, `v2.2` |
| `integrations.opsgenie.service-url` | The service URL for the OpsGenie integration. A team URL will work, but if you want on-call metadata then make sure that this URL is to a service, not a team. | Yes | | `v2`, `v2.1`, `v2.2` |
| `integrations.opsgenie.region` | The region for the OpsGenie integration. Acceptable values are `US` and `EU`. | No | | `v2`, `v2.1`, `v2.2` |
| `integrations.pagerduty` | The PagerDuty URL for the service. **Important:** In `v2`, this field is just a URL. In `v2.1` this field is a dictionary with a `service-url` property. | No | | `v2`, `v2.1`, `v2.2` |
| `integrations.pagerduty.service-url` | The PagerDuty URL for the service. | Yes | | `v2.1`, `v2.2` |
| `ci-pipeline-fingerprints` | A set of CI pipeline fingerprints related to the service. | No | `[]` | `v2.2` |

### Convenience Fields

Expand Down
218 changes: 218 additions & 0 deletions __tests__/data/datadog-service-catalog-schema-v2.2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/DataDog/schema/tree/main/service-catalog/v2.2/schema.json",
"title": "Service Definition Schema v2.2",
"description": "A service definition for providing additional service metadata and integrations v2.2",
"type": "object",
"properties": {
"schema-version": {
"description": "Schema version being used",
"examples": ["v2.2"],
"type": "string",
"default": "v2.2",
"enum": ["v2.2"]
},
"dd-service": {
"description": "Unique identifier of the service. Must be unique across all services, and is used to match with a service in Datadog",
"examples": ["my-service"],
"type": "string"
},
"team": {
"description": "Team that owns the service. It is used to locate a team defined in Datadog Teams if it exists",
"examples": ["my-team"],
"type": "string"
},
"application": {
"description": "Identifier for a group of related services serving a product feature, which the service is a part of",
"examples": ["my-app"],
"type": "string"
},
"description": {
"description": "A short description of the service",
"examples": ["My app description"],
"type": "string"
},
"tier": {
"description": "Importance of the service",
"examples": ["1", "High"],
"type": "string"
},
"lifecycle": {
"description": "The current life cycle phase of the service.",
"examples": ["sandbox", "staging", "production", "deprecated"],
"type": "string"
},
"type": {
"description": "The type of service",
"examples": [
"web",
"db",
"cache",
"function",
"browser",
"mobile",
"custom"
],
"type": "string",
"enum": ["web", "db", "cache", "function", "browser", "mobile", "custom"]
},
"languages": {
"description": "The service's programming language. See examples for a list of recognizable languages",
"examples": [
["dotnet", "go", "java", "js", "php", "python", "ruby", "c++"]
],
"type": "array",
"items": {
"type": "string"
}
},
"contacts": {
"description": "A list of contacts related to the services. ",
"type": "array",
"items": {
"$ref": "#/$defs/contact"
}
},
"links": {
"description": "A list of links related to the services. ",
"type": "array",
"items": {
"$ref": "#/$defs/link"
}
},
"tags": {
"description": "A set of custom tags",
"examples": [["my:tag"]],
"type": "array",
"items": {
"type": "string"
}
},
"integrations": {
"description": "Third party integrations that Datadog supports",
"type": "object",
"properties": {
"pagerduty": {
"description": "Pagerduty integration for the service",
"type": "object",
"properties": {
"service-url": {
"description": "Pagerduty Service URL",
"examples": [
"https://my-org.pagerduty.com/service-directory/PMyService"
],
"type": "string",
"pattern": "^(https?://)?[a-zA-Z\\d_\\-.]+\\.pagerduty\\.com/service-directory/(P[a-zA-Z\\d_\\-]+)/?$"
}
},
"required": ["service-url"],
"additionalProperties": false
},
"opsgenie": {
"description": "Opsgenie integration for the service",
"type": "object",
"properties": {
"service-url": {
"description": "Opsgenie Service URL",
"examples": [
"https://www.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000"
],
"type": "string",
"pattern": "^(https?://)?[a-zA-Z\\d_\\-.]+\\.opsgenie\\.com/service/([a-zA-Z\\d_\\-]+)/?$"
},
"region": {
"description": "Opsgenie Instance Region",
"type": "string",
"examples": ["US", "EU"],
"enum": ["US", "EU"]
}
},
"required": ["service-url"],
"additionalProperties": false
}
},
"additionalProperties": false
},
"extensions": {
"description": "Custom extensions",
"type": "object",
"additionalProperties": true
},
"ci-pipeline-fingerprints": {
"description": "A set of CI pipeline fingerprints related to the service",
"examples": [["j88xdEy0J5lc", "eZ7LMljCk8vo"]],
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": ["schema-version", "dd-service"],
"$defs": {
"link": {
"additionalProperties": false,
"type": "object",
"properties": {
"name": {
"description": "Link name",
"examples": ["Runbook", "Dashboard"],
"type": "string"
},
"type": {
"description": "Link type. See examples for a list of recognizable types",
"examples": ["runbook", "doc", "repo", "dashboard", "other"],
"type": "string",
"default": "other"
},
"url": {
"description": "Link url",
"examples": ["https://my-runbook"],
"type": "string",
"format": "uri"
},
"provider": {
"description": "Link provider. See examples for a list of recognizable providers",
"examples": ["Github", "Confluence"],
"type": "string"
}
},
"required": ["name", "type", "url"]
},
"contact": {
"additionalProperties": false,
"type": "object",
"properties": {
"name": {
"description": "Contact name",
"examples": ["Oncall Slack", "Team Email"],
"type": "string",
"minLength": 2
},
"type": {
"description": "Contact type. See examples for a list of recognizable types",
"examples": ["email", "slack", "microsoft-teams"],
"type": "string"
},
"contact": {
"description": "Contact value",
"examples": [
"contact@datadoghq.com",
"https://my-org.slack.com/archives/my-channel"
],
"type": "string"
}
},
"if": {
"properties": { "type": { "const": "email" } }
},
"then": {
"properties": { "contact": { "format": "email" } }
},
"else": {
"properties": { "contact": { "format": "uri" } }
},
"required": ["type", "contact"]
}
}
}
Loading

0 comments on commit 32b95db

Please sign in to comment.