Skip to content

Commit

Permalink
Merge pull request #119 from cloudy-sky-software/master
Browse files Browse the repository at this point in the history
PR comment feature should be opt-in and not enabled by default
  • Loading branch information
AaronFriel authored Sep 29, 2022
2 parents daa54eb + bfefdad commit 3fba93d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
6 changes: 6 additions & 0 deletions buildAndReleaseTask/prComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ export async function createPrComment(taskConfig: TaskConfig) {
return;
}

const hostType = tl.getVariable("System.HostType");
if (hostType?.toLowerCase() !== "build") {
tl.warning(tl.loc("Warning_NotABuildPipeline", hostType));
return;
}

const repoProvider = tl.getVariable("Build.Repository.Provider");
if (repoProvider !== "TfsGit") {
tl.warning(tl.loc("Warning_UnSupportedRepositoryType", repoProvider));
Expand Down
7 changes: 4 additions & 3 deletions buildAndReleaseTask/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@
"name": "createPrComment",
"type": "boolean",
"label": "Add the Pulumi log output as a PR comment",
"defaultValue": "true",
"defaultValue": "false",
"helpMarkDown": "Check this option if you would like this task to add a comment to your PR (when applicable.) **Note**: Your project's build service user must have the `Contribute to pull requests` permission for this to work. Additionally, you must map the `System.AccessToken` variable as an env var for this task: `SYSTEM_ACCESSTOKEN: $(System.AccessToken)`.",
"required": "false"
},
{
"name": "useThreadedPrComments",
"type": "boolean",
"label": "Add PR comments to an existing thread (if any) created by this task",
"defaultValue": "false",
"defaultValue": "true",
"groupName": "advanced",
"helpMarkDown": "Check this option if you would like this task to always add a comment to the previously-created comments thread.",
"required": "false",
Expand Down Expand Up @@ -157,6 +157,7 @@
"Debug_ExistingThreadNotFound": "An existing comment thread created by this task was not found. A new thread will be started.",
"Debug_ThreadFound": "Found an existing comment thread created by this task. A new comment will be added to it.",
"Warning_ExistingCommentThreadNotFound": "Did not find an existing comment thread for Pulumi output. Will start a new one.",
"Warning_UnSupportedRepositoryType": "Repository type %s is not yet supported for PR comments."
"Warning_UnSupportedRepositoryType": "Repository type %s is not yet supported for PR comments.",
"Warning_NotABuildPipeline": "Ignoring request to create a PR comment. PR comments are only applicable for build pipelines. The pipeline is a %s."
}
}
4 changes: 3 additions & 1 deletion buildAndReleaseTask/tests/_suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ describe("Pulumi task tests", () => {
);

done();
});
}).timeout(3000);
// Set a higher timeout for the above test since it seems to take
// some additional time to run sometimes.

it("should run Pulumi with the expected env vars", (done: Mocha.Done) => {
const tp = path.join(__dirname, "envvars.js");
Expand Down
5 changes: 2 additions & 3 deletions overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ Read on to learn how you can get started quickly.

## Prerequisites

- You must have an active Azure subscription. Create a new subscription at https://azure.com.
- You must also have an active Azure DevOps account and an organization. Create a new account at https://dev.azure.com.
- You must have an active Azure DevOps account and an organization. Create a new account at https://dev.azure.com.
- Install this extension to your organization. To do this, you must be an admin of the organization.
- Once installed, you may have to have your admin make the extension available to you or your project.
- Create a [service connection](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/connect-to-azure?view=azure-devops) to your Azure Subscription in your DevOps project.
- You'll need an Azure subscription if you plan on creating resources in Azure. Create a [service connection](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/connect-to-azure?view=azure-devops) for the Azure Subscription in your DevOps project.
- **Note**: At this time, only a `Service Principal Authentication` based service connection can be used with this extension.
- The name of this service connection is what you will use in the Pulumi task for the input `azureSubscription` if you are using the YAML configuration.

Expand Down

0 comments on commit 3fba93d

Please sign in to comment.