Commit e95fd05d authored by Vasilis Katopodis's avatar Vasilis Katopodis Committed by Nikos Psaromanolakis
Browse files

feat: migrate to ETSI environment

parent 08d5e821
Loading
Loading
Loading
Loading
Loading
+42 −44
Original line number Diff line number Diff line
@@ -7,18 +7,15 @@ stages:
  - image_build

default:
  image: registry.ubitech.eu/nsit/maestro-apps/golang:latest
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/golang:latest

variables:
  DOCKER_HOST: tcp://docker:2375
  DOCKER_TLS_CERTDIR: ""
  DOCKER_HOST: unix:///var/run/docker.sock
  DOCKER_DRIVER: overlay2
  DOCKER_API_VERSION: "1.41"
  
  IMAGE_NAME: "lcm"
  DOCKERFILE: "build/Dockerfile"
  
  GOPRIVATE: "${CI_SERVER_HOST}/*"
  GOPRIVATE: "${CI_SERVER_HOST}/rep/*"
  GONOSUMDB: "${CI_SERVER_HOST}/rep/*"
  SONAR_GO_COVERAGE: "${CI_PROJECT_DIR}/sonarQube"

.go-cache:
@@ -30,16 +27,20 @@ variables:

lint:
  stage: lint
  image: registry.ubitech.eu/nsit/maestro-apps/golangci/golangci-lint:v1.64
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/golangci/golangci-lint:v2.4.0
  extends: .go-cache
  tags:
    - hypo
  before_script:
    - mkdir -p ${SONAR_GO_COVERAGE}
    - echo "machine ${CI_SERVER_HOST} login gitlab-ci-token password ${CI_JOB_TOKEN}" > ~/.netrc
    - chmod 600 ~/.netrc
    - export GOPRIVATE="${CI_SERVER_HOST}/*"
    - export GOPRIVATE="${CI_SERVER_HOST}/rep/*"
    - export GONOSUMDB="${CI_SERVER_HOST}/rep/*"
    - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/rep/".insteadOf "https://${CI_SERVER_HOST}/rep/"
  script:
      - go mod download
      - golangci-lint run ./... --out-format checkstyle --print-issued-lines=true --print-linter-name=true | tee ${SONAR_GO_COVERAGE}/golanci-report.xml
      - golangci-lint run ./... --fast-only --output.checkstyle.path="${SONAR_GO_COVERAGE}/golanci-report.xml"
  artifacts:
    paths:
      - ${SONAR_GO_COVERAGE}
@@ -48,33 +49,32 @@ lint:

dev_image_build_job:
  stage: dev_image_build
  tags:
    - hypo
  image:
    name: registry.ubitech.eu/nsit/maestro-apps/docker:20.10.16
  services:
    - name: registry.ubitech.eu/nsit/maestro-apps/docker:20.10.16-dind
      command: [ "--tls=false" ]
      alias: docker
    name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/docker:29.1.3
  before_script:
    - docker info > /dev/null
    - echo -n "$MAESTRO_APPS_TOKEN" | docker login "$MAESTRO_APPS_REGISTRY" -u "$MAESTRO_APPS_USER" --password-stdin
    - docker pull registry.ubitech.eu/nsit/maestro-apps/golang:1.24
    - docker pull registry.ubitech.eu/nsit/maestro-apps/debian
    - docker info
    - echo -n "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
  script:
    - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
    - >
      docker build
      --pull
      --network host
      --build-arg USERNAME="$CI_REGISTRY_USER"
      --build-arg PASSWORD="$CI_JOB_TOKEN"
      --build-arg CI_SERVER_HOST="$CI_SERVER_HOST"
      -t $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA 
      -f $DOCKERFILE .
    - docker push $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA
      -t "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA"
      -f "$DOCKERFILE" .
    - docker push "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA"
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'

semantic_versioning_job:
  image: registry.ubitech.eu/nsit/maestro-apps/node:lts
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/node:lts
  stage: release
  tags:
    - hypo
  variables:
    GITLAB_TOKEN: $GROUP_ACCESS_TOKEN
  script:
@@ -98,29 +98,27 @@ semantic_versioning_job:

image_build_job:
  stage: image_build
  tags:
    - hypo
  image:
    name: registry.ubitech.eu/nsit/maestro-apps/docker:20.10.16
  services:
    - name: registry.ubitech.eu/nsit/maestro-apps/docker:20.10.16-dind
      command: [ "--tls=false" ]
      alias: docker
    name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/docker:29.1.3
  
  before_script:
    - docker info > /dev/null
    - RELEASE_VERSION=$(cat release_version.txt)
    - echo  $RELEASE_VERSION
    - echo "$RELEASE_VERSION"
    - if [ "$RELEASE_VERSION" = "no-release" ]; then exit 0; fi
    - echo -n "$MAESTRO_APPS_TOKEN" | docker login "$MAESTRO_APPS_REGISTRY" -u "$MAESTRO_APPS_USER" --password-stdin
    - docker pull registry.ubitech.eu/nsit/maestro-apps/golang:1.24
    - docker pull registry.ubitech.eu/nsit/maestro-apps/debian
    - echo -n "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
  script:
    - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
    - >
      docker build
      --pull
      --network host
      --build-arg USERNAME="$CI_REGISTRY_USER"
      --build-arg PASSWORD="$CI_JOB_TOKEN"
      --build-arg CI_SERVER_HOST="$CI_SERVER_HOST"
      -t $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA 
      -f $DOCKERFILE .
      -t "$CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA"
      -f "$DOCKERFILE" .
      
    - docker tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest
    - docker tag $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA $CI_REGISTRY_IMAGE/$IMAGE_NAME:$RELEASE_VERSION
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
            { "type": "perf", "hidden": true },
            { "type": "test", "hidden": true }
          ],
          "issueUrlFormat": "https://gitlab.ubitech.eu/maestro-v2/mdg-hypo/org.etsi.osl.hypo.core/org.etsi.osl.hypo.core.service.monitor/-/issues/{{id}}"
          "issueUrlFormat": "https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.core/service.monitor/-/issues/{{id}}"
        }
      }
    ],
@@ -24,7 +24,7 @@
    [
      "@semantic-release/gitlab",
      {
        "gitlabUrl": "https://gitlab.ubitech.eu"
        "gitlabUrl": "https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.core/service.monitor"
      }
    ],
    [

CHANGELOG.md

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
# 1.0.0 (2026-02-24)


### Bug Fixes

* initialize releaserc and changelog ([5eba01a](https://gitlab.ubitech.eu/maestro-v2/mdg-hypo/org.etsi.osl.hypo.core/org.etsi.osl.hypo.core.service.monitor/commit/5eba01a82968a9c4341f79afd340eaca7ac3cd11))


### Features

* initialize project migration to hypo group ([c23ec6a](https://gitlab.ubitech.eu/maestro-v2/mdg-hypo/org.etsi.osl.hypo.core/org.etsi.osl.hypo.core.service.monitor/commit/c23ec6af4ef6d1c97f3237d990aff6dd77dd76d9))
+19 −26
Original line number Diff line number Diff line
# cd ..
# docker build -t <some tag> -f ./build/Dockerfile.dev .

FROM mirror.gcr.io/golang:1.24.2 AS builder
FROM labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.core/pkg-manager.helm/golang:1.25 AS builder

# Access token and host for fetching private Go modules
ARG USERNAME
@@ -10,42 +10,35 @@ ARG CI_SERVER_HOST

WORKDIR /app

# Dynamically set GOPRIVATE based on the server host
ENV GOPRIVATE="${CI_SERVER_HOST}/*"
# Configure Go for private GitLab modules
ENV GOPRIVATE="${CI_SERVER_HOST}/rep/*"
ENV GONOSUMDB="${CI_SERVER_HOST}/rep/*"
ENV GOPROXY="https://proxy.golang.org,direct"

# Setup .netrc using the server host and credentials (with secure permissions)
# Configure authentication for private repositories
RUN echo "machine ${CI_SERVER_HOST} login ${USERNAME} password ${PASSWORD}" > /root/.netrc && \
    chmod 600 /root/.netrc
    chmod 600 /root/.netrc && \
    git config --global url."https://${USERNAME}:${PASSWORD}@${CI_SERVER_HOST}/rep/".insteadOf "https://${CI_SERVER_HOST}/rep/" && \
    go env -w \
        GOPRIVATE="${CI_SERVER_HOST}/rep/*" \
        GONOSUMDB="${CI_SERVER_HOST}/rep/*" \
        GOPROXY="https://proxy.golang.org,direct"

COPY ./go.mod ./go.sum ./
# Download Go modules
COPY go.mod go.sum ./

RUN go clean -modcache && \
    go mod download

# Copy source code
COPY ./*.yml ./
COPY ./main.go ./
COPY cmd ./cmd/
COPY ./cmd ./cmd/

RUN go build -o ./binary
# Build binary
RUN CGO_ENABLED=0 GOOS=linux go build -o ./binary

# FROM debian:bookworm

# RUN groupadd -g 999 appuser && \
#     useradd -r -u 999 -g appuser appuser
# USER appuser

# COPY --from=builder /app/binary /binary
# COPY --from=builder /app/service.example.yml /service.yml

# RUN chown appuser:appuser ./binary
# RUN chown appuser:appuser ./service.yml

# RUN chmod 0755 ./binary
# RUN chmod 0755 ./service.yml

# COPY ./service.example.yml ./service.yml

# Fix linux rights
# Fix permissions
RUN chmod +x ./binary

CMD ["./binary"]
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -6,8 +6,8 @@ import (
	"sync"
	"time"

	"gitlab.ubitech.eu/maestro-v2/mdg-hypo/org.etsi.osl.hypo.core/org.etsi.osl.hypo.core.service.monitor/cmd/datamodels/messages"
	corev1 "k8s.io/api/core/v1"
	"labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.core/service.monitor/cmd/datamodels/messages"
)

type watchDataIndex struct {
Loading