BoostingMy / vsts-heroku-tasks

Release tasks for interacting with heroku on Visual Studio Team Services.
MIT License
1 stars 7 forks source link

Release failing even though the push to Heroku works #2

Open hamstercat opened 8 years ago

hamstercat commented 8 years ago

I'm using this extension to push my app to Heroku, and the push itself is working. The release finishes, and my code is deployed correctly to Heroku. The problem is that my release always fail in VSTS because an error occurs in the script. Here is the relevant log part:

2016-05-14T15:45:22.2384799Z [git] Checking out files: 97% (3461/3568)
2016-05-14T15:45:22.2384799Z [git] Checking out files: 98% (3497/3568)
2016-05-14T15:45:22.2384799Z [git] Checking out files: 99% (3533/3568)
2016-05-14T15:45:22.2384799Z [git] Checking out files: 100% (3568/3568)
2016-05-14T15:45:22.2384799Z [git] Checking out files: 100% (3568/3568), done. 2016-05-14T15:45:23.5186734Z Heroku cloned 2016-05-14T15:45:23.5186734Z Setting working directory to 'C:\a\19ece583b\heroku\api' 2016-05-14T15:45:23.5186734Z Cleaning up files 2016-05-14T15:45:23.5975147Z ##[error]The method or operation is not implemented. 2016-05-14T15:45:24.4881619Z Files cleaned 2016-05-14T15:45:24.4881619Z Copying files from 'C:\a\19ece583b\CI\API' 2016-05-14T15:45:27.8319115Z Files copied 2016-05-14T15:45:27.8319115Z Writing .gitignore file 2016-05-14T15:45:27.8475375Z .gitignore written 2016-05-14T15:45:27.8475375Z Initializing git config 2016-05-14T15:45:27.8944123Z git config --local user.name "My name" 2016-05-14T15:45:27.9412874Z git config --local user.email "vsts@api.git.heroku.com" 2016-05-14T15:45:27.9412874Z Git config initialized 2016-05-14T15:45:27.9412874Z Adding files 2016-05-14T15:45:33.8165305Z git add .

From the logs, the error seems to occur from between line 113 and line 115.

Do you have any ideas what could be causing the clean to fail?

hamstercat commented 8 years ago

I've added system.debug to true to my release, and I got additional information:

2016-05-15T16:08:15.2794489Z Cleaning up files 2016-05-15T16:08:15.3536163Z ##[error]System.NotImplementedException: The method or operation is not implemented. 2016-05-15T16:08:15.3536163Z ##[error] at Microsoft.TeamFoundation.DistributedTask.Handlers.PowerShellHandler.InternalPowerShellHostUI.PromptForChoice(String caption, String message, Collection1 choices, Int32 defaultChoice) 2016-05-15T16:08:15.3536163Z ##[error] at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection1 choices, Int32 defaultChoice) 2016-05-15T16:08:15.3546158Z ##[error] at System.Management.Automation.MshCommandRuntime.InquireHelper(String inquireMessage, String inquireCaption, Boolean allowYesToAll, Boolean allowNoToAll, Boolean replaceNoWithHalt) 2016-05-15T16:08:15.3546158Z ##[error] at System.Management.Automation.MshCommandRuntime.DoShouldContinue(String query, String caption, Boolean supportsToAllOptions, Boolean& yesToAll, Boolean& noToAll) 2016-05-15T16:08:15.3546158Z ##[error] at System.Management.Automation.MshCommandRuntime.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll) 2016-05-15T16:08:15.3556167Z ##[error] at System.Management.Automation.Cmdlet.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll) 2016-05-15T16:08:15.3556167Z ##[error] at Microsoft.PowerShell.Commands.RemoveItemCommand.ProcessRecord() 2016-05-15T16:08:15.3556167Z ##[error] at System.Management.Automation.CommandProcessor.ProcessRecord() 2016-05-15T16:08:15.3566162Z ##[debug]Files after cleaning up:

FernandoMorais commented 8 years ago

Hi @hamstercat, Are you using it as a build or a release task?

hamstercat commented 8 years ago

@FernandoMorais, I'm using it as a release task. In my build I have a step that publish files, and I then take those files in order to feed this extension.

FernandoMorais commented 8 years ago

@hamstercat it's the right way to use it.

Please, send me more information about some points below:

hamstercat commented 8 years ago

@FernandoMorais here is more info.

Deployment queue: I'm not sure what that is, I have a build that finishes with "Copy and Publish Build Artifacts", which triggers my Release Agent name: Hosted Agent, version: 1.99.0, OSVersion: Microsoft Windows NT 6.2.9200.0 Variables: None (only system.debug to true for the last trace)

I've taken a screenshot of my environment configuration, I blanked the credentials from it. environment configuration

hamstercat commented 8 years ago

I found the deployment queue if it can help, it says "Hosted".

ahmed-abdulmoniem commented 7 years ago

I am facing the same problem!

But I am on Default agent

ahmed-abdulmoniem commented 7 years ago

@FernandoMorais ?

ahmed-abdulmoniem commented 7 years ago
2016-10-21T02:36:59.2956469Z Cleaning up files

2016-10-21T02:36:59.2956469Z 

2016-10-21T02:36:59.2956469Z 

2016-10-21T02:36:59.3581266Z ##[error]System.NotImplementedException: The method or operation is not implemented.

2016-10-21T02:36:59.3581266Z    at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.InternalPowerShellHostUI.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)

2016-10-21T02:36:59.3581266Z    at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)

2016-10-21T02:36:59.3581266Z    at System.Management.Automation.MshCommandRuntime.InquireHelper(String inquireMessage, String inquireCaption, Boolean allowYesToAll, Boolean allowNoToAll, Boolean replaceNoWithHalt)

2016-10-21T02:36:59.3581266Z    at System.Management.Automation.MshCommandRuntime.DoShouldContinue(String query, String caption, Boolean supportsToAllOptions, Boolean& yesToAll, Boolean& noToAll)

2016-10-21T02:36:59.3581266Z    at System.Management.Automation.MshCommandRuntime.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll)

2016-10-21T02:36:59.3581266Z    at System.Management.Automation.Cmdlet.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll)

2016-10-21T02:36:59.3581266Z    at Microsoft.PowerShell.Commands.RemoveItemCommand.ProcessRecord()

2016-10-21T02:36:59.3581266Z    at System.Management.Automation.CommandProcessor.ProcessRecord()

2016-10-21T02:36:59.6706479Z Files cleaned
FernandoMorais commented 7 years ago

Hi guys! I was waiting the release of the new system, so now I'll evolve the extension to work on it. I'll need some days to finish that and I'll keep you in touch!

FernandoMorais commented 7 years ago

Hi guys!

I've just created a new release release and found an error at de default commit message attr. I changed ir and published a new version of the extension. Everything is running OK here!

Could you test with this new one (1.0.3)? I recommend you to create a new release to ensure everything is running as expected.

Please send me the config you are using for:

GreenOn commented 7 years ago

Hey @FernandoMorais , I am still getting the same error. Everything seems to be okay but the release error. Please see the attached log and environment setup (it's pretty straightforward). Let me know if you need anything. Thanks for your help! environment ReleaseLogs_14.zip

VannaDii commented 7 years ago

I'm also having this issue.

obiwan007 commented 7 years ago

Same here... Works perfect if I turn off "stop on error" in TFS. So the deployment gets through but with warnings.

FernandoMorais commented 7 years ago

Hi guys! I can't reproduce the error, I'll look into logs sent here trying to discovery what is going wrong.

FernandoMorais commented 7 years ago

Updating: at logs sent by @GreenOn I found is this error line:

2016-11-10T06:16:24.4082222Z Cleaning up files
2016-11-10T06:16:24.4082222Z 
2016-11-10T06:16:24.4082222Z 
2016-11-10T06:16:24.5002722Z ##[error]System.NotImplementedException: The method or operation is not implemented.
2016-11-10T06:16:24.5002722Z    at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.InternalPowerShellHostUI.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
2016-11-10T06:16:24.5002722Z    at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
2016-11-10T06:16:24.5002722Z    at System.Management.Automation.MshCommandRuntime.InquireHelper(String inquireMessage, String inquireCaption, Boolean allowYesToAll, Boolean allowNoToAll, Boolean replaceNoWithHalt, Boolean hasSecurityImpact)
2016-11-10T06:16:24.5002722Z    at System.Management.Automation.MshCommandRuntime.DoShouldContinue(String query, String caption, Boolean hasSecurityImpact, Boolean supportsToAllOptions, Boolean& yesToAll, Boolean& noToAll)
2016-11-10T06:16:24.5002722Z    at System.Management.Automation.MshCommandRuntime.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll)
2016-11-10T06:16:24.5002722Z    at System.Management.Automation.Cmdlet.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll)
2016-11-10T06:16:24.5002722Z    at Microsoft.PowerShell.Commands.RemoveItemCommand.ProcessRecord()
2016-11-10T06:16:24.5002722Z    at System.Management.Automation.CommandProcessor.ProcessRecord()
2016-11-10T06:16:24.8642733Z Files cleaned

This is the piece of code that is generating the error:

Write-Host "Cleaning up files"
    Get-ChildItem -Recurse -Force  | `
        ?{ $_.FullName -notlike "*.git*" } | `
            Remove-Item -Force

    Write-Verbose "Files after cleaning up: "
    Get-ChildItem -Recurse -Force | %{ Write-Verbose $_.FullName }
Write-Host "Files cleaned"

I think that it`s caused by a prompt before remove. I'll change this piece of code to do it automatically.

VannaDii commented 7 years ago

Yup, that's the stuff. I was just gathering a log to upload.

PushToHeroku_Log.txt

FernandoMorais commented 7 years ago

Hi @GioCirque! I'm changing the remove command to have a " -Confirm:$false" parameter.

FernandoMorais commented 7 years ago

Hi All! I've just published the 1.0.6 version, please check if it is ok now!

Edit: You should edit the Release definition and choose the 1.* version!

VannaDii commented 7 years ago

Unfortunately I now get this error in the Release definition editor:

Tasks 'Push to Heroku: ' are not valid for deploy phase 'Run on agent' in environment Alpha. Add Agent based tasks and try again.

And, there's no version 1.* available to select. Maybe I'm missing a step? pushtoherokuversion

VannaDii commented 7 years ago

Might have just taken some time to update. I'm seeing a v1.* now, and just kicked off a new release.

VannaDii commented 7 years ago

Nope, still the same issue.


2017-03-17T19:34:52.3398855Z ==============================================================================
2017-03-17T19:34:52.3398855Z Task         : Push To Heroku
2017-03-17T19:34:52.3398855Z Description  : Updates an app using Heroku Git.
2017-03-17T19:34:52.3398855Z Version      : 1.0.6
2017-03-17T19:34:52.3398855Z Author       : Boosting.my
2017-03-17T19:34:52.3398855Z Help         : [More Information](https://github.com/BoostingMy/vsts-heroku-tasks/wiki)
2017-03-17T19:34:52.3398855Z ==============================================================================
2017-03-17T19:34:52.3528856Z Preparing task execution handler.
2017-03-17T19:34:56.2526828Z Executing the powershell script: D:\a\_tasks\PushToHeroku_90e55fc3-9daa-4f11-b946-66338210ec51\1.0.6\PushToHeroku.ps1
2017-03-17T19:34:56.8043856Z Setting working directory to 'D:\a\r1\a\heroku'
2017-03-17T19:34:56.8043856Z 
2017-03-17T19:34:56.8043856Z 
2017-03-17T19:34:56.8143856Z D:\a\r1\a\heroku
2017-03-17T19:34:56.8173849Z Cloning heroku repository
2017-03-17T19:34:56.8173849Z 
2017-03-17T19:34:56.8173849Z 
2017-03-17T19:34:59.2405789Z git clone https://vsts:********@git.heroku.com:443/********-services.git
2017-03-17T19:34:59.2415768Z [git] Cloning into '********-services'...
2017-03-17T19:34:59.3105770Z Heroku cloned
2017-03-17T19:34:59.3105770Z 
2017-03-17T19:34:59.3105770Z 
2017-03-17T19:34:59.3105770Z Setting working directory to 'D:\a\r1\a\heroku\********-services'
2017-03-17T19:34:59.3105770Z 
2017-03-17T19:34:59.3105770Z 
2017-03-17T19:34:59.3135774Z Cleaning up files
2017-03-17T19:34:59.3135774Z 
2017-03-17T19:34:59.3135774Z 
2017-03-17T19:35:00.0388308Z ##[error]System.NotImplementedException: The method or operation is not implemented.
2017-03-17T19:35:00.0388308Z    at Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.InternalPowerShellHostUI.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
2017-03-17T19:35:00.0388308Z    at System.Management.Automation.Internal.Host.InternalHostUserInterface.PromptForChoice(String caption, String message, Collection`1 choices, Int32 defaultChoice)
2017-03-17T19:35:00.0398322Z    at System.Management.Automation.MshCommandRuntime.InquireHelper(String inquireMessage, String inquireCaption, Boolean allowYesToAll, Boolean allowNoToAll, Boolean replaceNoWithHalt, Boolean hasSecurityImpact)
2017-03-17T19:35:00.0398322Z    at System.Management.Automation.MshCommandRuntime.DoShouldContinue(String query, String caption, Boolean hasSecurityImpact, Boolean supportsToAllOptions, Boolean& yesToAll, Boolean& noToAll)
2017-03-17T19:35:00.0398322Z    at System.Management.Automation.MshCommandRuntime.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll)
2017-03-17T19:35:00.0398322Z    at System.Management.Automation.Cmdlet.ShouldContinue(String query, String caption, Boolean& yesToAll, Boolean& noToAll)
2017-03-17T19:35:00.0398322Z    at Microsoft.PowerShell.Commands.RemoveItemCommand.ProcessRecord()
2017-03-17T19:35:00.0408313Z    at System.Management.Automation.CommandProcessor.ProcessRecord()
2017-03-17T19:35:00.0408313Z Files cleaned
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z Copying files from 'D:\a\r1\a\CI Build\Services'
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z Files copied
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z Writing .gitignore file
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z .gitignore written
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z Initializing git config
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z 
2017-03-17T19:35:00.0408313Z git config --local user.name "Gio Palacino"
2017-03-17T19:35:00.0408313Z git config --local user.email "vsts@********-services.git.heroku.com"
2017-03-17T19:35:00.0418314Z Git config initialized
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z Adding files
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z git add .
2017-03-17T19:35:00.0418314Z [git] warning: LF will be replaced by CRLF in Procfile.
2017-03-17T19:35:00.0418314Z [git] The file will have its original line endings in your working directory.
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z [git] warning: LF will be replaced by CRLF in runtime.txt.
2017-03-17T19:35:00.0418314Z The file will have its original line endings in your working directory.
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z Files added
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z Committing changes
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z 
2017-03-17T19:35:00.0418314Z git commit -m "Pushed from Release-0.0.076.01-04 - ."
2017-03-17T19:35:00.0418314Z [git] On branch master
2017-03-17T19:35:00.0418314Z [git] Your branch is up-to-date with 'origin/master'.
2017-03-17T19:35:00.0418314Z [git] nothing to commit, working tree clean
2017-03-17T19:35:00.0418314Z Changes committed
2017-03-17T19:35:00.0428310Z 
2017-03-17T19:35:00.0428310Z 
2017-03-17T19:35:00.0428310Z Starting to push changes
2017-03-17T19:35:00.0428310Z 
2017-03-17T19:35:00.0428310Z 
2017-03-17T19:35:00.7916759Z git push origin master
2017-03-17T19:35:00.7926754Z [git] Everything up-to-date
2017-03-17T19:35:00.7926754Z Push finished.
2017-03-17T19:35:00.7926754Z 
2017-03-17T19:35:00.7926754Z 
2017-03-17T19:35:00.8226762Z ##[error]PowerShell script completed with 1 errors.
2017-03-17T19:35:00.8236758Z ##[section]Finishing: Push to Heroku: 
GreenOn commented 7 years ago

Yup, I am getting the same error with v1.0. Error was at the cleaning files. Same as above.

VannaDii commented 7 years ago

I'm pretty sure the issue as at line #119?

FernandoMorais commented 7 years ago

Yes @GioCirque , that's the line! I've changed it to this in 1.0.6:

Write-Host "Cleaning up files"
    Get-ChildItem -Recurse -Force  | `
        ?{ $_.FullName -notlike "*.git*" } | `
            Remove-Item -Force -Confirm:$false

    Write-Verbose "Files after cleaning up: "
    Get-ChildItem -Recurse -Force | %{ Write-Verbose $_.FullName }
Write-Host "Files cleaned"

But it seems no results...

Please, change or set this environment variable:

captura de tela 2017-03-17 as 20 25 41

After that, try another release attempt and send me the logs (be careful to hide sensitive data).

VannaDii commented 7 years ago

Debug log attached: tasklog_6.txt

FernandoMorais commented 7 years ago

Great @GioCirque! I'll try to reproduce the error with the same project structure. Until the final solution, please use the Continue On Error option.

FernandoMorais commented 7 years ago

@GioCirque, please send me the "Current agent version" in logs and the "Deployment queue" in "Run on agent" option.

VannaDii commented 7 years ago

2017-03-18T00:38:24.5389969Z ##[section]Starting: Release
2017-03-18T00:38:24.5579785Z Current agent version: '2.112.0
Jossif commented 7 years ago

Hi, are there any news ? I can't get it working even after selecting 'Continue On Error' option. Failing with the same error mentioned above: System.NotImplementedException: The method or operation is not implemented.

VannaDii commented 7 years ago

@FernandoMorais, II'm not sure what the "Deployment queue" is and I'm not seeing anything labeled as such. I can offer this image. Is this what you're looking for? image

FernandoMorais commented 7 years ago

@GioCirque click over "Run on agent" so you see agent configurations.

Hi @Jossif!!! I'm working in a solution for this error, it's in line 115 when the scripts remove files pulled from Heroku.

Guys, I'm working in another way to clear files pulled from Heroku, before coping new builded ones. This is required to remove files removed in newer build.

If you have some options I would appreciate. :)

VannaDii commented 7 years ago

Ahh, I see. Thanks for explaining that @FernandoMorais. Here it is: image

FernandoMorais commented 7 years ago

Thanks @GioCirque, I finally have reproduced the error.

I've temporarily removed the faulting code until I find a way to do that without errors.

In some posts from vsts-taks repo say that we must update to the new PowerShell3 mode... I'm now working to upgrade or even change the task to the node mode (I think it would be a better way).

Thank you all for the patience, soon everything will be ok!

VannaDii commented 7 years ago

Thanks for the update and work on the task, @FernandoMorais

rmcsharry commented 6 years ago

Is there any progress on this? Does this extension now work for building/pushing builds to Heroku?