This repository has been archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
b81e520
commit 8553e6d
Showing
7 changed files
with
1,391 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
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,44 @@ | ||
{ | ||
"name": "brigade-utils", | ||
"version": "0.0.1", | ||
"description": "Various utility classes and functions to use in brigade.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"compile": "tsc -p ./", | ||
"watch": "tsc -watch -p ./", | ||
"test": "mocha --compilers ts:ts-node/register --recursive ./test/**/*.ts" | ||
}, | ||
"files": [ | ||
"out/*.js", | ||
"out/*.ts" | ||
], | ||
"devDependencies": { | ||
"@types/chai": "^4.0.1", | ||
"@types/mocha": "^2.2.41", | ||
"@types/node": "^10.3.0", | ||
"chai": "^4.1.0", | ||
"mocha": "^3.4.2", | ||
"prettier": "^1.9.1", | ||
"rimraf": "^2.6.2", | ||
"ts-node": "^7.0.0", | ||
"typedoc": "^0.11.0", | ||
"typescript": "^3.0.1" | ||
}, | ||
"dependencies": { | ||
"@azure/brigadier": "^0.2.1", | ||
"@kubernetes/client-node": "^0.7.2", | ||
"child-process-promise": "^2.2.1", | ||
"pretty-error": "^2.1.1", | ||
"ulid": "^0.2.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/radu-matei/brigade-utils.git" | ||
}, | ||
"author": "Radu M <root@radu-matei.com>", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/radu-matei/brigade-utils/issues" | ||
}, | ||
"homepage": "https://github.com/radu-matei/brigade-utils#readme" | ||
} |
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,29 @@ | ||
import * as brigadier from "@azure/brigadier"; | ||
|
||
export class ACRBuildJob extends brigadier.Job { | ||
|
||
/** | ||
* The constructor returns a new Brigade Job configured to | ||
* | ||
* @param name - name of the job | ||
* @param img - container image to be built | ||
* @param tag - tag of the image | ||
* @param dir - directory where the container build context cab be found. It requires the Dockerfile to be at the root | ||
* @param registry - container registry to log in to, and where the image will be pushed | ||
* @param username - username for the container registry | ||
* @param token - Azure Service Principal token to log in for the registry. The Service Principal needs to have proper permissions | ||
* @param tenant - the Azure tenant of the subscription | ||
* @param azureCli - the Docker image to use for the Azure CLI. Defaults to "microsoft/azure-cli:latest" | ||
*/ | ||
constructor(name: string, img: string, tag: string, dir: string, registry: string, username: string, token: string, tenant: string, azureCli = "microsoft/azure-cli:latest") { | ||
super(name, azureCli); | ||
let imgName = img + ":" + tag; | ||
this.tasks = [ | ||
`az login --service-principal -u ${username} -p ${token} --tenant ${tenant}`, | ||
`cd ${dir}`, | ||
`echo '========> building ${img}...'`, | ||
`az acr build -r ${registry} -t ${imgName} .`, | ||
`echo '<======== finished building ${img}.'` | ||
]; | ||
} | ||
} |
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 @@ | ||
export * from "./acr" |
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,30 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es6", | ||
"outDir": "out", | ||
"lib": [ | ||
"es6" | ||
], | ||
"declaration": true, | ||
"sourceMap": true, | ||
"rootDir": "src", | ||
/* Strict Type-Checking Option */ | ||
"strict": true, /* enable all strict type-checking options */ | ||
/* Additional Checks */ | ||
"noUnusedLocals": true, /* Report errors on unused locals. */ | ||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ | ||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ | ||
// "noUnusedParameters": true, /* Report errors on unused parameters. */ | ||
"typeRoots": [ | ||
"node_modules/@types" | ||
] | ||
}, | ||
"include": [ | ||
"./src/**/*" | ||
], | ||
"exclude": [ | ||
"node_modules/**/*" | ||
//, "test" | ||
] | ||
} |
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,15 @@ | ||
{ | ||
"rules": { | ||
"no-string-throw": true, | ||
"no-unused-expression": true, | ||
"no-duplicate-variable": true, | ||
"curly": true, | ||
"class-name": true, | ||
"semicolon": [ | ||
true, | ||
"always" | ||
], | ||
"triple-equals": true | ||
}, | ||
"defaultSeverity": "warning" | ||
} |
Oops, something went wrong.