From c04126f7a9ff46b9c96cd4e05a04d42232629f30 Mon Sep 17 00:00:00 2001
From: Kalin Daskalov <kalin.daskalov@vereign.com>
Date: Fri, 15 Dec 2023 14:44:58 +0200
Subject: [PATCH] Add automatic tag fetching from remote repo

---
 .gitlab-ci.yml |  13 ++++--
 Chart.yaml     |   4 +-
 README.md      | 115 +++++++++++++++++++++++++------------------------
 3 files changed, 70 insertions(+), 62 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0d37952..fd1f04b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,7 @@ variables:
 
 stages:
   - test
+  - getinfo
   - build
   - manifest
   - lint
@@ -15,11 +16,10 @@ stages:
 
 include:
   - project: "${HELPERS_PATH}"
-    file: 'build-eclipse.yml'
+    file: "build-eclipse.yml"
   - template: "Workflows/Branch-Pipelines.gitlab-ci.yml"
   - project: "${HELPERS_PATH}"
-    file: 'helm-eclipse.yml'
-
+    file: "helm-eclipse.yml"
 
 lint:
   image: golangci/golangci-lint:latest
@@ -60,6 +60,11 @@ govulncheck:
     - go install golang.org/x/vuln/cmd/govulncheck@latest
     - govulncheck ./...
 
+check_commit:
+  extends: .check_commit
+  stage: getinfo
+  tags:
+    - amd64-docker
 amd64:
   extends: .docker-build
   stage: build
@@ -67,7 +72,7 @@ amd64:
     - amd64-docker
 
 manifest:
-  extends: .manifest-amd64
+  extends: .manifest
   stage: manifest
 
 cloud:
diff --git a/Chart.yaml b/Chart.yaml
index 3e0ae41..ec0b0a4 100644
--- a/Chart.yaml
+++ b/Chart.yaml
@@ -1,6 +1,6 @@
 apiVersion: v1
-appVersion: v2.0.3
+appVersion: v1.1.0
 description: cache deployment
 name: cache
-version: 2.0.3
+version: 1.1.0
 icon: "https://www.vereign.com/wp-content/themes/vereign2020/images/vereign-logo.svg"
diff --git a/README.md b/README.md
index 387565b..41b3599 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
-# cache
+![GitLab tag (self-managed)](https://img.shields.io/gitlab/v/tag/eclipse%2Fxfsc%2Ftsa%2Fcache?gitlab_url=https%3A%2F%2Fgitlab.eclipse.org&logo=gitlab&label=Latest%20Eclipse%20Tag)
+
+![GitLab tag (self-managed)](https://img.shields.io/gitlab/v/tag/gaiax%2Ftsa%2Fcache-helm?gitlab_url=https%3A%2F%2Fcode.vereign.com&logo=gitlab&label=Latest%20Local%20Tag&labelColor=grey&color=orange)
 
-![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![AppVersion: v1.0.1-rc](https://img.shields.io/badge/AppVersion-v1.0.1--rc-informational?style=flat-square)
+# cache
 
 ## Deployment
 
@@ -9,63 +11,64 @@ The pipeline in this repo builds image from the source code repo in eclipse as a
 ### From main branch
 
 When changes to helm or the app are made and deployment is needed, execute the following steps:
-1. Clone the repo and start working on a new branch.
-2. Execute `git submode update --remote --recursive -init` to update source to latest commit on eclipse main branch.
+
 1. Edit `Chart.yaml` with the new chart version (example: 1.4.3) and app version it's intended to use (example: v1.4.3).
-2. Create a new tag with the intended app version (v1.4.3)
-3. Wait for pipelines to finish and manually trigger deployment to either `dev-ssi` or `prod-ssi(vault)` clusters.
+2. Create merge request from the update branch.
+3. Create a new tag from main branch with the intended chart version (1.4.3)
+4. Wait for pipelines to finish and manually trigger deployment to either `dev-ssi` or `prod-ssi(vault)` clusters.
 
 ## Values
 
-| Key | Type | Default | Description |
-|-----|------|---------|-------------|
-| autoscaling.enabled | bool | `false` | Enable autoscaling |
-| autoscaling.maxReplicas | int | `3` | Maximum replicas |
-| autoscaling.minReplicas | int | `1` | Minimum replicas |
-| autoscaling.targetCPUUtilizationPercentage | int | `70` | CPU target for autoscaling trigger |
-| autoscaling.targetMemoryUtilizationPercentage | int | `70` | Memory target for autoscaling trigger |
-| cache.http.host | string | `""` |  |
-| cache.http.port | int | `8080` |  |
-| cache.http.timeout.idle | string | `"120s"` |  |
-| cache.http.timeout.read | string | `"10s"` |  |
-| cache.http.timeout.write | string | `"10s"` |  |
-| cache.nats.subject | string | `"external_cache_events"` |  |
-| cache.nats.url | string | `"nats.ocm:4222"` |  |
-| image.name | string | `"gaiax/cache"` | Image name |
-| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
-| image.pullSecrets | string | `"deployment-key-light"` | Image pull secret when internal image is used |
-| image.repository | string | `"eu.gcr.io/vrgn-infra-prj"` |  |
-| image.sha | string | `""` | Image sha, usually generated by the CI Uses image.tag if empty |
-| image.tag | string | `""` | Image tag Uses .Chart.AppVersion if empty |
-| ingress.annotations."cert-manager.io/cluster-issuer" | string | `"letsencrypt-production-http"` |  |
-| ingress.annotations."kubernetes.io/ingress.class" | string | `"nginx"` |  |
-| ingress.annotations."kubernetes.io/ingress.global-static-ip-name" | string | `"dev-light-public"` |  |
-| ingress.annotations."nginx.ingress.kubernetes.io/rewrite-target" | string | `"/$2"` |  |
-| ingress.enabled | bool | `true` |  |
-| ingress.frontendDomain | string | `"gaiax.vereign.com"` |  |
-| ingress.frontendTlsSecretName | string | `"cert-manager-tls"` |  |
-| ingress.tlsEnabled | bool | `true` |  |
-| log.encoding | string | `"json"` |  |
-| log.level | string | `"debug"` |  |
-| metrics.enabled | bool | `true` | Enable prometheus metrics |
-| metrics.port | int | `2112` | Port for prometheus metrics |
-| name | string | `"cache"` | Application name |
-| nameOverride | string | `""` | Ovverwrites application name |
-| podAnnotations | object | `{}` |  |
-| redis.addr | string | `"redis-public-master.infra:6379"` |  |
-| redis.db | int | `0` |  |
-| redis.expiration | string | `"1h"` |  |
-| redis.pass | string | `""` |  |
-| redis.user | string | `""` |  |
-| replicaCount | int | `1` | Default number of instances to start  |
-| resources.limits.cpu | string | `"150m"` |  |
-| resources.limits.memory | string | `"128Mi"` |  |
-| resources.requests.cpu | string | `"25m"` |  |
-| resources.requests.memory | string | `"64Mi"` |  |
-| security.runAsGid | int | `0` | Group used by the apps |
-| security.runAsNonRoot | bool | `false` | by default, apps run as non-root |
-| security.runAsUid | int | `0` | User used by the apps |
-| service.port | int | `8080` |  |
+| Key                                                               | Type   | Default                            | Description                                                    |
+| ----------------------------------------------------------------- | ------ | ---------------------------------- | -------------------------------------------------------------- |
+| autoscaling.enabled                                               | bool   | `false`                            | Enable autoscaling                                             |
+| autoscaling.maxReplicas                                           | int    | `3`                                | Maximum replicas                                               |
+| autoscaling.minReplicas                                           | int    | `1`                                | Minimum replicas                                               |
+| autoscaling.targetCPUUtilizationPercentage                        | int    | `70`                               | CPU target for autoscaling trigger                             |
+| autoscaling.targetMemoryUtilizationPercentage                     | int    | `70`                               | Memory target for autoscaling trigger                          |
+| cache.http.host                                                   | string | `""`                               |                                                                |
+| cache.http.port                                                   | int    | `8080`                             |                                                                |
+| cache.http.timeout.idle                                           | string | `"120s"`                           |                                                                |
+| cache.http.timeout.read                                           | string | `"10s"`                            |                                                                |
+| cache.http.timeout.write                                          | string | `"10s"`                            |                                                                |
+| cache.nats.subject                                                | string | `"external_cache_events"`          |                                                                |
+| cache.nats.url                                                    | string | `"nats.ocm:4222"`                  |                                                                |
+| image.name                                                        | string | `"gaiax/cache"`                    | Image name                                                     |
+| image.pullPolicy                                                  | string | `"IfNotPresent"`                   | Image pull policy                                              |
+| image.pullSecrets                                                 | string | `"deployment-key-light"`           | Image pull secret when internal image is used                  |
+| image.repository                                                  | string | `"eu.gcr.io/vrgn-infra-prj"`       |                                                                |
+| image.sha                                                         | string | `""`                               | Image sha, usually generated by the CI Uses image.tag if empty |
+| image.tag                                                         | string | `""`                               | Image tag Uses .Chart.AppVersion if empty                      |
+| ingress.annotations."cert-manager.io/cluster-issuer"              | string | `"letsencrypt-production-http"`    |                                                                |
+| ingress.annotations."kubernetes.io/ingress.class"                 | string | `"nginx"`                          |                                                                |
+| ingress.annotations."kubernetes.io/ingress.global-static-ip-name" | string | `"dev-light-public"`               |                                                                |
+| ingress.annotations."nginx.ingress.kubernetes.io/rewrite-target"  | string | `"/$2"`                            |                                                                |
+| ingress.enabled                                                   | bool   | `true`                             |                                                                |
+| ingress.frontendDomain                                            | string | `"gaiax.vereign.com"`              |                                                                |
+| ingress.frontendTlsSecretName                                     | string | `"cert-manager-tls"`               |                                                                |
+| ingress.tlsEnabled                                                | bool   | `true`                             |                                                                |
+| log.encoding                                                      | string | `"json"`                           |                                                                |
+| log.level                                                         | string | `"debug"`                          |                                                                |
+| metrics.enabled                                                   | bool   | `true`                             | Enable prometheus metrics                                      |
+| metrics.port                                                      | int    | `2112`                             | Port for prometheus metrics                                    |
+| name                                                              | string | `"cache"`                          | Application name                                               |
+| nameOverride                                                      | string | `""`                               | Ovverwrites application name                                   |
+| podAnnotations                                                    | object | `{}`                               |                                                                |
+| redis.addr                                                        | string | `"redis-public-master.infra:6379"` |                                                                |
+| redis.db                                                          | int    | `0`                                |                                                                |
+| redis.expiration                                                  | string | `"1h"`                             |                                                                |
+| redis.pass                                                        | string | `""`                               |                                                                |
+| redis.user                                                        | string | `""`                               |                                                                |
+| replicaCount                                                      | int    | `1`                                | Default number of instances to start                           |
+| resources.limits.cpu                                              | string | `"150m"`                           |                                                                |
+| resources.limits.memory                                           | string | `"128Mi"`                          |                                                                |
+| resources.requests.cpu                                            | string | `"25m"`                            |                                                                |
+| resources.requests.memory                                         | string | `"64Mi"`                           |                                                                |
+| security.runAsGid                                                 | int    | `0`                                | Group used by the apps                                         |
+| security.runAsNonRoot                                             | bool   | `false`                            | by default, apps run as non-root                               |
+| security.runAsUid                                                 | int    | `0`                                | User used by the apps                                          |
+| service.port                                                      | int    | `8080`                             |                                                                |
+
+---
 
-----------------------------------------------
 Autogenerated from chart metadata using [helm-docs v1.10.0](https://github.com/norwoodj/helm-docs/releases/v1.10.0)
-- 
GitLab