WaelHamze / dyn365-ce-vsts-tasks

VSTS Extension for Dynamics 365 Customer Engagement
https://marketplace.visualstudio.com/items?itemName=WaelHamze.xrm-ci-framework-build-tasks
GNU General Public License v3.0
117 stars 56 forks source link

The X solution doesn't have an upgrade that is ready to be applied. #92

Closed Hebbink closed 5 years ago

Hebbink commented 5 years ago

Hi Wael,

I've been using your build tools for months now an only today something started to go wrong. In one step I'm doing a solution import with the "holding solution" checkbox set to true. This way a Solution_Upgrade solution is created. After that import step I do an "Apply Solution Upgrade" step and that one started to return this error since yesterday "The X solution doesn't have an upgrade that is ready to be applied." When I look in the solutions list there is no _Upgrade solution anymore and the version number is the right one. So is it possible that because of a change to the import step the apply upgrade is already done there? The funny thing is that when I disable the "Apply Solution Upgrade" step and do a new release there is a _Upgrade solution visible. So a bit confusing and since I haven't changed anything to the release pipeline for months I wonder could this be a bug?

mVermaat commented 5 years ago

I also started seeing this behavior on my instance. The solution seems to apply successfully like stated above, however after some investigation I noticed that the logging said the statuscode of the System job is '31' (Failed). If you look for system jobs with the name 'DeleteAndPromote' you see that the system job is actually failing. This seems to be an issue within Dynamics and not within the build tools.

mVermaat commented 5 years ago

I finished a call with Microsoft Support regarding this issue and put a pull request to fix the cmdlet.

WaelHamze commented 5 years ago

@Hebbink @mVermaat agreed seems like an issue with reporting clean status in the apply process. I have seen your PR. Most of the code was already there in the common so I just had to make a few tweaks and reference it.

Please take a look and let me know if this issue fixes it.

https://github.com/WaelHamze/xrm-ci-framework/commit/3ecaa6bee8df44423381a7b08c66d2a7beee0fd8

If the async reports failure and we immediately look for the upgrade do you think the upgrade solution is disappear that quickly?

Note I use the upgrade process many times on daily basis and I have never seen this issue.

mVermaat commented 5 years ago

@WaelHamze: This code looks good. The apply solution first waits until the asyncjob is completed and it sets its status based on the fact if the solution exists or not. The only thing I noticed is that the MergeXrmSolutionComand.cs has the old code as a comment. Was that intended?

Yes, the solution is gone at the moment the async job is completed. The support engineer told me it was like that. I wasn't really sure myself so I tested it several times and engineer's statement was correct.

The process crashes due to a SQL error and at my current client we have that happen from time to time on 1 specific solution.

Hebbink commented 5 years ago

My daily and manual deployments failed 100% from 15-7 until 23-7. From 24-7 until 31-7, 2 out of 10 gave this error and since august 1st 100% OK again. So my problem looks to be solved.

Hebbink commented 5 years ago

Hi Wael, It isn't clear to me if you made this change only in a branch on GitHub or if it is implemented already in the tool itself. Because I saw this problem occurring again once last Thursday I started to doubt that.

WaelHamze commented 5 years ago

@Hebbink this change should be in the tool now. Let me know if you still having issues. If you are we may be looking at a different issue or scenario.

Hebbink commented 5 years ago

Looks like all is working perfectly and may it appear again I'll let you know.. Thanks Wael!

mVermaat commented 5 years ago

I can confirm that the issue is resolved

WaelHamze commented 5 years ago

@Hebbink @mVermaat glad this is working now.