CI/CD integration
If you want to deploy a third party project – you can use helm chart with hardcoded application version.But for own developed project this way is not really good. I am sure you will have hundreds of different versions for your application, dev builds, production builds and a lot of other builds (in best case – dedicated build for each issue from Jira)
How to get CI/CD API KEY
To get api key – click here:
How to use CI/CD API KEY
CI/CD integration is a simple webhook. You can call it from you CI/CD pipeline to send to unifie information about your new build.
Copy curl command example to you ci/cd pipeline.This code will work in gitlab pipeline.
This api call will add information about new build for project.
export SERVICE_NAME=MY_SERVICE_NAME
export DOCKER_IMAGE_NAME=059920143366.dkr.ecr.us-east-1.amazonaws.com/docker-static-images:$CI_PIPELINE_ID
curl --user project214:af2******8pu \
--data-urlencode "projectId=214" \
--data-urlencode "title=$CI_COMMIT_TITLE" \
--data-urlencode "message=$CI_COMMIT_MESSAGE" \
"http://test.unifie.cloud/versions/update?channel=Prod&name=$CI_COMMIT_BRANCH&build=$CI_PIPELINE_ID&image=$SERVICE_NAME&url=$DOCKER_IMAGE_NAME"
Execute it to send the first build.
CI/CD - API arguments
Parameter | Type | Description |
---|---|---|
projectId | number | Id for your project, will not change. |
title | string | New build title (It will be displayed in UI) |
message | string | New build description. In CI/CD it can be a commit message (It will be displayed in UI) |
channel | string | New build channel (Dev, Prod or other) |
name | string | New build name |
image | string | Service name in your application template. |
url | string | Docker image URL. For example for AWS ECR it can looks like 059920143366.dkr.ecr.us-east-1.amazonaws.com/ docker-helloworld:XXXX (Here XXXX is image tag) |
Add a new version
You can a new version for your app over UI or using API. If it is done - you can see it in this table.
How to use version in template
After you create at least one version. You can go to version tab and select version for the application.
It is the first part of your work. Selected version - just one more variable. You have to use the value of this variable in you deployment.
Docker service
If you use a Docker type service just mark this element
Kubernetes yaml service
Here UnifieVar.image.test
the full variable name, test
is the service name (parameter name
in api call)
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-test2
image: "{{ .UnifieVar.image.test }}"
ports:
- containerPort: 80