Skip to content

Commit

Permalink
Modular mappers (#94)
Browse files Browse the repository at this point in the history
* Adding the version to the Action title.

* Got the v2 schema module ready to go, and it's working!

* Major update to modularize the version mappers!
- Each schema version now has a separate module and a separate test
- There are now different workflow-based tests per schema version
- Got to remove a bunch of code which was more complex than needed
- We're ready to support additional schema versions now

* Cleaning up print statements in test.

* Getting ready for a future release.
  • Loading branch information
manchicken committed Apr 5, 2024
1 parent 1e422f5 commit e1936e7
Show file tree
Hide file tree
Showing 32 changed files with 1,790 additions and 1,481 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/v2-automated-testing.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: DataDog Service Catalog
name: DataDog Service Catalog v2
on:
push:
workflow_dispatch:
Expand Down Expand Up @@ -57,19 +57,16 @@ jobs:
links: |
- url: https://github.com/actions/toolkit
type: repo
provider: Github
name: '@actions/toolkit'
- name: AMI Version Status Dashboard
url: https://thisisanentirelyfakeurl.seriouslythisisafakehostname.com/dashboard
type: dashboard
- name: GitHub Actions!
url: https://github.com/features/actions
provider: Github Docs
type: doc
- name: Some Runbook
url: https://thisisanentirelyfakeurl.seriouslythisisafakehostname.com/runbook
type: runbook
provider: Confluence
docs: |
- name: Some Docs
url: https://thisisanentirelyfakeurl.seriouslythisisafakehostname.com/docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/v2.1-automated-testing.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: DataDog Service Catalog
name: DataDog Service Catalog v2.1
on:
push:
workflow_dispatch:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/v2.2-automated-testing.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: DataDog Service Catalog
name: DataDog Service Catalog v2.2
on:
push:
workflow_dispatch:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
- language:nodejs
- updated:${{ steps.date.outputs.date }}
- internet_accessible: false
- schema-version: 2.2
- schema-version: v2.2
links: |
- url: https://github.com/actions/toolkit
type: repo
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ 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].

## [3.0.0] - unreleased

> [!WARNING]
> This version may include breaking changes!
> There have been efforts made to not break backwards compatibility for either the org rules file
> or the schema versions. That said, it is impossible to know how you have structured your files,
> so please exercise caution when upgrading to the `v3` tag.
### Added

- Better tests for the various schema versions

### Changed

- Moved all of the field mapping from a common module for all versions, to version-specific modules
- This will make it easier to add new schema version support without risking breakage to existing versions
- This makes it much easier to test convenience functionality independently from the schema fields
- So... many... tests...

## [2.3.0] - 2024-02-07

### Added
Expand Down
18 changes: 18 additions & 0 deletions __tests__/lib/__snapshots__/convenienceMappings.test.cjs.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`lib/convenienceMappings.cjs #getConvenienceFieldValues() - full set 1`] = `
{
"email": "team-name-here@fakeemaildomainthatdoesntexist.com",
"repo": "https://github.com/arcxp/datadog-service-catalog-metadata-provider",
"slack": "https://fakeorg.slack.com/archives/A0000000000",
"slack-support-channel": "https://fakeorg.slack.com/archives/A0000000001",
}
`;

exports[`lib/convenienceMappings.cjs #getConvenienceFieldValues() - partial set 1`] = `
{
"repo": "https://github.com/arcxp/datadog-service-catalog-metadata-provider",
"slack": "https://fakeorg.slack.com/archives/A0000000000",
"slack-support-channel": "https://fakeorg.slack.com/archives/A0000000001",
}
`;
124 changes: 0 additions & 124 deletions __tests__/lib/__snapshots__/fieldMappings-schema.test.cjs.snap

This file was deleted.

124 changes: 0 additions & 124 deletions __tests__/lib/__snapshots__/fieldMappings.test.cjs.snap

This file was deleted.

Loading

0 comments on commit e1936e7

Please sign in to comment.