What ultimately fixed my issue was making some changes in the default build and release variables. Because my code was inside a hierarchy within the repo and the default script makes assumption on code being located in the root directory of the repo - it caused the artifacts to deploy incorrectly. Note that the build script is sensitive to capitalization - so the names of the folders have to match exactly in the build script. Below are some pointers I noted for my team based on my experience last year. I am not sure if they are applicable to you or the current version of DevOps you may be using.
For reference below is what my repo looked like. Note that I created my repo first, then cloned it locally before building the function application. This is why this hierarchy was created:
Azure Function Dev Ops Build Pipeline & Repo
- Artifact building and repo considerations: When the Repo is initially created in VS CODE, the function will be created as a directory within the repo. The Build Pipeline will require modifications to build from the function application folder, and not the repo. The folder for the function application that is being deployed needs to be explicitly named in the tasks of the build pipeline. Here are the places where the name must be updated. The name must match exactly in capitalization and spacing.
- Build extensions script should look as the following but replace with your Function Name:
#Function name and Function Application Directory is "ProjectParamSearch" if [ -f extensions.csproj ] then dotnet build extensions.csproj --output ./bin fi pip install --target="./ProjectParamSearch/.python_packages/lib/site-packages" -r ./ProjectParamSearch/requirements.txt
- Archive Files, root folder needs to be changed from the Default: $(System.DefaultWorkingDirectory) to the following: $(System.DefaultWorkingDirectory)/ProjectParamSearch
NOTE that "ProjectParamSearch" would be replaced with your specific Function Application Directory Name
- Agent job must be "ubuntu latest"
- Python Versions in artifact build:
Using any of the templates (YAML or Classic) to create a pipeline will default to python versions 3.6. However, if you are using VS Code to build your Function Application, it will default to the latest version python version. Any reference to the version will have to be manually updated to match up with your local code. If it's not changed, the library files installed during the build may not be the latest ones.
Release pipeline considerations
- Run Agent Tasks, Package configuration will require to be changed to match your directory within the repo. Example you may have the default:
$(System.DefaultWorkingDirectory)/**/*.zip
- To match your repo/directory, for example: $(System.DefaultWorkingDirectory)/_ProjectParamSearch/drop/*.zip