Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when running swap slot task due to task using unexpected parameter during execution #11410

Closed
Philo opened this issue Sep 24, 2019 · 5 comments · Fixed by #11823
Closed

Comments

@Philo
Copy link

Philo commented Sep 24, 2019

Type: BUG

Enter Task Name: Swap slots

Environment

  • Server - Azure Pipelines
  • Agent - Private (2016 Data center, agent version: 2.155.1)

Issue Description

We have began to encounter the following issue with release pipelines using the "Swap slots" task. This has only started happening today, with all previous releases working as expected without any pipelines updates.

The "Swap slots" task is failing with the following message:

2019-09-24T09:02:11.3402222Z ##[section]Starting: App : Swap Slot
2019-09-24T09:02:11.3581484Z ==============================================================================
2019-09-24T09:02:11.3581617Z Task         : Azure App Service manage
2019-09-24T09:02:11.3581712Z Description  : Start, stop, restart, slot swap, slot delete, install site extensions or enable continuous monitoring for an Azure App Service
2019-09-24T09:02:11.3581840Z Version      : 0.2.59
2019-09-24T09:02:11.3581907Z Author       : Microsoft Corporation
2019-09-24T09:02:11.3582013Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-app-service-manage
2019-09-24T09:02:11.3582102Z ==============================================================================
2019-09-24T09:02:12.0901116Z ##[error]Error: Failed to fetch App Service 'sample-app-$(arm.siteSlotName)' details. Error: The Resource 'Microsoft.Web/sites/sample-app/slots/$(arm.siteSlotName)' under resource group 'sample-app-rg' was not found. (CODE: 404)
2019-09-24T09:02:12.0939769Z ##[section]Finishing: App : Swap Slot

The error includes a variable $(arm.siteSlotName) that is not defined anywhere in the visible UI, however when exporting the pipeline and searching I have discovered the following:

{
    "environment": {},
    "taskId": "f045e430-8704-11e6-968f-e717e6411619",
    "version": "0.*",
    "name": "App : Swap Slot",
    "refName": "",
    "enabled": true,
    "alwaysRun": false,
    "continueOnError": false,
    "timeoutInMinutes": 0,
    "definitionType": "task",
    "overrideInputs": {},
    "condition": "succeeded()",
    "inputs": {
        "ConnectedServiceName": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "Action": "Swap Slots",
        "WebAppName": "$(arm.app_siteName)",
        "SpecifySlot": "true",
        "ResourceGroupName": "$(rg.name)",
        "SourceSlot": "$(arm.app_siteSlotName)",
        "SwapWithProduction": "true",
        "TargetSlot": "",
        "PreserveVnet": "false",
        "Slot": "$(arm.siteSlotName)",
        "ExtensionsList": "",
        "OutputVariable": "",
        "AppInsightsResourceGroupName": "",
        "ApplicationInsightsResourceName": "",
        "ApplicationInsightsWebTestName": ""
    }
}

Within this snippet the task action is Swap Slots, with the parameter SourceSlot shown in the UI and completed correctly. However, the Slot parameter is also listed and completed with a different variable. This is the case because we frequently copy and clone tasks within a pipeline and alter the action and update the parameters. I would appear that a recent update is causing the "Swap slots" task to fail due to this extra parameter not related to its own action:

image

If I change only the action for this task the following is displayed:

image

In order to workaround/fix this issue we have had to manual alter each task, switch the action, delete the value in Slot and re-save the pipeline.

@rorkea
Copy link

rorkea commented Nov 6, 2019

See the exact same behaviour when using the Task in a TaskGroup and passing in (or hardcoding) the slot in the taskgroup for Swap Slot operation compared with executing the task parameterless.

2019-11-04T19:30:43.3914894Z ##[section]Starting: Swap: sampleapp-test Webjob staging to production 2019-11-04T19:30:43.3985977Z ============================================================================== 2019-11-04T19:30:43.3986179Z Task : Azure App Service manage 2019-11-04T19:30:43.3986362Z Description : Start, stop, restart, slot swap, slot delete, install site extensions or enable continuous monitoring for an Azure App Service 2019-11-04T19:30:43.3986535Z Version : 0.2.61 2019-11-04T19:30:43.3986645Z Author : Microsoft Corporation 2019-11-04T19:30:43.3986805Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-app-service-manage 2019-11-04T19:30:43.3986987Z ============================================================================== 2019-11-04T19:30:44.4908632Z ##[error]Error: Failed to fetch App Service 'sampleapp-test-$(StagingSlot-Name)' details. Error: The Resource 'Microsoft.Web/sites/sampleapp-test/slots/$(StagingSlot-Name)' under resource group 'sample-rg' was not found. (CODE: 404) 2019-11-04T19:30:44.4939506Z ##[section]Finishing: Swap: sampleapp-test Webjob staging to production
Checked the YAML for the generated release and it exactly matches what I would expect for input variables.

@eaarora-ms eaarora-ms self-assigned this Nov 21, 2019
@eaarora-ms
Copy link
Contributor

@Philo I understand your issue that an extra variable named 'Slot' is being passed in the pipeline when Swap Slots is selected. However, since we are not using the Slot variable anywhere it should not throw an error agreed. I will look into it and get back to you.

@eaarora-ms
Copy link
Contributor

@Philo I understand your issue that an extra variable named 'Slot' is being passed in the pipeline when Swap Slots is selected. However, since we are not using the Slot variable anywhere it should not throw an error agreed. I will look into it and get back to you.

Able to repro the issue. Looking into it.

@eaarora-ms
Copy link
Contributor

The issue is fixed and will be rolled out in a couple of weeks. I hope this is not a blocker for you since you can remove and add the task again to get rid of the old slot name value.

@Philo
Copy link
Author

Philo commented Dec 4, 2019

Thank you @eaarora-ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants