diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a1455086cecb275c5133ed093bd818b84b2e8f2f..1feca4cedfa6abc28ea874a11cbc401b199be242 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,6 @@ variables: JACOCO_HTML_DIR: build/reports/jacoco/test/html JUNIT_FILES: build/test-results/test/TEST-*.xml - GIT_NSHMP_USERNAME: ${GITLAB_USER_EMAIL} - GIT_NSHMP_PASSWORD: ${GITLAB_API_TOKEN} include: - project: 'ghsc/hazdev/pipeline-build-template' @@ -11,7 +9,7 @@ include: stages: - build - - deploy + - publish #### # Templates @@ -25,62 +23,17 @@ stages: .docker-build: extends: - - .build + - .dind + - .tags::build + script: + - ./scripts/gitlab-ci/docker-build.sh variables: DOCKER_BUILD_ARGS: | BUILD_IMAGE=${DEVOPS_REGISTRY}usgs/java:11 FROM_IMAGE=${DEVOPS_REGISTRY}usgs/java:11 ci_job_token=${CI_JOB_TOKEN} - git_username=${GITLAB_USER_EMAIL} - git_password=${GITLAB_API_TOKEN} - -.templates: - # TODO: Remove tag "beta" when ready - adjust-ref: &adjust-ref | - if [[ \ - ${CI_COMMIT_REF_SLUG} == "master" || \ - ${CI_COMMIT_REF_SLUG} == "production" || \ - -n "${CI_COMMIT_TAG}" \ - ]]; then - CI_COMMIT_REF_SLUG="beta"; - else - CI_COMMIT_REF_SLUG="beta--${CI_COMMIT_REF_SLUG}" - fi - -.deploy: - cache: {} - image: ${CODE_REGISTRY}/ghsc/hazdev/cloud-formation/hazdev-build-runner:latest - dependencies: - script: - - *adjust-ref - - git clone ${GENERIC_SWARM_DEPLOY_REPO} generic-deploy - - export REGISTRY=${CODE_REGISTRY_IMAGE} - - cp -v - generic-deploy/default.config.sh - generic-deploy/default.funcs.sh - generic-deploy/deploy.sh - scripts/. - - scripts/deploy.sh - stage: deploy - tags: - - deploy - - swarm - variables: - APP_NAME: nshmp-haz - STACK_NAME: nshmp-haz - -.onprem-staging: - only: - - master@ghsc/nshmp/nshmp-haz-v2 - - tags@ghsc/nshmp/nshmp-haz-v2 - -.staging01: - tags: - - staging01 - -.staging02: - tags: - - staging02 + DOCKERFILE: Dockerfile + IMAGE_NAME: ${CI_PROJECT_NAME} #### # Stage: build @@ -120,22 +73,15 @@ Unit Tests: Build Haz Image: extends: - .docker-build - before_script: - - apk add git - - *adjust-ref variables: - CI_PROJECT_NAME: nshmp-haz + IMAGE_NAME: nshmp-haz Build WS Image: extends: - .docker-build - before_script: - - mv Dockerfile haz.Dockerfile - - mv ws.Dockerfile Dockerfile - - *adjust-ref - - apk add git variables: - CI_PROJECT_NAME: nshmp-haz-ws + IMAGE_NAME: nshmp-haz-ws + DOCKERFILE: ws.Dockerfile #### # Stage: Publish @@ -144,14 +90,14 @@ Build WS Image: Maven: extends: .gradle - stage: deploy + stage: publish only: - tags@ghsc/nshmp/nshmp-ws script: - ./gradlew publish -P version=${CI_COMMIT_TAG} Trigger nshmp-deploy: - stage: deploy + stage: publish only: - master@ghsc/nshmp/nshmp-haz-v2 - tags@ghsc/nshmp/nshmp-haz-v2 @@ -162,19 +108,3 @@ Trigger nshmp-deploy: -F token=${NSHMP_DEPLOY_TRIGGER_TOKEN} \ -F ref=master \ https://code.chs.usgs.gov/api/v4/projects/5047/trigger/pipeline - -#### -# Stage: Deploy -#### - -# Staging 01: -# extends: -# - .deploy -# - .staging -# - .staging01 - -# Staging 02: -# extends: -# - .deploy -# - .staging -# - .staging02