I'm having the next issue:
I have a CI/CD process with the following AWS stack:
- Someone pushes a change into a CodeCommit repository
- A Lambda function is triggered
- A CodeBuild process runs to build my repository
The process works fine when a change is pushed in any branch (master and develop) but is not working if a git tag is pushed. So:
git push origin develop -> the Lambda function triggers and CodeBuild works fine
git push origin master -> the Lambda function triggers and CodeBuild works fine
git tag 1.0.0 git push --tags -> Nothing happen. The Lambda function is not triggering
The config for Lambda function is the following:
Branches: develop, master
Custom data: my-codebuild-project
Events: createReference, updateReference
Repository name: my-codecommit-repo
Service principal: codecommit.amazonaws.com
Statement ID: lambda-5b3c4bd9-921d-4ee7-9177-a7b1a1f8132c
Trigger name: my-lambda-trigger
Any ideas?
From the official AWS doc: You can create triggers for events you specify, such as when a commit is pushed to a repository. Event types include:
- all: for all events in the specified repository and branches.
- updateReference: for when commits are pushed to the specified repository and branches.
- createReference: for when a new branch or tag is created in the specified repository.
- deleteReference: for when a branch or tag is deleted in the specified repository.
So in theory, when i push a tag, the trigger must work if the event is configured by createReference.
Finally, i figured it out.
I had to set the setting Branches to “All Branches” instead of “Master” and “Develop”. For some reason pushing a tag only triggers the function if that setting is that way.