Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure key vault task #3933

Merged
merged 8 commits into from
May 8, 2017
Merged

Azure key vault task #3933

merged 8 commits into from
May 8, 2017

Conversation

Lovakumar
Copy link
Contributor

No description provided.

@Lovakumar Lovakumar requested a review from bansalaseem April 4, 2017 07:20
@msftclas
Copy link

msftclas commented Apr 4, 2017

@Lovakumar,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

"loc.messages.ARG_UnsupportedAzurePSVersion": "未安裝 Azure Powershell Cmdlet 要求的最低版本 {0}。您可以遵循下列網址中的指示取得最新 Azure powershell: {1}",
"loc.messages.ARG_AzureRMModuleNotFound": "未安裝必要的 AzureRM Powershell 模組。您可以遵循下列網址中的指示取得最新 Azure Powershell: {0}",
"loc.messages.ARG_DeploymentFailed": "資源群組部署 '{0}' 失敗",
"loc.messages.ARG_ValidationFailed": "資源群組部署範本驗證失敗,錯誤碼為 {0},錯誤訊息為: {1}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ARG Keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need to check-in other languages resources. Hence deleted these files.

version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="icon.svg"
inkscape:export-filename="C:\Users\Jamie\Sources\vsts-tasks\Tasks\DeployAzureResourceGroup\icon.png"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this path correct? Should it have DeployARG name in it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

icon svg is not needed. icon.png is sufficient. Hence deleted this file.

tl.debug("Setting resource path to " + taskManifestPath);
tl.setResourcePath(taskManifestPath);

run().then((result) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use async await

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,45 @@
/// <reference path="../../../definitions/node.d.ts" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each task needs it's own typings. see shellscript task. this causes updates needing all teams to revalidate all tasks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.keyVaultUrl = util.format("https://%s.%s", this.keyVaultName, azureKeyVaultDnsSuffix);
this.vaultCredentials = this.getVaultCredentials(connectedService, azureKeyVaultDnsSuffix);
}
catch (error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't catch in a contructor. The consumer can catch this. You're just masking what the root issue is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"displayName": "Azure key vault details",
"isExpanded": true
}
],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this group required. I can see all the inputs below to see and hence doubt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with PM - it's ok to have it.

"dataSourceName": "AzureKeyVaults"
}
],
"sourceDefinitions": [],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to remove

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
},
{
"name": "SecretsFilter",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For users using this from Task catelogue, there has to be help on how to access the downloaded values.

@@ -0,0 +1,5 @@
# Azure Key Vault Task
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would want to add L0 tests.

},
"demands": [],
"minimumAgentVersion": "2.0.0",
"groups": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we validate this in both the Agent phase and Deployment group phase.

tl.debug(util.format("Downloading secret value for: %s", secretName));

return new Promise<void>((resolve, reject) => {
// if (tl.getVariable(secretName) !== undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove unwanted code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"label": "Key vault",
"required": true,
"groupName": "AzureKeyVaultDetails",
"helpMarkDown": "Provide the name of a key vault.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any allowed set of characters and restrictions for name. Please call that out in help. It might also be good idea to validate that in the script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comma is not allowed since we use that as delimiter. I will update the help text for the same.

return reject(tl.loc("GetSecretValueFailed", secretName, this.getError(error)));
}

console.log("##vso[task.setvariable variable=" + secretName + ";issecret=true;]" + secretValue);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If secretName and secretValue can support special characters, please test if you are able to set names with those characters in environment variable.

"name": "AzureKeyVault",
"main":"main.js",
"dependencies": {
"vsts-task-lib" : "^0.9.20",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tie to specific version. It will help you in controlling nested dependencies that might come along.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

var downloadAllSecrets = false;
if (this.taskParameters.secretsFilter && this.taskParameters.secretsFilter.length > 0)
{
if (this.taskParameters.secretsFilter.length === 1 && this.taskParameters.secretsFilter[0] === "*") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to do any trimming etc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input reading functions in task lib takes care of it.

this.credentials = credentials;
this.subscriptionId = subscriptionId
this.baseUri = this.credentials.armUrl;
this.longRunningOperationRetryTimeout = 60; // In minutes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 60 min?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied code and Sachin's team will do the refactoring. I will file a bug on them

@Lovakumar Lovakumar merged commit ba45d48 into master May 8, 2017
@Lovakumar Lovakumar deleted the users/lovak/azurekeyvaulttask branch May 8, 2017 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants