-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Description
I have set up a CI/CD pipeline in Azure DevOps for my Azure Function (written in GoLang) that seems to run successfully, including steps for building, packaging, and deploying the function. However, despite the successful deployment, the function does not get triggered when the associated Event Subscription receives events.
Pipeline Configuration
`trigger:
- main
pool:
vmImage: 'ubuntu-latest'
variables:
directory: '.'
functionAppName: ''
resourceGroupName: ''
azureSubscription: 'Microsoft Azure Sponsorship (***)'
stages:
-
stage: Build
displayName: 'Build Stage'
jobs:- job: BuildJob
displayName: 'Build Function App'
steps:-
task: GoTool@0
inputs:
version: '1.21.0'
displayName: 'Installing Go 1.21.0' -
script: |
echo "Construindo a aplicação..."
GOOS=linux GOARCH=amd64 go build -o $(directory)/main
workingDirectory: $(directory)
displayName: 'Build Application Binary' -
script: |
echo "Zip the project folder"
zip -r config.zip .
workingDirectory: $(directory)
displayName: 'Zip the project folder' -
task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(directory)/config.zip'
artifactName: 'drop'
publishLocation: 'Container'
-
- job: BuildJob
-
stage: Deploy
displayName: 'Deploy Stage'
dependsOn: Build
condition: succeeded('Build')
jobs:- job: DeployJob
displayName: 'Deploy Function App'
steps:-
task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'drop'
downloadPath: '$(System.ArtifactsDirectory)' -
script: |
ls $(System.ArtifactsDirectory)/drop/
ls $(System.ArtifactsDirectory)/
displayName: 'Check if necessary zip is in the right directory' -
task: AzureCLI@2
inputs:
azureSubscription: $(azureSubscription)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az functionapp deployment source config-zip --resource-group$(resourceGroupName) --name $ (functionAppName) --src $(System.ArtifactsDirectory)/drop/config.zip
displayName: 'Deploy via Azure CLI'
`` -
task: AzureCLI@2
inputs:
azureSubscription: $(azureSubscription)
scriptType: 'bash'
scriptLocation: 'inlineScript'
inlineScript: |
az functionapp deployment list-publishing-profiles --name$(functionAppName) --resource-group $ (resourceGroupName)
displayName: 'Verify deploy via Azure CLI'
`
-
- job: DeployJob
host.json
{ "version": "2.0", "logging": { "logLevel": { "Function": "Information", "Host.Results": "Information", "Host.Aggregator": "Information", "FunctionApp": "Information" } }, "extensionBundle": { "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[3.*, 4.0.0)" }, "customHandler": { "description": { "defaultExecutablePath": "main", "workingDirectory": "", "arguments": [] } } }
function.json
{
"bindings": [
{
"type": "eventGridTrigger",
"name": "eventGridEvent",
"direction": "in"
}
]
}
Issue Observed:
The pipeline completes successfully without any errors, and the deployment seems to be working fine.
However, the function does not trigger when the Event Subscription receives an event.
Attempts to Resolve:
I have verified that the Event Subscription is correctly configured and pointing to the function.
The function works as expected when deployed manually or tested locally.
There are no errors or issues in the Azure portal regarding the function or the Event Subscription.
Seeking Guidance:
Is there something I'm missing in my pipeline configuration that could cause this issue?
Are there any known issues with Azure Functions (especially custom handlers in GoLang) not being triggered by Event Subscriptions after a pipeline deployment?
Any guidance or suggestions on what else I can check or how to troubleshoot this further would be greatly appreciated.