Skip to content
Snippets Groups Projects
.gitlab-ci.yml 9.13 KiB
variables:
  JACOCO_HTML_DIR: ${REPORTS_DIR}/jacoco/test/html
  JUNIT_FILES: build/test-results/test*/TEST-*.xml
  NSHMP_HAZ_WS_IMAGE: ${CODE_REGISTRY_IMAGE}/nshmp-haz-ws:${ENVIRONMENT}-${CI_COMMIT_SHORT_SHA}
  REPORTS_DIR: build/reports

image: ${CI_REGISTRY}/devops/images/usgs/java:11

# Do not run for merge requests
workflow:
  rules:
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH

stages:
  - build
  - test
  - trigger

default:
  tags:
    - nshmp

####
# Environment Templates
####

##
# Rule for development environment
##
.development-env: &development-env
  if: >
    $CI_PROJECT_PATH != $UPSTREAM_PATH
    || (
      $CI_PROJECT_PATH == $UPSTREAM_PATH
      && (
        $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH
        && $CI_COMMIT_BRANCH != 'production'
        && $CI_COMMIT_TAG == null
      )
    )
  variables:
    ENVIRONMENT: development

##
# Rule for staging environment
##
.staging-env: &staging-env
  if: >
    $CI_PROJECT_PATH == $UPSTREAM_PATH
    && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  variables:
    ENVIRONMENT: staging

##
# Rule for production envrionment
##
.production-env: &production-env
  if: >
    $CI_PROJECT_PATH == $UPSTREAM_PATH
    && (
      $CI_COMMIT_BRANCH == 'production'
      || ( $CI_COMMIT_TAG && $CI_COMMIT_TAG != '' )
    )
  variables:
    ENVIRONMENT: production

####
# Docker Templates
####