Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…tarts into mickey/NR-305852-quickstart-ids
  • Loading branch information
Mickey Ryan committed Sep 12, 2024
2 parents 5683e90 + f3f13a9 commit 1514d4a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
13 changes: 10 additions & 3 deletions .github/actions/build-validate-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
name: Build and Validate Artifact
description: Reusable action to build and validate the component artifact
inputs:
command-args:
description: 'Additional arguments to pass to build-validate-quickstart-artifact'
output-artifact:
description: 'If provided, the action will output the artifact to the build directory'
required: false

runs:
using: composite
steps:
- name: Add data source ids to schema
shell: bash
run: |
cd utils && yarn add-datasource-ids
- name: Build & Validate Artifact
shell: bash
id: build-validate-artifact
run: |
cd utils && yarn build-validate-quickstart-artifact ${{ inputs.command-args }}
cd utils && yarn build-validate-quickstart-artifact ${{ inputs.output-artifact && '--output-artifact' || '' }}
- name: Debugging output
shell: bash
if: ${{ runner.debug }}
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/release-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@

name: Release artifact
on:
workflow_call:
push:
branches:
#- main
- feature/validation-workflow
- andrew/NR-268466-main-validation
- main
tags:
- 'v*'

Expand All @@ -32,7 +29,7 @@ jobs:
- name: Validate and generate artifact
uses: "./.github/actions/build-validate-artifact"
with:
command-args: '--output-artifact'
output-artifact: 'true'
- name: Attest artifact
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c
with:
Expand Down
1 change: 1 addition & 0 deletions utils/build-validate-quickstart-artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ const outputArtifact = (artifact: Artifact) => {
fs.copyFileSync('./schema/artifact.json', './build/schema.json');
} catch (e) {
console.error('Error writing artifact to file:', e);
process.exit(1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions utils/schema/add-datasource-ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const CORE_DATASOURCE_IDS_PATH = './core-datasource-ids.json';
const DATASOURCE_BASE_PATH = '../../';

type ArtifactSchema = {
properties: {
definitions: {
dataSourceIds: {
enum: string[];
};
Expand Down Expand Up @@ -50,8 +50,8 @@ const updateSchema = (
): ArtifactSchema => {
return {
...schema,
properties: {
...schema.properties,
definitions: {
...schema.definitions,
dataSourceIds: { enum: ids },
},
};
Expand Down
18 changes: 12 additions & 6 deletions utils/schema/artifact.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"items": { "$ref": "#/definitions/dashboard" }
},
"dataSourceIds": {
"type": "array", "items": { "type": "string" }
"type": "array",
"items": { "$ref": "#/definitions/dataSourceIds" }
}
},
"required": [
Expand All @@ -41,7 +42,8 @@
"summary": { "type": "string" },
"title": { "type": "string" },
"authors": {
"type": "array", "items": { "type": "string" }
"type": "array",
"items": { "type": "string" }
},
"documentation": {
"type": "array",
Expand All @@ -59,17 +61,21 @@
"level": { "enum": ["New Relic", "Community", "Verified"] },
"icon": { "type": "string" },
"keywords": {
"type": "array", "items": { "type": "string" }
"type": "array",
"items": { "type": "string" }
},
"slug": { "type": "string" },
"alertPolicies": {
"type": "array", "items": { "type": "string" }
"type": "array",
"items": { "type": "string" }
},
"dashboards": {
"type": "array", "items": { "type": "string" }
"type": "array",
"items": { "type": "string" }
},
"dataSourceIds": {
"type": "array", "items": { "type": "string" }
"type": "array",
"items": { "$ref": "#/definitions/dataSourceIds" }
}
},
"required": [
Expand Down

0 comments on commit 1514d4a

Please sign in to comment.