Commit 58cc7ec1 authored by Kostis Trantzas's avatar Kostis Trantzas
Browse files

Merge branch '12-update-gitlab-ci-file-to-use-inherited-jobs-from-main' into 'develop'

Resolve "Update gitlab CI file to use inherited jobs from main"

See merge request !20
parents 93b1ce35 0903f065
Loading
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
stages:
  - deploy
include: 
  - ci-templates/default.yml
  - local: ci-templates/build.yml
    only:
      - main
      - develop
      
deploy:
  stage: deploy
  image: maven:3.9.5-ibm-semeru-17-focal
  script:
    - mvn deploy -s ci_settings.xml -DskipTests
  - local: ci-templates/build_unprotected.yml
    except:
      - main
      - develop

maven_build:
  extends: .maven_build

ci-templates/build.yml

0 → 100644
+41 −0
Original line number Diff line number Diff line
.maven_build:
  extends: .default
  stage: build
  image: maven:3.9.5-ibm-semeru-17-focal
  script:
    - mvn deploy -s ci_settings.xml -DskipTests -Dversion=$APP_VERSION
  artifacts:
    paths:
      - target/

.docker_build:
  extends: .default
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:$APP_VERSION"
    - |
      if [ "$CI_COMMIT_REF_NAME" = "main" ]; then
        echo "Pushing Docker image with tag 'latest'"
        /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:latest"
      fi

.angular_build:
  extends: .default
  stage: build
  image: trion/ng-cli:14.2.6
  script:
    - |
      if [ ! -f  "./src/assets/config/theming.scss" ]; then
          cp ./src/assets/config/theming.default.scss ./src/assets/config/theming.scss
      fi
      if [ ! -f  "./src/assets/config/config.prod.json" ]; then
          cp ./src/assets/config/config.prod.default.json ./src/assets/config/config.prod.json
      fi
    - npm install
    - ng build --configuration production --deleteOutputPath=false
  artifacts:
    paths:
      - dist/
+36 −0
Original line number Diff line number Diff line
.maven_build:
  extends: .default
  stage: build
  image: maven:3.9.5-ibm-semeru-17-focal
  script:
    - mvn install -s ci_settings.xml -DskipTests
  artifacts:
    paths:
      - target/

.docker_build:
  extends: .default
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:$APP_VERSION" --no-push

.angular_build:
  extends: .default
  stage: build
  image: trion/ng-cli:14.2.6
  script:
    - |
      if [ ! -f  "./src/assets/config/theming.scss" ]; then
          cp ./src/assets/config/theming.default.scss ./src/assets/config/theming.scss
      fi
      if [ ! -f  "./src/assets/config/config.prod.json" ]; then
          cp ./src/assets/config/config.prod.default.json ./src/assets/config/config.prod.json
      fi
    - npm install
    - ng build --configuration production --deleteOutputPath=false
  artifacts:
    paths:
      - dist/
+19 −0
Original line number Diff line number Diff line
stages:
  - .pre
  - build
  - test
  - post
  - security

.default:
  variables:
    DEFAULT_VERSION: "1.2.0-SNAPSHOT"
  before_script:
    - |
      if [ "$CI_COMMIT_REF_NAME" = "main" ] && [ -n "$CI_COMMIT_TAG" ]; then
        export APP_VERSION=$CI_COMMIT_TAG
      elif [ "$CI_COMMIT_REF_NAME" = "develop" ]; then
        export APP_VERSION="develop"
      else
        export APP_VERSION=$DEFAULT_VERSION
      fi