-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
174 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,6 @@ jobs: | |
pull-requests: write | ||
steps: | ||
- name: size-label | ||
uses: "pascalgn/[email protected].4" | ||
uses: "pascalgn/[email protected].5" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"groups": [ | ||
{ | ||
"name": "example", | ||
"interval": "2m", | ||
"rules": [ | ||
{ | ||
"record": "job:http_inprogress_requests:sum", | ||
"expr": "sum by (job) (http_inprogress_requests)" | ||
}, | ||
{ | ||
"alert": "alert name", | ||
"expr": "sum by (job) (http_inprogress_requests)" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"location": { | ||
"type": "string", | ||
"defaultValue": "[resourceGroup().location]" | ||
}, | ||
"clusterName": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Cluster name" | ||
} | ||
}, | ||
"actionGroupId": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Action Group ResourceId" | ||
} | ||
}, | ||
"azureMonitorWorkspace": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "ResourceId of Azure monitor workspace to associate to" | ||
} | ||
} | ||
}, | ||
"variables": {}, | ||
"resources": [ | ||
{ | ||
"name": "example", | ||
"type": "Microsoft.AlertsManagement/prometheusRuleGroups", | ||
"apiVersion": "2023-03-01", | ||
"location": "[parameters('location')]", | ||
"properties": { | ||
"interval": "PT2M", | ||
"scopes": ["[parameters('azureMonitorWorkspace')]"], | ||
"clusterName": "[parameters('clusterName')]", | ||
"rules": [ | ||
{ | ||
"record": "job:http_inprogress_requests:sum", | ||
"expression": "sum by (job) (http_inprogress_requests)" | ||
}, | ||
{ | ||
"severity": 3, | ||
"resolveConfiguration": { | ||
"autoResolved": true, | ||
"timeToResolve": "PT10M" | ||
}, | ||
"actions": [ | ||
{ | ||
"actionGroupId": "[parameters('actionGroupId')]" | ||
} | ||
], | ||
"alert": "alert name", | ||
"expression": "sum by (job) (http_inprogress_requests)" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import yamlToArmTemplateFlow from './index'; | ||
import StepResult from './types/step-result'; | ||
import fs from "fs/promises"; | ||
|
||
describe('toArmTemplateFlow example 1', () => { | ||
let expectedResult: any; | ||
|
||
beforeAll(async () => { | ||
expectedResult = JSON.parse( | ||
await fs.readFile("./examples/result1.json", { encoding: "utf-8" }) | ||
); | ||
}); | ||
|
||
test('Successful flow with valid YAML input', async () => { | ||
await readFileAndRunFlow("./examples/yaml-example1.yml"); | ||
|
||
}); | ||
|
||
test("Successful flow with valid JSON input", async () => { | ||
await readFileAndRunFlow("./examples/json-example1.json"); | ||
}); | ||
|
||
async function readFileAndRunFlow(examplePath : string) { | ||
const options = {}; | ||
const str = (await fs.readFile(examplePath))?.toString(); | ||
const result: StepResult = yamlToArmTemplateFlow(str, options); | ||
|
||
expect(result.success).toBe(true); | ||
expect(result.output).toEqual(expectedResult); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters