tag:help.appveyor.com,2012-11-13:/discussions/questions/3873-clone-fails-occasionallyAppVeyor: Discussion 2018-10-19T08:18:20Ztag:help.appveyor.com,2012-11-13:Comment/425398662017-05-11T13:06:03Z2017-05-11T13:06:13ZClone fails occasionally <div><p>Guess I could use the on_failure tag in the yml, download the build log and check for 'Command exited with code 255' and create a new build via the api. Is this the best way to do this?</p></div>liam.kennedytag:help.appveyor.com,2012-11-13:Comment/425398662017-05-11T16:52:21Z2017-05-11T16:52:21ZClone fails occasionally <div><p>Hi Liam,</p>
<p>I see couple of options for you.</p>
<p>You can write custom clone script (which does basically the same as AppVeyor does), wrap it into <code>.cmd</code> or <code>.bat</code> file and run with <code>appveyor-retry</code> as custom clone script (<code>clone_script</code> in YAML). Command might look like this:<br></p>
<pre>
<code> - appveyor-retry myClone.cmd</code>
</pre>
If you prefer to restart new build, then it is easier for you to use <code>$lastexitcode</code> environment variable. However I suggest to do some measures to prevent infinite look. With variable <code>APPVEYOR_FORCED_BUILD</code> you can detect that build started from API, so do not start new build on error if <code>APPVEYOR_FORCED_BUILD</code> is <code>true</code> even if <code>$lastexitcode</code> is <code>255</code>. If you don't like it because you, need more attempts than 2, you can pass custom environment variable to new build with API, and use it as count.
<p>Ilya.</p></div>Ilya Finkelshteyntag:help.appveyor.com,2012-11-13:Comment/425398662017-05-16T15:26:21Z2017-05-16T15:26:21ZClone fails occasionally <div><p>I really don't like the idea of having to write a custom clone script. Can I make a feature request for something that handles this AppVeyor side?</p>
<p>Liam</p></div>liam.kennedy