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

Add support for Drop artifact to Publish and Download build artifacts… #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Tasks/DownloadBuildArtifacts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,16 @@ async function main(): Promise<void> {
reject(reason);
}));
}
else if (artifact.resource.type.toLowerCase() === "drop") {
let properties = {
artifacttype: artifact.resource.type,
artifactname: artifact.name,
itempattern: itemPattern,
manifestid: artifact.resource.data
};

tl.command("artifact.download", properties, downloadPath);

Choose a reason for hiding this comment

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

Note, we should not add this command permanently. When this command is used, I would have the command handler check the currently running task and verify the ID is your task otherwise fail. Customers should not be able to use this in their ad hoc scripts. Fire and forget command doesn't make sense for download, from user scripts.

Choose a reason for hiding this comment

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

should be just switch the entire drop download into C# when GA?

Choose a reason for hiding this comment

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

Does console.log(tl.loc('ArtifactsSuccessfullyDownloaded', downloadPath)); below the diff execute before the artifact is downloaded? Not sure if there's a way to monitor completion/success.

Choose a reason for hiding this comment

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

that's why artifact.download needs to be removed

}
else {
console.log(tl.loc("UnsupportedArtifactType", artifact.resource.type));
}
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadBuildArtifacts/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 132,
"Minor": 133,
"Patch": 0
},
"groups": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DownloadBuildArtifacts/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 132,
"Minor": 133,
"Patch": 0
},
"groups": [
Expand Down
2 changes: 1 addition & 1 deletion Tasks/PublishBuildArtifacts/publishbuildartifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function run() {

// upload or copy
if (artifactType === "container") {
Copy link

@hashtagchris hashtagchris Apr 24, 2018

Choose a reason for hiding this comment

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

I think this is a good opportunity to rename the task value for "Visual Studio Team Services/TFS" to server or possibly drop. I know we don't have to, but continuing to have container in the build definition will be confusing.

As far as people switching from v1 to v2: We're allowed to make breaking changes in new major versions, but we could check if (artifactType === "filepath") { first and handle other values (server or container) in the else clause.

data["containerfolder"] = artifactName;
data["uploadservice"] = "drop";

// add localpath to ##vso command's properties for back compat of old Xplat agent
data["localpath"] = pathtoPublish;
Expand Down
5 changes: 3 additions & 2 deletions Tasks/PublishBuildArtifacts/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"Build"
],
"author": "Microsoft Corporation",
"preview": true,
"version": {
"Major": 1,
"Minor": 131,
"Major": 2,

Choose a reason for hiding this comment

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

we should take this opportunity to rename the task "PublishDropArtifact" since this should work in the future from a release as well

"Minor": 0,

Choose a reason for hiding this comment

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

2.133.0 instead 2.0.0 :)

"Patch": 0
},
"demands": [],

Choose a reason for hiding this comment

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

Add preview and releaseNotes. Example from Xcode's task.json:

    "preview": true,
    "releaseNotes": "This version of the task is compatible with Xcode 8 and Xcode 9. Features that were there solely to maintain compat with Xcode 7 have been removed. The task has better options to work with the Hosted macOS pool.",

Expand Down
5 changes: 3 additions & 2 deletions Tasks/PublishBuildArtifacts/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
"Build"
],
"author": "Microsoft Corporation",
"preview": true,
"version": {
"Major": 1,
"Minor": 131,
"Major": 2,
"Minor": 0,
"Patch": 0
},
"demands": [],
Expand Down