Skip to content
New issue

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

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

Already on GitHub? # to your account

Node execution in GitVersionTfsTask #909

Closed
RyanMelenaNoesis opened this issue Jun 16, 2016 · 20 comments
Closed

Node execution in GitVersionTfsTask #909

RyanMelenaNoesis opened this issue Jun 16, 2016 · 20 comments

Comments

@RyanMelenaNoesis
Copy link

RyanMelenaNoesis commented Jun 16, 2016

Please consider adding a Node execution property to GitVersionTfsTask/task.json. (example)

I believe this would allow for running the GitVersion VSO/VSTS custom task on Nix/OSX VSTS build agents. This feature would likely also depend on #854.

@asbjornu
Copy link
Member

@RyanMelenaNoesis I have no idea what this request is for, but do I understand the implementation correctly in that all we have to do is add this:

"Node": {
    "target": "nugetinstaller.js",
    "argumentFormat": ""
}

to the task.json file?

@RyanMelenaNoesis
Copy link
Author

RyanMelenaNoesis commented Jun 16, 2016

@asbjornu The example I provided was for the NugetInstaller VSTS task. For the GitVersion VSTS task it would be adding something like:

"Node": {
    "target": "$(currentDirectory)\\GitVersion.js",
    "argumentFormat": ""
}

to the task.json file where GitVersion.js is a new script that does something similar to the current GitVersion.ps1

Basically, Nix/OSX don't know how to run the GitVersion.ps1 because they don't support Powershell.

@asbjornu
Copy link
Member

@RyanMelenaNoesis Ah, that makes sense. Do you have any idea how to translate GitVersion.ps1 to GitVersion.js, then? If so, we would be very happy to receive a pull request! 😄

@RyanMelenaNoesis
Copy link
Author

@asbjornu I could take a stab at it.

I believe the Powershell Get-LocalizedString and Invoke-Tool methods would have to be replaced because they are imported from TFS dlls.

Additionally, I'd probably need an OSX compatible version of the GitVersion.exe command line app in order to test which sounds like it is currently an issue (#854).

@asbjornu
Copy link
Member

@RyanMelenaNoesis Excellent! As soon as we've worked out the kinks in #890, I'll merge that and we should have a working GitVersion.exe on all platforms. But you can just go ahead and get this in working condition on Windows if you can and then rebase and test on Linux/OS X once #890 is merged.

@RyanMelenaNoesis
Copy link
Author

@asbjornu Any update on #890? We don't currently have any projects building on Windows that would make use of a Node based VSTS task. Once the OSX GitVersion.exe is working we should have a much easier time testing a possible fix.

@asbjornu
Copy link
Member

@RyanMelenaNoesis I wish I could move #890 forward, but I don't have the time to help that with much else than code review. Currently, it seems to be halting on @JakeGinnivan providing some information on how the build providers work and @eatdrinksleepcode implementing a Travis build provider. If you're able to contribute to anything, then please fork that pull request and submit your own. 😃

@pascalberger
Copy link
Member

Just quickly regarding the PS implementation: Implementing in a x-plat compatible fashion is definitely the way to go. This was already discussed in the original PR, but we decided to go with the PS implementation until someone has the time to provide the x-plat implementation. We should rewrite the task in TypeScript and make use of the VSTS Task SDK.

@Ivan-L
Copy link

Ivan-L commented Nov 28, 2016

Is this still planned? It would be great to be able to use the GitVersion VSTS build step on a Mac build agent.

@pascalberger
Copy link
Member

@Ivan-L Rewriting the VSTS task to Node and the new VSTS Task SDK still makes sense. But I don't think anybody is currently working on it. But I would be happy to accept a PR for this :)

@sandorfr
Copy link

sandorfr commented Dec 31, 2016

We've been struggling with this for monthes with @galo, so I've started the work on this. In addition to updating the execution engine I have a few proposals :

  • use the build scripts we developed at GeekLearning to manage our extension (and especially package restore / typescript build)
  • make sure all gitversion variable are set once using SetVariable so values are available more reliably.
  • offer the ability to get GitVersion from path using which

What do you think?

WIP is visible here : https://github.com/sandorfr/GitVersion/tree/feature/node-tfs-task-and-tooling

@pascalberger
Copy link
Member

@sandorfr Thanks for your work on this. Can you create a PR for this so that we can discuss it there?

One point. We're already using Cake for our build, and we should keep to a single build system for building everything. Of course it's possible to call a node or gulp script from the Cake script if this makes sense. Also I'm not really happy with adding a submodule and therefore add a dependency to an outside repository. If these are general purpose build scripts they should be published as npm modules IMHO.

@JakeGinnivan
Copy link
Contributor

JakeGinnivan commented Jan 2, 2017

Ditto on the submodules, don't want to use them if at all possible. Lets either take a fork and just check them in or publish them as an NPM module as @pascalberger said.

A pull request would be great, I have some comments on things but really like the direction. The comments are along the lines of, list typescript in devDependencies, lets use v2 and node_modules/@types instead of typings.

Side note, I would like to build on this node/typescript foundation and actually publish GitVersion to NPM.

@sandorfr
Copy link

sandorfr commented Jan 3, 2017

I'll see how we can publish our scripts as an npm module, it might actually help make our scripts easier to use.

Regarding the typing I agree with the vision, but as a first step I would recommand staying on typings as a first step as it works today. I'm interested in the new typing approach but I'm pretty sure it won't be as straightforward as promised.

I usually state typescript as a dev dependency to be sure that we do not require a user to install an extensive list of global dependencies to actually build the extension. The philosophy behind what we do for our extensions is clone, npm install and start contributing.

That said, let me take as much of the feedback into account and I'll open a PR in a few days.

@sandorfr
Copy link

Hi @pascalberger, I can't make it work on OSX.

It seems to be smilar to this issue #1097. It seems that it may have been addressed by
libgit2/libgit2sharp#1389 and libgit2/libgit2sharp#1409

Execution log:

mono GitVersion.exe /Users/admin/myagent/_work/4/s /output buildserver /nofetch
INFO [02/13/17 17:06:49:67] Working directory: /Users/admin/myagent/_work/4/s
INFO [02/13/17 17:06:49:68] IsDynamicGitRepository: False
ERROR [02/13/17 17:06:49:70] An unexpected error occurred:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-baa87df
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <cabb989f8a394822b60bf78680928b16>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.Proxy.git_buf_free (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x0000d] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.GitPreparer.GetProjectRootDirectory () [0x00048] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.ConfigurationProvider.Verify (GitVersion.GitPreparer gitPreparer, GitVersion.Helpers.IFileSystem fileSystem) [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.Program.VerifyConfiguration (GitVersion.Arguments arguments, GitVersion.Helpers.IFileSystem fileSystem) [0x00023] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.Program.VerifyArgumentsAndRun () [0x000ba] in <cabb989f8a394822b60bf78680928b16>:0 
INFO [02/13/17 17:06:49:70] 
INFO [02/13/17 17:06:49:70] Attempting to show the current git graph (please include in issue): 
INFO [02/13/17 17:06:49:70] Showing max of 100 commits
INFO [02/13/17 17:06:49:95] * b629b8f 4 months ago  (HEAD, origin/master, origin/custom)
* 991455c 4 months ago 
* 2f0521c 4 months ago 
* ac2cbc2 4 months ago 
* 564c0c1 4 months ago 
* 7f8d698 4 months ago 
* d99240d 6 months ago 
* 974de90 6 months ago  (tag: 1.0.0)
* d7bf3b4 6 months ago 
* 0ab66ac 6 months ago 
*   7ac74e9 6 months ago 
|\  
| * 34ad0d6 7 months ago 
| * 12f80c3 7 months ago 
* | fff7948 6 months ago 
|/  
* eb64e21 7 months ago 
INFO [02/13/17 17:06:49:67] Working directory: /Users/admin/myagent/_work/4/s
INFO [02/13/17 17:06:49:68] IsDynamicGitRepository: False
ERROR [02/13/17 17:06:49:70] An unexpected error occurred:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-baa87df
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <cabb989f8a394822b60bf78680928b16>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.Proxy.git_buf_free (LibGit2Sharp.Core.Handles.GitBuf buf) [0x00000] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.Handles.GitBuf.Dispose () [0x00000] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.Proxy.ConvertPath (System.Func`2[T,TResult] pathRetriever) [0x0002e] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.Proxy.git_repository_discover (LibGit2Sharp.Core.FilePath start_path) [0x0000d] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Repository.Discover (System.String startingPath) [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.GitPreparer.GetDotGitDirectory () [0x0000f] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.GitPreparer.GetProjectRootDirectory () [0x00048] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.ConfigurationProvider.Verify (GitVersion.GitPreparer gitPreparer, GitVersion.Helpers.IFileSystem fileSystem) [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.Program.VerifyConfiguration (GitVersion.Arguments arguments, GitVersion.Helpers.IFileSystem fileSystem) [0x00023] in <cabb989f8a394822b60bf78680928b16>:0 
  at GitVersion.Program.VerifyArgumentsAndRun () [0x000ba] in <cabb989f8a394822b60bf78680928b16>:0 
INFO [02/13/17 17:06:49:70] 
INFO [02/13/17 17:06:49:70] Attempting to show the current git graph (please include in issue): 
INFO [02/13/17 17:06:49:70] Showing max of 100 commits
INFO [02/13/17 17:06:49:95] * b629b8f 4 months ago  (HEAD, origin/master, origin/custom)
* 991455c 4 months ago 
* 2f0521c 4 months ago 
* ac2cbc2 4 months ago 
* 564c0c1 4 months ago 
* 7f8d698 4 months ago 
* d99240d 6 months ago 
* 974de90 6 months ago  (tag: 1.0.0)
* d7bf3b4 6 months ago 
* 0ab66ac 6 months ago 
*   7ac74e9 6 months ago 
|\  
| * 34ad0d6 7 months ago 
| * 12f80c3 7 months ago 
* | fff7948 6 months ago 
|/  
* eb64e21 7 months ago 
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-baa87df
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <cabb989f8a394822b60bf78680928b16>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <cabb989f8a394822b60bf78680928b16>:0 
FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception. ---> System.DllNotFoundException: git2-baa87df
  at (wrapper managed-to-native) LibGit2Sharp.Core.NativeMethods:git_libgit2_init ()
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject..ctor () [0x00006] in <cabb989f8a394822b60bf78680928b16>:0 
  at LibGit2Sharp.Core.NativeMethods..cctor () [0x00058] in <cabb989f8a394822b60bf78680928b16>:0 
   --- End of inner exception stack trace ---
  at LibGit2Sharp.Core.NativeMethods+LibraryLifetimeObject.Finalize () [0x00000] in <cabb989f8a394822b60bf78680928b16>:0 
rc:255
success:false
Error: mono failed with return code: 255
    at ChildProcess.<anonymous> (/Users/admin/myagent/_work/_tasks/GitVersion_f402bc4f-87b9-402a-a018-33aa296c2681/0.5.0/node_modules/vsts-task-lib/toolrunner.js:291:30)
    at emitTwo (events.js:100:13)
    at ChildProcess.emit (events.js:185:7)
    at maybeClose (internal/child_process.js:850:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
task result: Failed

@pascalberger
Copy link
Member

@asbjornu Any idea about this?

@asbjornu
Copy link
Member

@pascalberger: No, sorry. I think someone with deep LibGit2Sharp knowledge needs to help us out with this one.

@sandorfr
Copy link

Hi,

LibGit2Sharp has released the final 0.24.0. This should fix the problem on OSX, and make everything work fine.

@asbjornu
Copy link
Member

@sandorfr: Thanks. I submitted #1248 to upgrade LibGit2Sharp, so let's hope that turns green. 😃

@asbjornu
Copy link
Member

After upgrading to LibGit2Sharp 0.26 in #1713, I hope this problem is now fixed. Can you please try the latest build of GitVersion and report back whether it fixes this problem or not? Please reopen this issue if the problem persists.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants