Skip to content

Commit

Permalink
fix: Adding owner schema property and tag for azure resources
Browse files Browse the repository at this point in the history
  • Loading branch information
whilke authored Feb 12, 2020
1 parent c4ba46b commit 4ab5dc8
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 18 deletions.
2 changes: 2 additions & 0 deletions Schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Note: Not all features are supported, such as functions.
name: string
shortName: string
version: string
owner: string
ingredients: [ ingredientTag ]
resourceGroup: bool
rgOverride: string | expression
Expand All @@ -38,6 +39,7 @@ recipe: {string: ingredient block}
|name|yes|Descriptive name for recipe|
|shortName|yes|code use for resource naming [a-z][A-Z][0-9], 8 chars max|
|version|yes|version should match the docker tag|
|owner|no|Owner of package as either a team name, email, person, etc.|
|ingredients|yes|List of bake ingredients to use in the recipe|
|resourceGroup|no (default true)|Create a resource group for the recipe deployment |
|rgOverride|no (default blank)|Name of the resource group to create, if set. Otherwise standard format will be used|
Expand Down
1 change: 1 addition & 0 deletions core/src/bake-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface IBakeConfig {
name: string,
shortName: string,
version: string,
owner?: string,
ingredients?: Array<string>,
resourceGroup: boolean,
rgOverride?: BakeVariable,
Expand Down
1 change: 1 addition & 0 deletions core/src/tag-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class TagGenerator {
tags.recipe = this._ctx.Config.name
tags.package_version = this._ctx.Config.version
tags.bake_version = this._ctx.Environment.toolVersion
tags.owner = this._ctx.Config.owner || ""

//check against pluginVersion be seting, since Ingredient is always set as a default object
if (this._ctx.Ingredient.pluginVersion){
Expand Down
2 changes: 1 addition & 1 deletion ingredient/ingredient-api-managment-base/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-apim/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-databricks/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-datafactoryv2/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-sql-dwh/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-sqldb/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ingredient/ingredient-sqlserver-logical/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.98",
"version": "independent",
"npmClient": "npm",
"command": {
"publish": {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Azure cloud deployment platform for both infrasturcture as code and software",
"author": "HCHB",
"license": "MIT",
"version": "0.1.95",
"version": "0.5.0",
"repository": {
"type": "git",
"url": "git+https://github.com/HomecareHomebase/azure-bake.git"
Expand Down
2 changes: 1 addition & 1 deletion system/package/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
ingredients:
- "@azbake/ingredient-key-vault@0.0.1"
resourceGroup: true
rgOverride: "test-rg"
rgOverride: "whilke-poc"
parallelRegions: false
recipe:
keyvault:
Expand Down
22 changes: 18 additions & 4 deletions system/src/bake-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,30 @@ export class BakeRunner {
}
catch{}

let tagGenerator = new TagGenerator(ctx)
if (!rgExists){

let tagGenerator = new TagGenerator(ctx)


ctx.Logger.log('Setting up resource group ' + cyan(rg_name))

await client.resourceGroups.createOrUpdate(rg_name, <ResourceGroup>{
tags: tagGenerator.GenerateTags(),
tags: tagGenerator.GenerateTags(),
location: region_name
})
}
else {

ctx.Logger.log('Updating resource group ' + cyan(rg_name))

//for updates we still want to createOrUpdate so that tags can sync
//but we need to use the RG location in case it's different in later runs.
const rg = await client.resourceGroups.get(rg_name);
await client.resourceGroups.createOrUpdate(rg_name, <ResourceGroup>{
tags: tagGenerator.GenerateTags(),
location: rg.location
});
}


}

let recipe = ctx.Config.recipe
Expand Down

0 comments on commit 4ab5dc8

Please sign in to comment.