Commit 7c6abeb2 authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

back to old version with minor fixes

parent a42ee1f2
Loading
Loading
Loading
Loading
+28 −85
Changes for .gitlab-ci.yml: 28 added lines, 85 removed lines.
Original line number Diff line number Diff line
stages:
  - test

# Maven image with JDK.
image: maven:3.9-eclipse-temurin-17

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
  # Default karate env if not set by job/rule
  KARATE_ENV: "dev-etsi"

cache:
@@ -17,125 +14,71 @@ cache:
.karate_test_template:
  stage: test
  timeout: 30 minutes

  # Overrides the global Ubuntu-based Maven image for these jobs.
  image: maven:3.9-eclipse-temurin-17-alpine

  tags:
    - hypo

  variables:
    CHROME_BIN: "/usr/bin/chromium"
    CHROMEDRIVER_BIN: "/usr/bin/chromedriver"

    - openslice-1.plugtests.net
  before_script:
    - mvn -version

    # Install Chromium and its matching ChromeDriver.
    - apk add --no-cache chromium chromium-chromedriver

    # -------------------------------------------------------------
    # Fix Java/Selenium resolution of the GitLab Runner hostname.
    # -------------------------------------------------------------
    - |
      RUNNER_HOSTNAME="$(hostname)"
      RUNNER_IP="$(hostname -I | awk '{print $1}')"

      echo "Runner hostname: ${RUNNER_HOSTNAME}"
      echo "Runner IP: ${RUNNER_IP}"

      if ! grep -qE "(^|[[:space:]])${RUNNER_HOSTNAME}([[:space:]]|$)" /etc/hosts; then
        echo "${RUNNER_IP:-127.0.0.1} ${RUNNER_HOSTNAME}" >> /etc/hosts
      fi

      echo "Hostname mapping:"
      grep "${RUNNER_HOSTNAME}" /etc/hosts

    # Verify browser and driver installation.
    - echo "Chromium path:" && command -v chromium
    - echo "ChromeDriver path:" && command -v chromedriver
    - chromium --version
    - chromedriver --version

    # Verify that Chromium starts correctly in the CI container.
    - |
      chromium \
        --headless=new \
        --no-sandbox \
        --disable-dev-shm-usage \
        --dump-dom \
        about:blank \
        > /tmp/chromium-smoke-test.html

    # Maven preparation.
    - mvn -q validate
    - mvn -q test-compile

    # Optional syntax/dry-run validation.
    - mvn -q test "-Dkarate.options=--dryrun"

  script:
    - >
      mvn test
      -Dkarate.env="$KARATE_ENV"
      "-Dkarate.options=$KARATE_OPTIONS"

  artifacts:
    when: always
    expire_in: 14 days

    paths:
      - target/karate-reports/
      - target/surefire-reports/

    reports:
      junit:
        - target/surefire-reports/TEST-*.xml
# 1) Smoke on Merge Requests
smoke:

# Portal E2E Test (uses Selenium Docker image)
orchestrator_portal:
  image: selenium/standalone-chrome:latest
  extends: .karate_test_template
  variables:
    KARATE_OPTIONS: "--tags @smoke-auth"
    KARATE_OPTIONS: "--tags @portal-login-test"
  script:
    - mvn test -Dkarate.env="$KARATE_ENV" "-Dkarate.options=$KARATE_OPTIONS"
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: on_success
    - when: never

# 2) Full regression on main branch
regression_main:
# Private Orchestrator
orchestrator_private:
  extends: .karate_test_template
  variables:
    KARATE_OPTIONS: "--tags @smoke-e2e-workflow-private"
  script:
    - mvn test -Dkarate.env="$KARATE_ENV" "-Dkarate.options=$KARATE_OPTIONS"
  needs: ["orchestrator_portal"]
  rules:
    - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"'
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: on_success
    - when: never

# 3) Nightly regression (run only via GitLab Schedules) ->Should create a Schedule in GitLab UI and set variable: KARATE_ENV=stage (recommended)
nightly_regression:
# Public Orchestrator
orchestrator_public:
  extends: .karate_test_template
  variables:
    KARATE_OPTIONS: "--tags @smoke-e2e-workflow-private"  
    KARATE_OPTIONS: "--tags @smoke-e2e-workflow-public"
  script:
    - mvn test -Dkarate.env="$KARATE_ENV" "-Dkarate.options=$KARATE_OPTIONS"
  needs: ["orchestrator_private"]
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: on_success
    - when: never

# 4) Full regression on this branch
regression_portal:
# OCM Orchestrator
orchestrator_ocm:
  extends: .karate_test_template

  variables:
    KARATE_OPTIONS: "--tags @portal-login-test"

    # This must correspond to:
    # src/test/java/env/dev-etsi.json
    KARATE_ENV: "dev-etsi"

    KARATE_OPTIONS: "--tags @smoke-e2e-workflow-ocm"
  script:
    - mvn test -Dkarate.env="$KARATE_ENV" "-Dkarate.options=$KARATE_OPTIONS"
  needs: ["orchestrator_public"]
  rules:
    - if: >
        $CI_COMMIT_BRANCH == "portal-and-stress-test" &&
        $CI_PIPELINE_SOURCE == "push"
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
      when: on_success

    - when: never
 No newline at end of file
+110 −740

File changed.

Preview size limit exceeded, changes collapsed.