Commit 750d4a34 authored by Christos Tranoris's avatar Christos Tranoris
Browse files

adding cicd related files

parent 754d27a8
Loading
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+1 −0
Original line number Diff line number Diff line
/target/

.gitlab-ci.yml

0 → 100644
+14 −0
Original line number Diff line number Diff line
include: 
  - ci-templates/default.yml

  - local: ci-templates/build.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME == "main" || $CI_COMMIT_REF_NAME == "develop" || $CI_COMMIT_REF_PROTECTED'

  - local: ci-templates/build_unprotected.yml
    rules:
      - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "develop" && !$CI_COMMIT_REF_PROTECTED'


maven_build:
  extends: .maven_build

.project

0 → 100644
+23 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>org.etsi.osl.controllers.sylva</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.m2e.core.maven2Builder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>org.eclipse.jdt.core.javanature</nature>
		<nature>org.eclipse.m2e.core.maven2Nature</nature>
	</natures>
</projectDescription>

ci-templates/build.yml

0 → 100644
+24 −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 -Dversion=$APP_VERSION
  artifacts:
    paths:
      - target/

.docker_build:
  extends: .default
  stage: build
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
  script:
    - export DOCKER_TAG=$APP_VERSION
    - |
      if [ "$CI_COMMIT_REF_NAME" = "main" ]; then
        echo "Pushing Docker image with tag 'latest'"
        export DOCKER_TAG=latest
      fi
    - /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:$DOCKER_TAG"
+17 −0
Original line number Diff line number Diff line
stages:
  - .pre
  - build
  - test
  - post
  - security

.default:
  before_script:
    - |
      if [ "$CI_COMMIT_REF_PROTECTED" = true ] && [ -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=$CI_COMMIT_REF_NAME
      fi