diff --git a/ci-templates/build.yml b/ci-templates/build.yml index 7c2be0d2cc397d05291646dd1c5a2b963bf2f834..7571d5b6b19070288bf078c799c61c7de424b0fa 100644 --- a/ci-templates/build.yml +++ b/ci-templates/build.yml @@ -1,5 +1,5 @@ .maven_build: - extends: .default + extends: .default_protected stage: build image: maven:3.9.5-ibm-semeru-17-focal script: @@ -9,7 +9,7 @@ - target/ .docker_build: - extends: .default + extends: .default_protected stage: build image: name: gcr.io/kaniko-project/executor:debug @@ -21,3 +21,14 @@ 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 2/2: + extends: .default_protected + stage: build + image: node:latest + script: + - npm install + - npm run build -- --prod + artifacts: + paths: + - dist/ diff --git a/ci-templates/build_unprotected.yml b/ci-templates/build_unprotected.yml new file mode 100644 index 0000000000000000000000000000000000000000..544b9e0c9447d12e4902a3b54bd7f65a8961e805 --- /dev/null +++ b/ci-templates/build_unprotected.yml @@ -0,0 +1,29 @@ +.maven_build: + extends: .default_unprotected + 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_unprotected + 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 2/2: + extends: .default_unprotected + stage: build + image: node:latest + script: + - npm install + - npm run build -- --dev + artifacts: + paths: + - dist/ diff --git a/ci-templates/default.yml b/ci-templates/default.yml index e27f7573618243658d7d69a7921e9bb07d03609a..f21a955aac67919ae88c6301eb08459ab5362d23 100644 --- a/ci-templates/default.yml +++ b/ci-templates/default.yml @@ -5,18 +5,28 @@ stages: - post - security +# Default configuration for all jobs .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" + +# Configuration for jobs on protected branches +.default_protected: + extends: .default + rules: + - if: $CI_COMMIT_REF_PROTECTED == "true" + +# Configuration for jobs on unprotected branches +.default_unprotected: + # extends: .default + variables: + APP_VERSION: $CI_COMMIT_REF_NAME + rules: + - if: $CI_COMMIT_REF_PROTECTED != "true" + artifacts: + expire_in: 1 day diff --git a/ci-templates/dependencies.yml b/ci-templates/dependencies.yml index 8ec3c9fc309ab0027b3f53abccc5f334b81359ba..26f6004651dd5edaa564ad01168533ccbb498931 100644 --- a/ci-templates/dependencies.yml +++ b/ci-templates/dependencies.yml @@ -1,5 +1,4 @@ install_node_dependencies: - stage: install image: node:latest script: - npm install