Build Artifacts showing empty folder but build pipeline success - Azure Functions Python

krishna572 886 Reputation points
2023-06-11T04:04:30.61+00:00

I have the following Folder Structure in the Azure DevOps Repository:

enter image description here

Azure Functions Python Version 3.10 - Code available in my previous question #76412683

CI Pipeline (Build):

yaml
trigger:
- main
pool:
  vmImage: ubuntu-latest
steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.10'
    addToPath: true
    architecture: 'x64'
  displayName: 'Use Python 3.x'
- bash: |
   python3.10 -m venv worker_venev
   source worker venv/bin/activate
   pip3.10 install setuptools
   pip3.10 install --upgrade pip
   pip3.10 install -r requirements.txt
  displayName: 'Install Application Dependencies'
  
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.BinariesDirectory)'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true
  displayName: 'Archive azure_functions'
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'
  displayName: 'Publish Artifact: drop'

Result:

enter image description here

If I go to Artifacts, showing empty folder:

enter image description here enter image description here


Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2023-06-14T16:14:09.8933333+00:00

    Hi @krishna572

    I think you're getting empty contents because Build variables is not set properly. This variable is set to a directory of compiled binaries which Python doesn't have. You can use the upload-artifacts' and download-artifacts` actions instead.

    - name: Upload artifact for deployment jobs
      uses: actions/upload-artifact@v2
      with:
        name: python-app
        path: |
          . 
          !venv/
    
    - uses: actions/download-artifact@v2
      with:
        name: python-app
        path: .
    

    While this blog post refers to deploying a Python app to an app service, the same principals apply to function app.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.