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

breakdown Build Definition / Process / Phases / Steps into objects #77

Merged
merged 35 commits into from
Aug 18, 2018

Conversation

KaiWalter
Copy link
Contributor

PR Summary

With this PR Build Definition / Process / Phases / Steps are broken down into separate objects - see issue 64.

Now access to sub-objects is possible:

(Get-VSTeamBuildDefinition -ProjectName MyProject -Id 42).Process
(Get-VSTeamBuildDefinition -ProjectName MyProject -Id 42).Process.Phases
(Get-VSTeamBuildDefinition -ProjectName MyProject -Id 42).Process.Phases[0].Steps
(Get-VSTeamBuildDefinition -ProjectName MyProject -Id 42).Process.Phases[0].Steps[0]

PR Checklist

@DarqueWarrior
Copy link
Collaborator

Just started testing and ran into an error.

m:\> cd .\PeopleTracker\
m:\PeopleTracker> dir

Mode   Name
----   ----
d----- Builds
d----- Build Definitions
d----- Releases
d----- Repositories
d----- Teams


m:\PeopleTracker> cd '.\Build Definitions\'
m:\PeopleTracker\Build Definitions> dir
dir : Item 'Build Definitions' may no longer exists. Details: Exception setting "CreatedOn": "Cannot convert null to type "System.DateTime".".
At line:1 char:1
+ dir
+ ~~~
    + CategoryInfo          : NotSpecified: (SHiPS:String) [Get-ChildItem], Exception
    + FullyQualifiedErrorId : ExceptionWhenSetting,Microsoft.PowerShell.Commands.GetChildItemCommand

m:\PeopleTracker\Build Definitions>

@KaiWalter
Copy link
Contributor Author

Thanks. I'll look into it.

@DarqueWarrior
Copy link
Collaborator

I found it. I can correct it for you.

@KaiWalter
Copy link
Contributor Author

Well thanks. Yes please correct it. I'm not yet familiar with that SHiPS Provider approach.

@DarqueWarrior
Copy link
Collaborator

yaml builds don't have phases which is causing some tricky behavior. You have done most of the heavy lifting I am just working to get it to support them both correctly.

@KaiWalter
Copy link
Contributor Author

Should we add adding and getting a YAML build in the integration tests?

@DarqueWarrior
Copy link
Collaborator

Maybe. But I just ran into a much bigger problem. This is not a problem with what you submitted. The API version is not the same in the provider as it is in the rest of the module. For example when the module is loaded the versions default to 3.0 to support TFS2017. When you load a profile the module sets a version table to the new version. However, the classes never see that new version for some reason. They all the API calls are made using the 3.0 API which does not return the Process object of build definitions at all! So I have to work with the PowerShell team to figure out how to have my classes and module see the same values in $VSTeamVersionTable

@KaiWalter
Copy link
Contributor Author

In your 2nd last comment (t-22h) : did you mean YAML or XAML builds which do not have phases?

@KaiWalter
Copy link
Contributor Author

KaiWalter commented Aug 15, 2018

About the provider defaulting to API Version 3.0 instead of using 4.0 from the profile / modules: I'm also able to reproduce it.

For me it more looks like 2 different (process) contexts. API Version change with Add-VSTeamAccount only touches the version table visible for the modules. Provider keeps the initial setup from team.psm1.

@DarqueWarrior
Copy link
Collaborator

Correct. I just got an email back from the PowerShell team and think I have a workable solution. Will try to have it done today.

@DarqueWarrior
Copy link
Collaborator

I am reviewing the JSON returned from TFS 2017, 2018 and VSTS so see which properties are in each.

@DarqueWarrior
Copy link
Collaborator

Looks the build property from TFS was placed by the Process property in VSTS but the same "steps" are in all of them.

Can navigate build defs for TFS and VSTS
@DarqueWarrior
Copy link
Collaborator

Getting close. Huge refactor to get all this working. All the tests are passing again and works for TFS 2017/2018 and VSTS. I want to get some sleep and tests again in the morning before pushing changes.

@KaiWalter
Copy link
Contributor Author

OK, looking forward to see what has changed. This is a great PowerShell learning experience for me.

@DarqueWarrior
Copy link
Collaborator

A lot has changed but none of it was your fault. Classes in PowerShell are challenging to say the least. They run in their own run space which causes issues that I had to work around. I really like being able to see the steps of a build def. So thanks for the PR. I also learned that the steps are in different places for TFS and VSTS.

@DarqueWarrior
Copy link
Collaborator

The version will be 4.0.0 because one of the changes is a breaking change. I will go ahead and push changes so you can review but I will not merge until after I test more tomorrow.

@KaiWalter
Copy link
Contributor Author

Putting the changes in a new version 4.0.0 definitely makes sense. I wounder whether it makes sense to hold it back for some time - may be create a separate branch - until we transferred everything to classes. In Build Defs e.g. Queue, Repository should be also objects in order to allow a coherent experience for getting and setting later.

@DarqueWarrior
Copy link
Collaborator

I have it all working and we have already been move object by object to classes so I am ok with it being placed there now. So far things are looking ok.

Now they can be formatted differently
Updated help for update service endpoint
Clear last two Script Analyzer warnings
@DarqueWarrior DarqueWarrior merged commit ec7b2cc into MethodsAndPractices:master Aug 18, 2018
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.

2 participants