microsoft / azure-pipelines-tasks

Tasks for Azure Pipelines
https://aka.ms/tfbuild
MIT License
3.51k stars 2.62k forks source link

Deployment from Pipelines to Linux container doesn't copy files #11762

Closed M0ns1gn0r closed 5 years ago

M0ns1gn0r commented 5 years ago

Required Information

Type: Bug Enter Task Name: AzureFunctionApp@1

Environment

Issue Description

Repro:

Expected: the function app is deployed, the functions are displayed on the portal and can be executed. Actual: the app is not deployed, no functions on the portal, the target deployment location (watched via ftp) is empty.

(!) However, the deployment works if deployed from VS Code or if the Windows Consumption plan is selected.

Additional log:

2019-11-13T14:54:20.003Z - Updating submodules.
2019-11-13T14:54:20.013Z - Preparing deployment for commit id 'b7d91f35e4'.
2019-11-13T14:54:20.032Z - Skipping build. Project type: Run-From-Zip
2019-11-13T14:54:20.036Z - Skipping post build. Project type: Run-From-Zip
2019-11-13T14:54:20.049Z - Writing the artifacts to a squashfs file
2019-11-13T14:54:20.143Z - Parallel mksquashfs: Using 1 processor
2019-11-13T14:54:20.146Z - Creating 4.0 filesystem on /home/site/deployments/functionappartifact.squashfs, block size 131072.
2019-11-13T14:54:20.155Z - Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
2019-11-13T14:54:20.158Z -  compressed data, compressed metadata, compressed fragments, compressed xattrs
2019-11-13T14:54:20.160Z -  duplicates are removed
2019-11-13T14:54:20.167Z - Filesystem size 0.15 Kbytes (0.00 Mbytes)
2019-11-13T14:54:20.170Z -  99.37% of uncompressed filesystem size (0.15 Kbytes)
2019-11-13T14:54:20.177Z - Inode table size 29 bytes (0.03 Kbytes)
2019-11-13T14:54:20.181Z -  85.29% of uncompressed inode table size (34 bytes)
2019-11-13T14:54:20.184Z - Directory table size 0 bytes (0.00 Kbytes)
2019-11-13T14:54:20.187Z -  -nan% of uncompressed directory table size (0 bytes)
2019-11-13T14:54:20.190Z - Number of duplicate files found 0
2019-11-13T14:54:20.192Z - Number of inodes 1
2019-11-13T14:54:20.195Z - Number of files 0
2019-11-13T14:54:20.198Z - Number of fragments 0
2019-11-13T14:54:20.202Z - Number of symbolic links  0
2019-11-13T14:54:20.205Z - Number of device nodes 0
2019-11-13T14:54:20.209Z - Number of fifo nodes 0
2019-11-13T14:54:20.212Z - Number of socket nodes 0
2019-11-13T14:54:20.214Z - Number of directories 1
2019-11-13T14:54:20.217Z - Number of ids (unique uids + gids) 1
2019-11-13T14:54:20.220Z - Number of uids 1
2019-11-13T14:54:20.225Z -  root (0)
2019-11-13T14:54:20.228Z - Number of gids 1
2019-11-13T14:54:20.230Z -  root (0)
2019-11-13T14:54:20.249Z - Uploading built content /home/site/deployments/functionappartifact.squashfs -> <redacted>
2019-11-13T14:54:20.947Z - Resetting all workers for <redacted>.azurewebsites.net
2019-11-13T14:54:21.063Z - Updating /home/data/SitePackages/packagename.txt with deployment 20191113145419.zip
2019-11-13T14:54:21.079Z - Deployment successful.
2019-11-13T14:54:21.120Z - App container will begin restart within 10 seconds.

I don't known what is going on there ^. But suspicious are the sizes and the number of files. My actual artifact ZIP is 7MB.

eaarora-ms commented 5 years ago

@M0ns1gn0r Hi, I am sorry but I am not able to repro the issue. I followed your exact steps and the function app is deployed, the functions are displayed on the portal and can be executed. Can you check if your package is correct and if the issue continues please share the pipeline logs with system.debug set as true.

M0ns1gn0r commented 5 years ago

@eaarora-ms still reproduces, the package is correct because the same deployment pipeline does deploy to a windows function (I only change the value of my functionAppName variable).

Here is the log: DeploymentLog.txt

SumiranAgg commented 5 years ago

The logs are for windows app. Please share logs for Linux Function App as well.

M0ns1gn0r commented 5 years ago

For windows app? I am deploying a function app, there is no mention of windows in my pipeline:

- task: AzureFunctionApp@1
  displayName: 'Deploy visits'
  inputs:
    azureSubscription: '$(azureSubscription)'
    appType: functionApp
    appName: $(functionAppName)
    package: '$(Pipeline.Workspace)/drop/$(Build.BuildId).zip'
    appSettings: >
      -EventGridTopicKey $(eventGridTopicKey)
      -EventGridTopicHostName $(eventGridTopicHostName)
      -TopSecretThirdPartyApiKey "$(topSecretThirdPartyApiKey)"
eaarora-ms commented 5 years ago

@M0ns1gn0r appType:functionApp means that it is a windows function app. For Linux function app it is appType: functionAppLinux. Please check your pipeline variables and let us know if that is the cause of the problem. Just FYI, my YAML snippet looks like:

steps:
- task: AzureFunctionApp@1
  displayName: 'Azure Function App Deploy'
  inputs:
    azureSubscription: '$(azureSubscription)'
    appType: functionAppLinux
    appName: '$(azureSubscription)'
    package: '$(System.DefaultWorkingDirectory)/_adcf/Functions.zip'
M0ns1gn0r commented 5 years ago

It indeed works with appType: functionAppLinux.

@eaarora-ms Could you please make the task return an error in case the target system OS doesn't match this setting (or even better, auto-detect the OS)? The current ##[debug]Deployment Succeded message is misleading.

eaarora-ms commented 5 years ago

@M0ns1gn0r Sure will add that to our list of enhancements. Closing this.