Azure DevOps - Azure Spring Cloud Blue/Green deployment results in no production deployment

262 Views Asked by At

I have a weird problem with an Azure Spring Cloud deployment via Azure DevOps and the AzureSpringCloud@0 task.

I try to setup a blue/green deployment with this task. I have the stage blue and the stage green. If my Azure DevOps task deploys to blue everything seems to be normal in the Azure portal but if my task deploys to green there is no production deployment according to Azure.

This is the output from the Azure DevOps task:

Setting active deployment on app my-project to blue

This is the warning in the Azure Portal:

This app has no production deployment. You can set production deployment in Deployments panel.

And it looks like this:

Azure Portal with two staging deployments

With an Azure CLI command like this...

az spring-cloud app deployment list ...

...I get a JSON with both deployments but both are not active.

[
  {
    "id": "/.../deployments/blue",
    "name": "blue",
    "properties": {
      "active": false,
      "status": "Running"
    }
  },
  {
    "id": "/.../deployments/green",
    "name": "green",
    "properties": {
      "active": false,
      "status": "Running"
    }
  }
]

This is how I setup the task in Azure DevOps:

- task: AzureSpringCloud@0
  inputs:
    azureSubscription: 'My-Subscription'
    Action: 'Deploy'
    AzureSpringCloud: my-spring-cloud
    AppName: my-project
    UseStagingDeployment: true
    Package: $(Pipeline.Workspace)/my-java-app.jar
    RuntimeVersion: Java_8

- task: AzureSpringCloud@0
  inputs:
    azureSubscription: 'My-Subscription'
    Action: 'Set Production'
    AzureSpringCloud: my-spring-cloud
    AppName: my-project
    UseStagingDeployment: true      

If I navigate to my application URL the app is running but I'm not sure which stage. If I run the Azure DevOps pipeline again it knows that green is currently in production and switches to blue but I don't know from where it gets this information.

Is that a known issue or am I doing something wrong?

1

There are 1 best solutions below

0
On

About this issue, I notcie that you have two staging deployments and the devops task only try to specify the deployment by argument UseStagingDeployment: true. I think the task cannot specify the right staging deployment when the app has two staging deployments. So you'd better specify the deploymentName explicitly. e.g.

- task: AzureSpringCloud@0
  inputs:
    azureSubscription: 'My-Subscription'
    Action: 'Set Production'
    AzureSpringCloud: my-spring-cloud
    AppName: my-project
    DeploymentName: "blue"