Release after every tag push
Buddy lets you automatically build, test and release your application whenever a tag is pushed to the repository. This article will tell you how to configure a delivery pipeline triggered on this condition in Buddy.
The first step towards deployment automation is adding a new project and selecting the repository from which you want to upload. You can choose GitHub, Bitbucket or GitLab repository, as well as any other custom Git repo: Creating a new project
Once the project is synchronized, you can add a new pipeline. The most important thing is to set it up to run only when a new tag is pushed to the repository. To do that, set the trigger mode to On events, click + to add Git push event, then select Wildcard, and customize the
refs/tags pattern that will trigger the pipeline.
refs/tags/v*will only deploy the tags starting with
v, such as
v2, and so on.
Adding a new pipeline
After specifying when and for which tags the pipeline will be triggered, we are ready to define what exactly should be executed.
The pipeline below will:
- Run unit tests on repository code
- Build a Docker image from the tested code
- Run the image to check if everything works properly
- Push the image to a Docker registry if all steps above have succeeded Pipeline example
The core principle of Continuous Integration is testing every change pushed to the repository, tags included. Buddy lets you automatically test your application before the release with build actions which are basically isolated testing environments. For example, if your application is based on Node, you just need to select Node from the action roster and configure its details: Environment customization
The next step is dockerizing the application. To do that, select the Build Image action from the Docker section. There you need to indicate the Dockerfile in your repository and the build context path (optional): Build Docker image action configuration
Now we need to make sure the Docker image that we built is working okay. For that, we shall use the Run Docker Image action. The action lets you run commands in the selected Docker container. Make sure to select the image built in the previous build action, just as it's shown below: Run Docker image environment settings
The last step is pushing the image to the registry. Select Push image and configure the action details. Buddy has native integrations with Docker Hub, Amazon ECR, and Google GCR. You can also select your own private registry.
$BUDDY_EXECUTION_TAGvariable in the Tags to apply field.
Push Docker Image action configuration
Last modified on June 1, 2023