![]() ![]() To add the GitVersion.MajorMinorPatch which generated by the GitVersion task into Variables, please apply below scripts into PowerShell task: $connectionToken="Īs I mentioned previously, I still don't think it is available to specify $(GitVersion.MajorMinorPatch) in Tag format. So, the most convenient method for you to tag the GitVersion.MajorMinorPatch value to repos is using $(Build.BuildNumber): For example, the predefined variables that the system default have, and the customized variables which specified in the Variables tab.īased on the GitVersion task compile and work logic, in fact, the GitVersion.MajorMinorPatch value is generated and stored as current build's build number: The variable GitVersion.MajorMinorPatch you saw from the log is a step-level variable, which means its life cycle is only start from the current GitVersion task.Īs the definition you are referring, it scope must to all. GitVersion component that I've added to the pipeline. I can see in the debug logs that this variable is getting set by the Git config -global user.email tag -a -m įor this to work, the Project Collection Build Server account (not the Project Build Service Accounts group) needs to be allocated the Contribute permission for the Repositories Git config -global user.name "BuildService" To get a user/date against it you need to set the user name/email as well e.g. Note the assignment of workingDirectory, otherwise I had an error that the location was not a git repository.įor an annotated tag rather than lightweight tag, the syntax would look like this. ![]() The persistCredentials allows the token to be automatically passed to other git commands. WorkingDirectory: $(Build.SourcesDirectory) Git push origin $(GitVersion.NugetVersionV2) If you are doing a yaml pipeline, you can add the following steps - checkout: self I'd be really grateful for any ideas on this. Somehow I need to be able to dynamically create or set a variable at scope ALL with the value I want to tag here. However in this case I just got a tag "v" created. I then tried adding a pipeline variable to the pipeline of "GitVersion.MajorMinorPatch" with the hope that this was at the right scope and hoping that when the "tvariable" command is run, that this will set the variable value of this higher scoped variable. ![]() So I guess the problem is that this variable created during the pipeline does not have a scope of All. For example: '$(Build.DefinitionName) $(Build.DefinitionVersion)$(Build.BuildId) $(Build.BuildNumber)$(My.Variable)'" "Tag format could be a combination of user-defined or pre-defined variables that have a scope of "All". However if I leave it just as this, I get a tag created as "v$(GitVersion.MajorMinorPatch)" which means that at the time that the tag is being created that that variable no longer exists. I can see in the debug logs that this variable is getting set by the GitVersion component that I've added to the pipeline. I've set this and set to a variable that is set by one of the Agent Tasks I have (GitVersion) Feels like I can't be the first one to be doing this, but I'm struggling to find something that works.Īzure Devops Pipeline has a feature in Get Sources to "Tag sources" On Success. I'm trying to set a tag with the current version number determined by GitVersion on the GIT commit at the end of a successful build. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |