Skip to content
Snippets Groups Projects
Commit fd2784ed authored by Rivers, Travis (Contractor) Creighton's avatar Rivers, Travis (Contractor) Creighton
Browse files

new stuff

parent e9e3423f
No related branches found
No related tags found
1 merge request!2Gitlab tests2
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
.gitlab-ci.yml 0 → 100644
+ 213
0
View file @ fd2784ed
image: usgs/centos:8
stages:
- test
- integration
- deploy
variables:
CI_REGISTRY: ${CODE_REGISTRY}
CI_REGISTRY_IMAGE: ${CODE_REGISTRY_IMAGE}
## --------------------------------------------------
# Templates
## --------------------------------------------------
.adjust_image_names:
before_script:
- IMAGE_NAME=usgs/${APP_NAME}:${CI_COMMIT_REF_SLUG}
- IMAGE_NAME=${IMAGE_NAME/:master/:latest}
- INTERNAL_IMAGE_NAME=${CI_REGISTRY_IMAGE}/${IMAGE_NAME}
- STACK_NAME=${APP_NAME}
.build_docker_image:
cache: {}
extends:
- .adjust_image_names
image: ${CODE_REGISTRY}/ghsc/hazdev/cloud-formation/hazdev-build-runner:latest
only:
- master@ghsc/geomag/geomag-plots
- production@ghsc/geomag/geomag-plots
- tags@ghsc/geomag/geomag-plots
script:
- docker build
--pull
--build-arg APP_NAME=${APP_NAME}
--build-arg FROM_IMAGE=${FROM_IMAGE}
--build-arg GIT_BRANCH_NAME=${CI_COMMIT_REF_NAME}
--build-arg GIT_COMMIT_SHA=${CI_COMMIT_SHA}
--tag local/${IMAGE_NAME} .
- docker tag local/${IMAGE_NAME} ${IMAGE_NAME}
- docker push ${IMAGE_NAME}
- docker image rm ${IMAGE_NAME}
- docker tag local/${IMAGE_NAME} ${INTERNAL_IMAGE_NAME}
- docker push ${INTERNAL_IMAGE_NAME}
- docker image rm ${INTERNAL_IMAGE_NAME}
stage: integration
tags:
- build
variables:
FROM_IMAGE: ${CODE_REGISTRY}/devops/images/usgs/centos:latest
.check_code:
cache: {}
image: usgs/centos:latest
script:
- wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda config --set always_yes yes --set changeps1 no
- conda update --yes conda
- conda info -a
# Install Project Dependencies
- conda config --add channels conda-forge
- conda create -q -n test-environment python=${PYTHON_VERSION} obspy pycurl
- source activate test-environment
- pip install pipenv
- pipenv --site-packages install --dev
# Run Code Checks
- black --check .
- pytest
stage: test
tags:
- development
variables:
PYTHON_VERSION: 3.8
.deploy:
cache: {}
extends:
- .adjust_image_names
image: ${CODE_REGISTRY}/ghsc/hazdev/cloud-formation/hazdev-build-runner:latest
script:
- git clone ${GENERIC_SWARM_DEPLOY_REPO} generic-deploy
- export REGISTRY=${CI_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
.staging:
only:
- master@ghsc/geomag/geomag-plots
- tags@ghsc/geomag/geomag-plots
.staging01:
tags:
- staging01
.staging02:
tags:
- staging02
.mage:
variables:
USGS_ONLY: 'false'
.mage01:
tags:
- mage01
.production:
except:
- ^.*beta.*$
- ^.*-rc.*$
only:
- tags@ghsc/geomag/geomag-plots
- production@ghsc/geomag/geomag-plots
when: manual
.production01:
tags:
- production01
.production02:
tags:
- production02
## --------------------------------------------------
# Test Stage
## --------------------------------------------------
Check Python 3.6:
extends:
- .check_code
variables:
PYTHON_VERSION: 3.6
Check Python 3.7:
extends:
- .check_code
variables:
PYTHON_VERSION: 3.7
Check Python 3.8:
extends:
- .check_code
variables:
PYTHON_VERSION: 3.8
## --------------------------------------------------
# Integration Stage
## --------------------------------------------------
Build Algorithms Image:
extends:
- .build_docker_image
variables:
APP_NAME: geomag-algorithms
# TODO: Penetration testing (e.g. OWASP ZAP etc...)
## --------------------------------------------------
# Deploy Stage
## --------------------------------------------------
# Deploy Production01:
# extends:
# - .deploy
# - .production
# - .production01
# variables:
# APP_NAME: geomag-plots
# Deploy Production02:
# extends:
# - .deploy
# - .production
# - .production02
# variables:
# APP_NAME: geomag-plots
# Deploy Staging01:
# extends:
# - .deploy
# - .staging
# - .staging01
# variables:
# APP_NAME: geomag-plots
# Deploy Staging02:
# extends:
# - .deploy
# - .staging
# - .staging02
# variables:
# APP_NAME: geomag-plots
# Deploy Mage01:
# extends:
# - .deploy
# - .staging
# - .mage
# - .mage01
# variables:
# APP_NAME: geomag-plots
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment