title: Why am I getting inconsistent results when attempting to update my instance group using `gcloud`?
body: <p>I have an instance group in GCP, and I am working on automating the deployment process. The instances in this group are based on a tagged GCR image. When a new image is pushed to the container registry, we have been manually triggering an upgrade by navigating to the instance group from console.cloud.google.com, clicking &quot;restart/replace vms&quot;, and setting these options:</p>
  <ul>
  <li>Operation: replace</li>
  <li>Maximum surge: 3</li>
  <li>Maximum unavailable: 0</li>
  </ul>
  <p>Here is my <code>gcloud</code> command for doing the same thing (<a href="https://cloud.google.com/compute/docs/instance-groups/rolling-out-updates-to-managed-instance-groups" rel="nofollow noreferrer">link to Google's documentation about this command</a>):</p>
  <pre><code>gcloud beta compute instance-groups managed rolling-action start-update my-instance-group \
      --version=template=my-template-with-image \
      --replacement-method=substitute \
      --max-surge=3 \
      --max-unavailable=0 \
      --region=us-central1
  </code></pre>
  <p>Manually, the process always works. But the <code>gcloud</code> command is flaky. It always appears to succeed from the command line, but the instance groups are not always restarted. I have even tried adding these two flags, and the restart attempt was still unreliable:</p>
  <pre><code>    --minimal-action=replace \
      --most-disruptive-allowed-action=replace \
  </code></pre>
  <p>There is quite a lot of output from the <code>gcloud</code> command (which I can provide, if necessary), but here are the only parts of the output that differ between a successful and unsuccessful attempt:</p>
  <p>Good:</p>
  <pre><code>currentActions:
    creating: 1
  status:
    isStable: false
    versionTarget:
      isReached: false
  </code></pre>
  <p>Bad:</p>
  <pre><code>currentActions:
    creating: 0
  status:
    isStable: true
    versionTarget:
      isReached: true
  </code></pre>
  <p>That is pretty much the extent of my knowledge at this point. I am not sure how to move forward in automating the build process, and I have been unable to find answers from the documentation so far.</p>
  <p>I hope I was not too verbose, and thank you in advance to anyone who spends time on this :)</p>