From a7ed4219abd16757079ce6eda674b590be366328 Mon Sep 17 00:00:00 2001 From: Dimitrios Giannopoulos <dimit.giannopoulos@upnet.gr> Date: Mon, 18 Dec 2023 16:47:19 +0000 Subject: [PATCH] fixed job inclusion --- .gitlab-ci.yml | 24 +----------------------- ci-templates/default.yml | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 ci-templates/default.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d7d16e..7bb1bcf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,26 +1,4 @@ -stages: - - .pre - - build - - test - - post - - security - -.default: - variables: - DEFAULT_TAG: "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_TAG - fi - rules: - - if: $CI_COMMIT_REF_NAME == "main" - - if: $CI_COMMIT_REF_NAME == "develop" - - if: $CI_COMMIT_REF_NAME == "12-create-a-pipeline-to-build-and-publish-the-docker-image-in-gitlab-registry" +include: ci-templates/build.yml maven_build: extends: .maven_build \ No newline at end of file diff --git a/ci-templates/default.yml b/ci-templates/default.yml new file mode 100644 index 0000000..99595b5 --- /dev/null +++ b/ci-templates/default.yml @@ -0,0 +1,23 @@ +stages: + - .pre + - build + - test + - post + - security + +.default: + variables: + DEFAULT_TAG: "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_TAG + fi + rules: + - if: $CI_COMMIT_REF_NAME == "main" + - if: $CI_COMMIT_REF_NAME == "develop" + - if: $CI_COMMIT_REF_NAME == "12-create-a-pipeline-to-build-and-publish-the-docker-image-in-gitlab-registry" \ No newline at end of file -- GitLab