Commit 8bcbbd7a authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

Merge changes from main

parents 76ca3693 3fa66007
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+170 −0
Original line number Diff line number Diff line
stages:
  - lint
  - get_images
  - update_values
  - package_publish

default:
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/docker:20.10.16

variables:
  GIT_DEPTH: 0
  TMF_API_URL: "https://labs.etsi.org/rep/api/v4/projects/470/registry/repositories/3021/tags?page=1&per_page=500"
  SONATA_URL: "https://labs.etsi.org/rep/api/v4/projects/479/registry/repositories/3031/tags?page=1&per_page=500"
  OSS_CLIENT_URL: "https://labs.etsi.org/rep/api/v4/projects/474/registry/repositories/3023/tags?page=1&per_page=500"
  PKG_MANAGER_URL: "https://labs.etsi.org/rep/api/v4/projects/478/registry/repositories/3033/tags?page=1&per_page=500"
  PORTAL_CART_URL: "https://labs.etsi.org/rep/api/v4/projects/465/registry/repositories/3041/tags?page=1&per_page=500" 
  TELEMETRY_CLIENT_URL: "https://labs.etsi.org/rep/api/v4/projects/475/registry/repositories/3028/tags?page=1&per_page=500"
  PEERING_API_URL: "https://labs.etsi.org/rep/api/v4/projects/468/registry/repositories/3014/tags?page=1&per_page=500"
  REGISTRY_API_URL: "https://labs.etsi.org/rep/api/v4/projects/469/registry/repositories/3018/tags?page=1&per_page=500"
  FABRIC_API_URL: "https://labs.etsi.org/rep/api/v4/projects/467/registry/repositories/3011/tags?page=1&per_page=500"
  PORTAL_URL: "https://labs.etsi.org/rep/api/v4/projects/466/registry/repositories/3038/tags?page=1&per_page=500"
  
lint:
  stage: lint
  image:
    name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/alpine/helm:3.17.2
    entrypoint: [""]
  script:
    - ls
    - cd charts
    - helm dep build hypo
    - helm lint hypo
  #rules:
  #  - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "schedule"'


get_images:
  stage: get_images
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/alpine:latest
  before_script:
    - apk update && apk add bash curl jq
  script:
    - |
      TMF_API=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $TMF_API_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      SONATA=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $SONATA_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      OSS_CLIENT=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $OSS_CLIENT_URL | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    #- |
    #  PKG_MANAGER=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $PKG_MANAGER_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      PORTAL_CART=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $PORTAL_CART_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      TELEMETRY_CLIENT=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $TELEMETRY_CLIENT_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      PEERING_API=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $PEERING_API_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      REGISTRY_API=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $REGISTRY_API_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    - |
      FABRIC_API=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $FABRIC_API_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
    #- |
    #  PORTAL=$(curl --header "PRIVATE-TOKEN: $GROUP_ACCESS_TOKEN" --url $PORTAL_URL | jq -r '.[].location'  | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)  
    - echo "TMF_API=$TMF_API" > build.env 
    - echo "SONATA=$SONATA" >> build.env
    - echo "PKG_MANAGER=labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/pkg-manager.helm/pkg-manager:latest" >> build.env
    - echo "OSS_CLIENT=$OSS_CLIENT" >> build.env
    - echo "PORTAL_CART=$PORTAL_CART" >> build.env
    - echo "TELEMETRY_CLIENT=$TELEMETRY_CLIENT" >> build.env
    - echo "PEERING_API=$PEERING_API" >> build.env
    - echo "REGISTRY_API=$REGISTRY_API" >> build.env
    - echo "FABRIC_API=$FABRIC_API" >> build.env
    - echo "PORTAL=labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/web/hypo-portal:latest" >> build.env
  artifacts:
    paths:
      - build.env
  #rules:
  #  - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "schedule"'


update_values:
  stage: update_values
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/python:3.9
  needs: 
    - get_images
  dependencies:
    - get_images
  before_script:
    - cat build.env
    - source build.env
    - echo $PKG_MANAGER
    - echo $OSS_CLIENT
    - echo $SONATA
    - echo $TMF_API
    - echo $PORTAL_CART
    - echo $TELEMETRY_CLIENT
    - echo $PEERING_API
    - echo $REGISTRY_API
    - echo $FABRIC_API
    - echo $PORTAL
    - python3 -m pip install ruamel.yaml
  script:
    #- echo "SKIP_PACKAGE=false" > skip.env
    - pwd
    - python3 scripts/helm_update_etsi.py $PKG_MANAGER $OSS_CLIENT $SONATA $TMF_API $PORTAL_CART $TELEMETRY_CLIENT $PEERING_API $REGISTRY_API $FABRIC_API $PORTAL --bump-chart --file=./charts/hypo/values.yaml
    - git add .
    - git config --global user.email $GITLAB_USER_EMAIL
    - git config --global user.name $GITLAB_USER_NAME
    - |
      if git commit -m "Update values.yaml [skip ci]"; then 
        git push -f "https://${GITLAB_USER_NAME}:${GROUP_ACCESS_TOKEN}@labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.ops/installer.git" HEAD:main

        git fetch origin

        git checkout gitops-cd
        git pull origin gitops-cd
        git fetch origin main
        git merge origin/main -m "Merge changes from main"
      
        git status
        git push -f "https://${GITLAB_USER_NAME}:${GROUP_ACCESS_TOKEN}@labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.ops/installer.git" HEAD:gitops-cd
      else
        echo "No changes to commit."
        #echo "SKIP_PACKAGE=true" > skip.env
      fi
  #artifacts:
  #  paths:
  #    - skip.env
  #rules:
  #  - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "schedule"'


package_publish:
  stage: package_publish
  allow_failure: true
  image:
    name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/alpine/helm:3.17.2
    entrypoint: [""]
  needs: 
    - update_values
  dependencies:
    - update_values
  variables:
    CHART: hypo
    HELM_EXPERIMENTAL_OCI: 1
  before_script:
    - git fetch origin
    - git reset --hard origin/main
    - helm registry login -u "${HELM_REGISTRY_USER}" -p "${HELM_REGISTRY_PASSWORD}" registry.ubitech.eu
    - helm plugin install --version=v0.9.0 https://github.com/chartmuseum/helm-push.git
    #- source skip.env
  script:
    #- 'if [ "$SKIP_PACKAGE" == "true" ]; then exit 0; fi'
    - cd charts
    - helm package ./${CHART}
    - CHART_TGZ=$(ls ${CHART}*.tgz | head -n1)
    - >
      curl --request POST
      --form "chart=@${CHART_TGZ}"
      --user "${HELM_REGISTRY_USER}:${HELM_REGISTRY_PASSWORD}"
      https://labs.etsi.org/rep/api/v4/projects/481/packages/helm/api/stable/charts
    - helm push ${CHART}*.tgz oci://labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/installer
    - VERSION=$(helm show chart ${CHART_TGZ} | grep '^version:' | awk '{print $2}') 
    - echo "$VERSION" > ../chart_version.txt
  artifacts:
    paths:
      #- skip.env
      - chart_version.txt
  #rules:
  #  - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "schedule"'
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: '2025.12.4'
version: '2026.6.1'

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
+27 −17
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@ portal:
    secret: "CHANGE_ME"

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/web/hypo-portal
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/web/hypo-portal
    pullPolicy: Always
    tag: "latest"

@@ -73,7 +74,8 @@ tmf-api:
  startup_spec_data: false

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/tmf/tmf-api-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/tmf/tmf-api-jvm
    pullPolicy: Always
    tag: "1.0.0"

@@ -124,7 +126,8 @@ pkg-manager:
  replicaCount: 1

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/pkg-manager.helm/pkg-manager
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/pkg-manager.helm/pkg-manager
    pullPolicy: Always
    tag: "latest"

@@ -167,9 +170,10 @@ oss-client:
  replicaCount: 1

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.clients/oss/oss-client-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.clients/oss/oss-client-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"

  imagePullSecrets:
  - name: regcred
@@ -223,9 +227,10 @@ sonata:
  name: sonata
  replicaCount: 1
  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/sonata/sonata-core-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/sonata/sonata-core-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"
  env:
    SONATA_VAULT_TOKEN_PATH: "/vault/secrets/token"

@@ -275,9 +280,10 @@ portal-cart:
  replicaCount: 1

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/cart/hypo-portal-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.portal/cart/hypo-portal-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"

  imagePullSecrets:
  - name: regcred
@@ -321,9 +327,10 @@ telemetry-client:
  replicaCount: 1

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.clients/telemetry/telemetry-api-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.clients/telemetry/telemetry-api-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"

  imagePullSecrets:
  - name: regcred
@@ -367,9 +374,10 @@ peering-api:
  replicaCount: 1

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/peering/peering-api-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/peering/peering-api-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"

  imagePullSecrets:
  - name: regcred
@@ -416,9 +424,10 @@ registry-api:
  replicaCount: 1

  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/registry/registry-api-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/registry/registry-api-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"

  imagePullSecrets:
  - name: regcred
@@ -459,9 +468,10 @@ fabric-api:
  name: fabric-api
  replicaCount: 1
  image:
    repository: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/fabric/fabric-api-jvm
    repository: 
      labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.api/fabric/fabric-api-jvm
    pullPolicy: Always
    tag: "latest"
    tag: "1.0.0"
  env:
    CONFIG_HYPO_DIAL_ROLE: "hypo_dial_x"
    FABRIC_POLLER_INTERVAL: "120s"
+10 −10
Original line number Diff line number Diff line
@@ -15,16 +15,16 @@ fi
PRIVATE_TOKEN="$1"

# Define the GitLab API URLs
  TMF_API_URL="https://gitlab.ubitech.eu/api/v4/projects/2255/registry/repositories/1934/tags?page=1&per_page=500"
  SONATA_URL="https://gitlab.ubitech.eu/api/v4/projects/2252/registry/repositories/1932/tags?page=1&per_page=500"
  OSS_CLIENT_URL="https://gitlab.ubitech.eu/api/v4/projects/2258/registry/repositories/1936/tags?page=1&per_page=500"
  PKG_MANAGER_URL="https://gitlab.ubitech.eu/api/v4/projects/2257/registry/repositories/1945/tags?page=1&per_page=500"
  PORTAL_CART_URL="https://gitlab.ubitech.eu/api/v4/projects/2261/registry/repositories/1938/tags?page=1&per_page=500" 
  TELEMETRY_CLIENT_URL="https://gitlab.ubitech.eu/api/v4/projects/2259/registry/repositories/1937/tags?page=1&per_page=500"
  PEERING_API_URL="https://gitlab.ubitech.eu/api/v4/projects/2246/registry/repositories/1931/tags?page=1&per_page=500"
  REGISTRY_API_URL="https://gitlab.ubitech.eu/api/v4/projects/2264/registry/repositories/1935/tags?page=1&per_page=500"
  FABRIC_API_URL="https://gitlab.ubitech.eu/api/v4/projects/2253/registry/repositories/1933/tags?page=1&per_page=500"
  PORTAL_URL="https://gitlab.ubitech.eu/api/v4/projects/2260/registry/repositories/1939/tags?page=1&per_page=500"
TMF_API_URL="https://labs.etsi.org/rep/api/v4/projects/470/registry/repositories/3021/tags?page=1&per_page=500"
SONATA_URL="https://labs.etsi.org/rep/api/v4/projects/479/registry/repositories/3031/tags?page=1&per_page=500"
OSS_CLIENT_URL="https://labs.etsi.org/rep/api/v4/projects/474/registry/repositories/3023/tags?page=1&per_page=500"
PKG_MANAGER_URL="https://labs.etsi.org/rep/api/v4/projects/478/registry/repositories/3033/tags?page=1&per_page=500"
PORTAL_CART_URL="https://labs.etsi.org/rep/api/v4/projects/465/registry/repositories/3041/tags?page=1&per_page=500"
TELEMETRY_CLIENT_URL="https://labs.etsi.org/rep/api/v4/projects/475/registry/repositories/3028/tags?page=1&per_page=500"
PEERING_API_URL="https://labs.etsi.org/rep/api/v4/projects/468/registry/repositories/3014/tags?page=1&per_page=500"
REGISTRY_API_URL="https://labs.etsi.org/rep/api/v4/projects/469/registry/repositories/3018/tags?page=1&per_page=500"
FABRIC_API_URL="https://labs.etsi.org/rep/api/v4/projects/467/registry/repositories/3011/tags?page=1&per_page=500"
PORTAL_URL="https://labs.etsi.org/rep/api/v4/projects/466/registry/repositories/3038/tags?page=1&per_page=500"

# Get TMF_API version
TMF_API=$(curl --header "PRIVATE-TOKEN: $PRIVATE_TOKEN" --url "$TMF_API_URL" | jq -r '.[].location' | grep -E '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)