saritasa-nest / saritasa-devops-helm-charts

Various helm charts
0 stars 0 forks source link

feat: add latest tag #100

Closed DanilaKazakevich closed 10 months ago

DanilaKazakevich commented 11 months ago

Summary

Task: https://saritasa.atlassian.net/browse/SD-373

Why?

It is needed for xrayimg project. We have develepment env on the project placed on PC in Krasnoyarsk office -> Hyper-V server -> Virtual machine -> docker compose. Also all future production servers will be created with in same way (VM and docker compose is 100%).

We deploy the new version of backend on the servers with watchtower. It checks AWS ECR for the new uploaded image and update running containers. The easiest way to do it is :latest tag. It is here: https://github.com/saritasa-nest/xrayimg-infra-aws/blob/feature/local-server/private/docker-compose.yaml#L12

How?

We can add both tags ${env}-${commit_hash} (i.e. :dev-dsjfh43) and :latest on the built image in tekton-pipelines.

It isn't default behaviour now. You must enable this by adding below code in triggerBinding:

        triggerBinding:
          - name: docker_registry_repository
            value: 833737135757.dkr.ecr.us-east-2.amazonaws.com/nmbl/staging/frontend
....
....
          - name: add_tag_latest
            value: 'true'

By default we will continue to push images only in ${env}-${commit_hash} format!

Exmaples:

NOTE: I decided to test it on ygm staging to don't affect rocks cluster, so don't be confused with it.

Output from buildpacks step:

Saving 190499200307.dkr.ecr.us-west-2.amazonaws.com/ygm/staging/backend:staging-802d5f2...
*** Images (sha256:9e15b5041fec79448e25948503ddd68ee8563d7d3bacacb4f3f20c1e5a23b891):
      190499200307.dkr.ecr.us-west-2.amazonaws.com/ygm/staging/backend:staging-802d5f2
      190499200307.dkr.ecr.us-west-2.amazonaws.com/ygm/staging/backend:latest

Some images: How parameter looks: latest_tag How images look in ECR: 2023-11-21_12-56