vfabing / AzureVm

Azure DevOps Pipelines extension for starting and stopping Azure VM
https://marketplace.visualstudio.com/items?itemName=vfabing.AzureVirtualMachineManagerTask
MIT License
3 stars 3 forks source link

Question - How to return after done start/ stop VM #14

Open rarajabs opened 4 years ago

rarajabs commented 4 years ago

Hi,

First of all, I would like to say thank you for your great work. I found your Azure extension in the beginning of month, and it is working great for me so far.

But I have question about how to make it return after VM was started/ stopped? Maybe it is due to my configuration instead of extension.

Let me explain my workflow. I have created 3 different agents in a pipeline:

  1. Start VM
  2. Run some designated jobs
  3. Stop VM

But the start VM and stop VM job is keep running even though the VM is already started/ stopped. Currently I am using timeout on the agent configuration to make my next jobs running instead of waiting forever. And this make my pipeline will show failed because of timeout.

Please guide me how to prevent the start stop job keep waiting after they are done their job and return with success status.

Here I have my job run screenshot. image

Thank you.

vfabing commented 4 years ago

Hi @rarelam,

Thank you very much for using this extension, and even more for taking the time to ask a question!

I have few questions to get a clearer vision of your context:

In the meantime and as a workaround, maybe you could have a look to the continueOnError property which should enable you to get a PartiallySucceeded build and pursue onto your Release

rarajabs commented 4 years ago

Hi,

From my observation about start VM task:

So far my main task is able to run after start VM is timed out. So it is not causing issue to me, except it will mark my pipeline as failed after time out.

Please tell me if I can provide more logs for further inspection.

vfabing commented 4 years ago

Hi,

Thank you for your reactivity. Just to confirm, if you don't set any timeout at all, how long does it keeps hanging ? More than 20 minutes is definitely not normal.

Unfortunately I use this extension daily, and didn't have any problem so far. It could be related to a bug in your Azure region (if that is even possible), and even if the COVID virus had sometimes some impact on Azure, I don't really see how this could be related on that one...

Do you have the same problem using the azure cli ? (az vm start and az vm stop)

rarajabs commented 4 years ago

Hi,

I try again by removing time out value.

  1. If using VM task extension, the job will keep hanging until I cancel the task.
    • I try run 2 agents on 2 different job, first agent is to boot up VM (VM task extension). Which this task is hanging after it done booting up VM.
    • Second agent is a dummy agent, which is self hosted agent, I make it to copy some files after VM is boot up. This agent will start operation after VM is booted up.
    • Second agent are not depend on first agent

image

  1. Then I disable VM task extension on first agent, I replaced with azure cli
    • Then I found out azue cli job able to end in 1 minute time after VM is boot up. inline script command: az vm start -g MyResourceGroup -n MyVm

image

Hope it is helping.

vfabing commented 4 years ago

Hi @rarelam,

Thank you so much for all of your tests and detailed report. I feel really bad that the extension is not working for you.

Let me check if there has been any change in the API to communicate with the VM and come back to you as soon as possible.

rarajabs commented 4 years ago

Hi,

Don't feel any bad about it, it is not your fault anyway.

It did help me to boot up VM actually, just somehow it failed to return after VM is booted up. Maybe some enhancement is needed.

Thank you for your help and wish you can found out the root cause soon.

Please tell me if you need some testing on my side, I am ready for help.

vfabing commented 4 years ago

Thanks again for your reply.

I will check the API if there is a way to make it work in a "clean" way.

If not, I am also thinking of implementing an optional fire-and-forget system which could solve your problem.

vfabing commented 4 years ago

Hi again,

I did have a look, and yes it seems that the API I am using are not maintained anymore by Microsoft...

I am currently testing and trying to figure a way to let users migrate to the new version willingly and not impact all the current users directly.

In the meantime if you want to try out the new version, I can let you install it on your azure devops account (You can send PM me on twitter for instance) image

I will keep this issue updated when I have a version ready for public deployment.

rarajabs commented 4 years ago

Hi,

Glad to hear that you able to fix it in very short time.

I am not able to install the your latest fix unfortunately because I am not system administrator for devops. So I can't help to verify now. I feel sorry about that.

My admin will install for me when extension published on the public library.

vfabing commented 4 years ago

Hi @rarelam,

Sorry for coming back to you so late.

I could not prevent myself to investigate your problem a little bit deeper, checking if API moved and so on, and discovered a potential fix.

I already published it as in the 1.0.3 version (along with few additional debug informations), and it should be deployed automatically as it is only a patch upgrade. Feel free to try it, and and tell me if you can see any improvement:

In the mean time, if you don't see any improvement and if you have time for some more testing, you could try to use the Azure Resource Group Deployment task, especially in its version 2 as it is using the same APIs as I do to start/stop the VMs.

If you can see the same problem occurs with this extension too, let me know and I could try to contact Microsoft to get some guidance about their compute API usage.

Best regards,

rarajabs commented 4 years ago

Hi @vfabing ,

Sorry for late.

I tried with the latest update of fixed extension, but unfortunately it is still getting stuck.

Then I tried to add Azure resource group deployment task to my pipeline, but I notice I can't select specific VM action (I am guessing as I didn't try to run the task.)

image

My project has created 1 resource group, and there are few different services and VMs are attached to the same resource group.

But I'm afraid Azure resource group task will affect all VMs instead on single VM, because the resource group are shared between team members.

I did tried with simple Azure CLI task to start specific VM within my resource group and it is working fine. image

rarajabs commented 4 years ago

I had attached the console screenshot for Azure VM task. The VM did boot up successfully, but the extension is not returned after VM was boot up.

image