Loading ci-templates/build.yml +13 −2 Original line number Original line Diff line number Diff line .maven_build: .maven_build: extends: .default extends: .default_protected stage: build stage: build image: maven:3.9.5-ibm-semeru-17-focal image: maven:3.9.5-ibm-semeru-17-focal script: script: Loading @@ -9,7 +9,7 @@ - target/ - target/ .docker_build: .docker_build: extends: .default extends: .default_protected stage: build stage: build image: image: name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug Loading @@ -21,3 +21,14 @@ echo "Pushing Docker image with tag 'latest'" echo "Pushing Docker image with tag 'latest'" /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:latest" /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:latest" fi fi .angular_build 2/2: extends: .default_protected stage: build image: node:latest script: - npm install - npm run build -- --prod artifacts: paths: - dist/ ci-templates/build_unprotected.yml 0 → 100644 +29 −0 Original line number Original line Diff line number Diff line .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/ ci-templates/default.yml +17 −7 Original line number Original line Diff line number Diff line Loading @@ -5,18 +5,28 @@ stages: - post - post - security - security # Default configuration for all jobs .default: .default: variables: DEFAULT_TAG: "1.2.0-SNAPSHOT" before_script: before_script: - | - | if [ "$CI_COMMIT_REF_NAME" = "main" ] && [ -n "$CI_COMMIT_TAG" ]; then if [ "$CI_COMMIT_REF_NAME" = "main" ] && [ -n "$CI_COMMIT_TAG" ]; then export APP_VERSION=$CI_COMMIT_TAG export APP_VERSION=$CI_COMMIT_TAG elif [ "$CI_COMMIT_REF_NAME" = "develop" ]; then elif [ "$CI_COMMIT_REF_NAME" = "develop" ]; then export APP_VERSION="develop" export APP_VERSION="develop" else export APP_VERSION=$DEFAULT_TAG fi fi # rules: # - if: $CI_COMMIT_REF_NAME == "main" # Configuration for jobs on protected branches # - if: $CI_COMMIT_REF_NAME == "develop" .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 ci-templates/dependencies.yml +0 −1 Original line number Original line Diff line number Diff line install_node_dependencies: install_node_dependencies: stage: install image: node:latest image: node:latest script: script: - npm install - npm install Loading
ci-templates/build.yml +13 −2 Original line number Original line Diff line number Diff line .maven_build: .maven_build: extends: .default extends: .default_protected stage: build stage: build image: maven:3.9.5-ibm-semeru-17-focal image: maven:3.9.5-ibm-semeru-17-focal script: script: Loading @@ -9,7 +9,7 @@ - target/ - target/ .docker_build: .docker_build: extends: .default extends: .default_protected stage: build stage: build image: image: name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug Loading @@ -21,3 +21,14 @@ echo "Pushing Docker image with tag 'latest'" echo "Pushing Docker image with tag 'latest'" /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:latest" /kaniko/executor --context "${CI_PROJECT_DIR}" --dockerfile "${CI_PROJECT_DIR}/Dockerfile" --destination "${CI_REGISTRY_IMAGE}:latest" fi fi .angular_build 2/2: extends: .default_protected stage: build image: node:latest script: - npm install - npm run build -- --prod artifacts: paths: - dist/
ci-templates/build_unprotected.yml 0 → 100644 +29 −0 Original line number Original line Diff line number Diff line .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/
ci-templates/default.yml +17 −7 Original line number Original line Diff line number Diff line Loading @@ -5,18 +5,28 @@ stages: - post - post - security - security # Default configuration for all jobs .default: .default: variables: DEFAULT_TAG: "1.2.0-SNAPSHOT" before_script: before_script: - | - | if [ "$CI_COMMIT_REF_NAME" = "main" ] && [ -n "$CI_COMMIT_TAG" ]; then if [ "$CI_COMMIT_REF_NAME" = "main" ] && [ -n "$CI_COMMIT_TAG" ]; then export APP_VERSION=$CI_COMMIT_TAG export APP_VERSION=$CI_COMMIT_TAG elif [ "$CI_COMMIT_REF_NAME" = "develop" ]; then elif [ "$CI_COMMIT_REF_NAME" = "develop" ]; then export APP_VERSION="develop" export APP_VERSION="develop" else export APP_VERSION=$DEFAULT_TAG fi fi # rules: # - if: $CI_COMMIT_REF_NAME == "main" # Configuration for jobs on protected branches # - if: $CI_COMMIT_REF_NAME == "develop" .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
ci-templates/dependencies.yml +0 −1 Original line number Original line Diff line number Diff line install_node_dependencies: install_node_dependencies: stage: install image: node:latest image: node:latest script: script: - npm install - npm install