Trigger Auto-Pipeline runs without a dummy commit

Trigger Auto-Pipeline runs without a dummy commit

Problem Faced:

We faced a situation, where we had a auto-pipeline for a microservice. We maintained 2 different repositories. One for the code and another for the k8 yaml files. So whenever we are changing a microservice (committing), pipeline will build the image and updates the k8 repository. Once k8 repository is changed it will trigger another pipeline to deploy the image to the pod.

Here comes the problem, if we faced any issue with the last deployment, we have to rerun the pipeline. To do that, we need to make a commit to the k8 yaml repository. Going with this approach, we have to change some content in the files (additional space, comma, some comments).

Solution:

Git is allowing us to push an empty commit without adding any staged files to the branch, by using one option --allow-empty during the git commit.

git commit --allow-empty -m "empty commit"

Demo:

So we will try to create a scenario to check this working,

1.Let us create a new repository,

image.png

2.After the first commit,

image.png

3.Empty commit,

image.png

4.Verifying the commit details in github,

image.png