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

Added a .NET Core version of the Azure DevOps (vsts) build/release task. #1499

Merged
merged 2 commits into from
Nov 6, 2018

Conversation

yohanb
Copy link

@yohanb yohanb commented Oct 15, 2018

Hi,
Here's a PR for the following request change:
#1496

I create a separate task specifically for .NET Core so it doesn't interfere with the current portable version.
I tested the task on my personal Azure DevOps account on a hosted Ubuntu agent and it works! It requires for .NET Core 2.0+ to be installed on the agent.

Let me know if I can do anything else to get this thing out in the wild.

Cheers.

@arturcic
Copy link
Member

Thank you for the contribution. That will be a great step to support the Unix agents on Azure DevOps.

@yohanb
Copy link
Author

yohanb commented Oct 16, 2018

@arturcic the build steps have failed because I added a new VsixNetCoreOutputFilePath parameter.

Copy link
Member

@arturcic arturcic left a comment

Choose a reason for hiding this comment

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

@arturcic the build steps have failed because I added a new VsixNetCoreOutputFilePath parameter.

This parameter should be also included in the paths.cake as this parameter is later used for Publishing

build.cake Outdated
@@ -276,6 +281,37 @@ Task("Pack-Tfs")
});
});

Task("Pack-Tfs-NetCore")
Copy link
Member

Choose a reason for hiding this comment

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

I would keep the Pack tasks for TFS as a single task, similar to the way nuget packages are create. The packaging logic could be moved to a method in utils.cake and you just pass some arguments for mono based and dotnet core based version, and within the Pack-Tfs task you call the method for both variants

build.cake Show resolved Hide resolved
build.cake Outdated
@@ -238,6 +238,11 @@ Task("Copy-Files")
CopyFileToDirectory(portableDir + "/" + "GitVersion.exe", tfsPath);
CopyDirectory(portableDir.Combine("lib"), tfsPath.Combine("lib"));

// Vsix dotnet core
var tfsNetCorePath = new DirectoryPath("./src/GitVersionTfsTask.NetCore/GitVersionTask");
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to have the second TFS task in the same ./src/GitVersionTfsTask root folder, but in a different GitVersionNetCoreTask child folder, just to keep everything related to TFS in the same root folder. That means we need to change a little the structure of the GitVersionTfsTask folder.

Copy link
Author

Choose a reason for hiding this comment

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

OK, I'll find the time to rework the folders this week.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, you can have as inspiration the way here it is structured

@yohanb
Copy link
Author

yohanb commented Oct 25, 2018

hey @arturcic ,
I modified the code as you requested. I haven't really validated it works besides the cake build and packaging.
Keep me posted!

@arturcic
Copy link
Member

@yohanb, I'll have a look soon, thanks

@mitchdenny
Copy link

Would love to see this merged :)

@arturcic
Copy link
Member

arturcic commented Nov 5, 2018

@yohanb Can you please make the changes so that we can move forward? We should also consider using azure-pipelines-task-lib npm package as vsts-task-lib is deprecated (details)

src/GitVersion.sln Outdated Show resolved Hide resolved
src/GitVersion.sln.DotSettings Outdated Show resolved Hide resolved
src/GitVersionCore/AssemblyInfo.cs Outdated Show resolved Hide resolved
src/GitVersionExe/AssemblyInfo.cs Outdated Show resolved Hide resolved
src/GitVersionRubyGem/gitversion.gemspec Outdated Show resolved Hide resolved
src/GitVersionTfsTask/vss-extension.json Outdated Show resolved Hide resolved
src/GitVersionTfsTask/vss-extension.json Outdated Show resolved Hide resolved
src/GitVersionTfsTask/GitVersion.ts Outdated Show resolved Hide resolved
src/GitVersionTfsTask/GitVersion.ts Outdated Show resolved Hide resolved
src/GitVersionTfsTask/GitVersion.ts Show resolved Hide resolved
@yohanb
Copy link
Author

yohanb commented Nov 5, 2018

@arturcic done making the changes.

@arturcic
Copy link
Member

arturcic commented Nov 5, 2018

Looks great! I have run the build locally and it seems the paths to the vsix (the ones used for publishing) differ from the actual paths

image

Can you update the path here? https://github.com/GitTools/GitVersion/pull/1499/files#diff-faf8aebe07f0c09fe65d5a4be490bb83R43

build/paths.cake Outdated Show resolved Hide resolved
@arturcic
Copy link
Member

arturcic commented Nov 5, 2018

there is one missing line you should add so that the new vsix file is published to AppVeyor and to the marketplace https://github.com/GitTools/GitVersion/blob/master/build/parameters.cake#L106, Please add the netcore path as well.

@yohanb
Copy link
Author

yohanb commented Nov 5, 2018

there is one missing line you should add so that the new vsix file is published to AppVeyor and to the marketplace https://github.com/GitTools/GitVersion/blob/master/build/parameters.cake#L106, Please add the netcore path as well.

done

@arturcic
Copy link
Member

arturcic commented Nov 5, 2018

@yohanb Looks great to me. Can we prepare it for merge by squashing all the commits as one commit? Then you can rebase it on master, to keep the commit history clean? Thanks

@yohanb
Copy link
Author

yohanb commented Nov 5, 2018

@arturcic do you mean rebase on my forked master and create another PR for yohanb:master -> gittools:master ?

@arturcic
Copy link
Member

arturcic commented Nov 5, 2018

@arturcic do you mean rebase on my forked master and create another PR for yohanb:master -> gittools:master ?

looks like a simple squash is not possible as you have merged the master already, So all the commits after the master merge commit can be squashed. Need to think about

@yohanb
Copy link
Author

yohanb commented Nov 5, 2018

@arturcic do you mean rebase on my forked master and create another PR for yohanb:master -> gittools:master ?

looks like a simple squash is not possible as you have merged the master already, So all the commits after the master merge commit can be squashed. Need to think about

it should be possible to simply squash and commit the PR according to the docs:
https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits

@arturcic
Copy link
Member

arturcic commented Nov 5, 2018

it should be possible to simply squash and commit the PR according to the docs:
https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits

ok then, give it a try.

@yohanb yohanb closed this Nov 5, 2018
@yohanb yohanb reopened this Nov 5, 2018
@yohanb
Copy link
Author

yohanb commented Nov 5, 2018

it should be possible to simply squash and commit the PR according to the docs:
https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits

ok then, give it a try.

can't
image

@arturcic
Copy link
Member

arturcic commented Nov 6, 2018

here is the way you can do that in terminal

  1. git reset --soft 1a842897 - this will reset to the first commit when you created the branch, but will keep the changes

  2. git add . - staging the squashed changes

  3. git commit -m "Added a .NET Core version of the Azure DevOps (vsts) build/release task." - commit the changes

  4. git rebase master - rebase on master

  5. fix the conflicts

  6. git rebase --continue - you have rebased

  7. Now you can force push and you're done

@yohanb
Copy link
Author

yohanb commented Nov 6, 2018

@arturcic everything is clean and rebased on my forked master. How do you wish to commit the changes upstream to this repo?

@arturcic
Copy link
Member

arturcic commented Nov 6, 2018

@yohanb first of all you should push (forced) to your origin, this way it will appear on your origin master branch and it will automatically appear here. So the history will be overwritten.

@yohanb yohanb force-pushed the feature/dotnet-core-vsts-task branch from 11f697d to 0e4c3fd Compare November 6, 2018 19:04
@yohanb
Copy link
Author

yohanb commented Nov 6, 2018

@yohanb first of all you should push (forced) to your origin, this way it will appear on your origin master branch and it will automatically appear here. So the history will be overwritten.

ok thanks, I forgot to force push on this feature branch. Not used to rewriting git history 🤣
here goes nothing!

@arturcic
Copy link
Member

arturcic commented Nov 6, 2018

@yohanb. I have fixed the rebase conflict and ran the build. The changes are ready for merging. I'll merge the PR. Thanks for the contribution and the patience.

@arturcic arturcic merged commit 067882f into GitTools:master Nov 6, 2018
@jmezach
Copy link

jmezach commented Nov 6, 2018

Awesome work guys!

@yohanb
Copy link
Author

yohanb commented Nov 6, 2018

@yohanb. I have fixed the rebase conflict and ran the build. The changes are ready for merging. I'll merge the PR. Thanks for the contribution and the patience.

My pleasure. Hopefully this will enable greater adoption of GitVersion no matter the platform!

@yohanb yohanb deleted the feature/dotnet-core-vsts-task branch November 6, 2018 20:41
@jmezach
Copy link

jmezach commented Nov 7, 2018

@arturcic Looks like the new extension version isn't yet available on the Marketplace. Is there a manual step still involved to make that happen?

@arturcic
Copy link
Member

arturcic commented Nov 7, 2018

that's right, and that's because the marketplace does not allow to publish pre-release versions, and we'll get a new version on marketplace when we have a stable version released

@jmezach
Copy link

jmezach commented Nov 8, 2018

I see. Do you have an idea when that will happen? We could greatly benefit from this since we would no longer have to delay our macOS and Linux builds for the Windows builds to finish.

@arturcic
Copy link
Member

arturcic commented Nov 8, 2018

As far as I know we don't have a well defined milestones structure with issues that need to be included in one release or another. I guess we need that, @gep13 , @JakeGinnivan , @asbjornu - do you have anything to add?

@jmezach
Copy link

jmezach commented Nov 8, 2018

Perhaps a preview version of the Azure DevOps extension could be useful as well. I'm developing an open source extension myself as well and from our CI pipeline we build and package the preview version of the extension and we just monotonically increase the patch version number. Then when we ship we use the GitVersion generated version as the version number. This allows us to dogfood the extension ourselves and we could even share the preview extension with specific accounts if we want.

@asbjornu
Copy link
Member

asbjornu commented Nov 8, 2018

We don't have a well defined process for stable releases, no. Is it so that this particular PR is impossible to actually test without it being published to Azure DevOps, which we can't do until it has a stable version number?

@arturcic
Copy link
Member

arturcic commented Nov 8, 2018

It is possible to test locally the tasks as they are nodejs apps, but to check how they work on Azure DevOps as part of the build you need to install it as far as I know

@jmezach
Copy link

jmezach commented Nov 8, 2018

@arturcic @asbjornu Yes, you can only test an Azure DevOps extension by uploading it to the Marketplace and as far as I know it only supports major.minor.patch versions and no -prerelease tags.

However as I mentioned you can have a separate extension (with a different id in the vss-extension.json) that can be marked as preview and can even be private (as in, only available in your own account or shared with specific accounts). You can then simply increment the patch version every time you build and upload the extension automatically. Then when you're ready to ship you can change the ID of the extension to the original one and use the appropriate version number.

I'm currently using this extension to automate that inside of my CD pipeline.

@asbjornu
Copy link
Member

asbjornu commented Nov 9, 2018

@jmezach: That sounds like a neat solution. How do we set up something like that and who can do it? I don't use Azure DevOps, so I don't even know where to start.

@arturcic
Copy link
Member

arturcic commented Nov 9, 2018

@jmezach thanks for suggestion. I'll think about this, and probably we'll have a separate extension for pre-release - something like GitVersion-beta or similar.

However as I mentioned you can have a separate extension (with a different id in the vss-extension.json) that can be marked as preview and can even be private

Are you talking about this ?

@jmezach
Copy link

jmezach commented Nov 9, 2018

So the way that I've set this up currently is the the vss-extension.json in our source repository uses the ID augurk.augurk-preview. We process that through our CI pipeline to generate a .vsix with the -preview tag. We upload that .vsix as an artifact associated with a particular build.

Then in our release pipeline (not sure if you can actually see this, but I hope so ;)) we've defined two stages: staging and production. In the staging stage we use tasks from the extension I mentioned earlier to determine the version of the preview extension that's currently on the Marketplace. We then increase the patch number, repackage the VSIX and upload it to the Marketplace. Once that's done we are able to try out the extension within our own Azure DevOps account, but it's not visible to other accounts unless we explicitly share it with them.

When we're ready to ship (which usually means merging the changes to the master branch) we process it through the same pipeline and then promote it to production. In that stage we repackage the extension and remove the -preview tag and also stamp the correct version number (as generated by GitVersion) into it. After that anyone can use the new version of the extension.

@arturcic Yes, that is exactly what I'm talking about. In fact, you could even have a stage where the extension is just private and marked as preview, then a public version that's marked as preview and a public version that is the released version. That's not what we're doing, but it's definitely an option.

@arturcic
Copy link
Member

arturcic commented Nov 9, 2018

Thanks for explanation. I guess we can have a GitVersion-preview extension that will be public and in preview, and it will be updated on every pre-release build. On stable release we'll pack the extension as GitVersion as it is now. Same for the second extension - the one running on .net core.

@jmezach
Copy link

jmezach commented Nov 9, 2018

Sounds like a great plan. Looking forward to trying it out.

@asbjornu
Copy link
Member

asbjornu commented Nov 9, 2018

@arturcic: That sounds like a great plan. How do we implement it? Do you have the required time and expertise to do it?

@arturcic
Copy link
Member

arturcic commented Nov 9, 2018

I don't have much time, but will try to find some. The implementation is just in the build script - we check if it's stable release or pre-release, and we add the suffix or not in the vss-extension.json. Basically we change this json file depending on the type of the release.

@yohanb
Copy link
Author

yohanb commented Nov 9, 2018

happy to see things moving here! 👍

BrandonBoone added a commit to BrandonBoone/Spritey that referenced this pull request Nov 16, 2018
BrandonBoone added a commit to BrandonBoone/Spritey that referenced this pull request Nov 16, 2018
* Integrate with GitVersion for SemVer

* Adding mono-complete and libcurl3 to ubuntu build

* Attempt to fix yml issues

* Disabling SemVer in linux build

until GitTools/GitVersion#1499 is released. Also follow: GitTools/GitVersion#1527
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.

5 participants