Newer
Older

Daniel Lyons
committed
- build-packages

Andrew Kapuscinski
committed
- build
- unit-test

Andrew Kapuscinski
committed
- push

Andrew Kapuscinski
committed
- deploy

Andrew Kapuscinski
committed
# Gitlab optimization https://docs.gitlab.com/ee/ci/large_repositories/
GIT_DEPTH: 10
# Workspaces default variables

Andrew Kapuscinski
committed
DEPLOY_ENV: "dev"

Andrew Kapuscinski
committed
DL_HOST: https://dl-nrao.aoc.nrao.edu
# Postgres Service Variables
POSTGRES_DB: archive
POSTGRES_USER: "archive"
POSTGRES_PASSWORD: "docker"
image: docker:19.03.12

Andrew Kapuscinski
committed
workflow:
rules:
- if: $CI_MERGE_REQUEST_TITLE =~ /^WIP:|^Draft:/
when: never

Andrew Kapuscinski
committed
- if: $CI_MERGE_REQUEST_IID
- if: $CI_COMMIT_TAG
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /(^[0-9]\.[0-9]|^[0-9]\.[0-9]\.[0-9])-DEVELOPMENT/'

Andrew Kapuscinski
committed
# Import Templates
include:
- '/ci/build.template.yml'
- '/ci/push.template.yml'
- '/ci/cleanup.template.yml'
- '/ci/unit-test.template.yml'
- '/ci/package-build.template.yml'
- '/ci/push-package.template.yml'
# Unit testing steps require a specific database image to be available; this step downloads it

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
script:
- echo "$HARBOR_PASSWORD" | docker login --username "$HARBOR_USER" --password-stdin "$REGISTRY_URL"
- docker pull ${REGISTRY_URL}/workspaces/db:workspaces

Andrew Kapuscinski
committed
###############################################
# Build Python Packages
###############################################
build carta envoy:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/carta_envoy"

Brittany Faciane
committed
build casa envoy:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/casa_envoy"

Brittany Faciane
committed
build core sampler:
interruptible: true

Daniel Lyons
committed
stage: build-packages
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/utilities/core_sampler"
build conveyor:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/conveyor"

Brittany Faciane
committed
build deliver:

Daniel Lyons
committed
stage: build-packages

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/deliver"
build ingest envoy:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/ingest_envoy"

Brittany Faciane
committed
build mediator:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/mediator"

Brittany Faciane
committed
build null:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/null"

Brittany Faciane
committed
build productfetcher:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/productfetcher"

Brittany Faciane
committed
build update stage:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/update_stage"

Brittany Faciane
committed
build vela:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/vela"

Brittany Faciane
committed
build wf inspector:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/wf_inspector"

Brittany Faciane
committed
build ws annihilator:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/ws_annihilator"

Brittany Faciane
committed
build ws metrics:

Brittany Faciane
committed
interruptible: true

Daniel Lyons
committed
stage: build-packages

Brittany Faciane
committed
variables:

Daniel Lyons
committed
PACKAGE_PATH: "apps/cli/executables/pexable/ws_metrics"

Brittany Faciane
committed
###############################################
# Build Service and Web Images
###############################################

Andrew Kapuscinski
committed
build workflow:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: build
variables:
SERVICE_NAME: "workflow"
PATH_PREFIX: "services/"

Andrew Kapuscinski
committed
build capability:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: build
variables:
SERVICE_NAME: "capability"
PATH_PREFIX: "services/"

Andrew Kapuscinski
committed
build notification:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: build
variables:
SERVICE_NAME: "notification"
PATH_PREFIX: "services/"

Andrew Kapuscinski
committed
build web:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: build
variables:
SERVICE_NAME: "web"
PATH_PREFIX: "apps/"
extends: .build
###############################################
# Test Stages for Services
###############################################

Andrew Kapuscinski
committed
unit test workflow:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: unit-test
variables:
SERVICE_NAME: "workflow"
extends: .unit-test

Andrew Kapuscinski
committed
unit test capability:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: unit-test
variables:
SERVICE_NAME: "capability"
extends: .unit-test

Andrew Kapuscinski
committed

Andrew Kapuscinski
committed
unit test notification:

Andrew Kapuscinski
committed
interruptible: true

Andrew Kapuscinski
committed
stage: unit-test
variables:
SERVICE_NAME: "notification"
###############################################
# Create Coverage Report
###############################################

Andrew Kapuscinski
committed
interruptible: true
- pip install pytest pytest-cov

Andrew Kapuscinski
committed
- coverage combine --append
- coverage report -i --omit="**/test_*.py,**/_version.py,**/conftest.py,**/*interfaces.py" --skip-empty
- coverage xml -i --omit="**/test_*.py,**/_version.py,**/conftest.py,**/*interfaces.py" --skip-empty
- coverage html -i --omit="**/test_*.py,**/_version.py,**/conftest.py,**/*interfaces.py" --skip-empty
coverage_report:
coverage_format: cobertura
path: coverage.xml

Charlotte Hausman
committed
paths:
- htmlcov/

Andrew Kapuscinski
committed
- unit test workflow
- unit test capability
- unit test notification
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /(^[0-9]\.[0-9]|^[0-9]\.[0-9]\.[0-9])-DEVELOPMENT/'
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
###############################################
# Push Service and Web Images to Registry
###############################################

Andrew Kapuscinski
committed
push workflow:
stage: push

Andrew Kapuscinski
committed
variables:
SERVICE_NAME: "workflow"

Andrew Kapuscinski
committed
extends: .push

Andrew Kapuscinski
committed
push capability:
stage: push

Andrew Kapuscinski
committed
variables:
SERVICE_NAME: "capability"

Andrew Kapuscinski
committed
extends: .push

Andrew Kapuscinski
committed
push notification:
stage: push
variables:
SERVICE_NAME: "notification"

Andrew Kapuscinski
committed
push web:
stage: push
variables:
SERVICE_NAME: "web"
extends: .push
# UI tests coming soon!
# needs:
# - unit test dev ui
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
###############################################
# Push Packages
###############################################
push carta-envoy:
stage: push-packages
variables:
PACKAGE_NAME: "carta_envoy"
PIP_NAME: "carta-envoy"
extends: .push-packages
push casa-envoy:
stage: push-packages
variables:
PACKAGE_NAME: "casa_envoy"
PIP_NAME: "casa-envoy"
extends: .push-packages
push conveyor:
stage: push-packages
variables:
PACKAGE_NAME: "conveyor"
PIP_NAME: "conveyor"
extends: .push-packages
push deliver:
stage: push-packages
variables:
extends: .push-packages
push ingest-envoy:
stage: push-packages
variables:
PACKAGE_NAME: "ingest_envoy"
PIP_NAME: "ingest-envoy"
extends: .push-packages
push mediator:
stage: push-packages
variables:
extends: .push-packages
push null:
stage: push-packages
variables:
extends: .push-packages
push productfetcher:
stage: push-packages
variables:
PACKAGE_NAME: "productfetcher"
PIP_NAME: "productfetcher"
extends: .push-packages
push update-stage:
stage: push-packages
variables:
PACKAGE_NAME: "update_stage"
PIP_NAME: "ssa-update-stage"
extends: .push-packages
push vela:
stage: push-packages
variables:
PACKAGE_NAME: "vela"
extends: .push-packages
push wf-inspector:
stage: push-packages
variables:
PACKAGE_NAME: "wf_inspector"
PIP_NAME: "wf-inspector"
extends: .push-packages
push ws-annihilator:
stage: push-packages
variables:
PACKAGE_NAME: "ws_annihilator"
PIP_NAME: "ws-annihilator"
extends: .push-packages
push ws-metrics:
stage: push-packages
variables:
PACKAGE_NAME: "ws_metrics"
PIP_NAME: "ws-metrics"
extends: .push-packages
###############################################
# Clean Pipeline of Service and Web Images
###############################################
stage: .post
variables:
SERVICE_NAME: "workflow"

Andrew Kapuscinski
committed
allow_failure: true
stage: .post
variables:
SERVICE_NAME: "capability"

Andrew Kapuscinski
committed
allow_failure: true
clean build notification:
stage: .post
variables:
SERVICE_NAME: "notification"

Andrew Kapuscinski
committed
allow_failure: true
clean build web:
stage: .post
variables:
SERVICE_NAME: "web"
extends: .cleanup
allow_failure: true
###############################################
# Deployment Stages
###############################################

Andrew Kapuscinski
committed
interruptible: true
dependencies:
- unit test coverage
before_script:
- pip install -r docs/requirements.txt
- apt update
- apt install make
- mv htmlcov public/htmlcov
- cd docs && make html && mv _build/html/* ../public/
artifacts:
paths:
- public
expire_in: 2 weeks
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /(^[0-9]\.[0-9]|^[0-9]\.[0-9]\.[0-9])-DEVELOPMENT/'
before_script:
- apt update && apt install -y git
- pip install pyyaml
script:
- DEPLOY_ENV=${DEPLOY_ENV} ./ci/bin/generate-go-yaml.py
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /(^[0-9]\.[0-9]|^[0-9]\.[0-9]\.[0-9])-DEVELOPMENT/'
changes:
- apps/cli/executables/go/**/*
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'
variables:
# override DEPLOY_ENV
DEPLOY_ENV: "test"
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
variables:
DEPLOY_ENV: "prod"
artifacts:
paths:
- generated-go-build-pipeline.yml
# Trigger child pipeline based on generated go builder yaml
stage: go-trigger
trigger:
include:
- artifact: generated-go-build-pipeline.yml
job: go generate yaml
strategy: depend
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /(^[0-9]\.[0-9]|^[0-9]\.[0-9]\.[0-9])-DEVELOPMENT/'
changes:
- apps/cli/executables/go/**/*
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'
variables:
# override DEPLOY_ENV
DEPLOY_ENV: "test"
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
variables:
DEPLOY_ENV: "prod"

Andrew Kapuscinski
committed
stage: deploy
# Docker doesn't allow variable interpolation when declaring Docker Secret names
# This sed command finds and replaces "dsoc_ENV_secrets:" with "dsoc_${DEPLOY_ENV}_secrets:"
- sed -i "s/dsoc_ENV_secrets:/dsoc_${DEPLOY_ENV}_secrets:/g" docker-compose.yml
- sed -i "s/naasc_ENV_secrets:/naasc_${DEPLOY_ENV}_secrets:/g" docker-compose.yml
- ENV=$DEPLOY_ENV TAG=$IMAGE_TAG DL_HOST=$DL_HOST ENV_HOST=$ENV_HOST WS_VERSION=$VERSION BASE_REGISTRY_URL=$REGISTRY_URL docker stack deploy --compose-file docker-compose.yml --with-registry-auth workspaces-${DEPLOY_ENV}
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /(^[0-9]\.[0-9]|^[0-9]\.[0-9]\.[0-9])-DEVELOPMENT/'

Andrew Kapuscinski
committed
variables:
# override DEPLOY_ENV
DEPLOY_ENV: "dev"
# override DL_HOST
# override ENV_HOST
ENV_HOST: ws-dev.nrao.edu
VERSION: 0.0.1+$CI_COMMIT_BRANCH
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
# override DEPLOY_ENV
DEPLOY_ENV: "test"
# override DL_HOST
DL_HOST: https://dl-dsoc-test.nrao.edu
# override ENV_HOST
ENV_HOST: ws-test.nrao.edu
VERSION: 0.0.2+$CI_COMMIT_TAG
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'

Andrew Kapuscinski
committed
variables:
IMAGE_TAG: $CI_COMMIT_TAG
# override DEPLOY_ENV
DEPLOY_ENV: "test"
# override DL_HOST
DL_HOST: https://dl-dsoc-test.nrao.edu

Andrew Kapuscinski
committed
# override ENV_HOST

Andrew Kapuscinski
committed
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
# override DEPLOY_ENV
DEPLOY_ENV: "prod"
# override DL_HOST
DL_HOST: https://dl-dsoc.nrao.edu
# override ENV_HOST
ENV_HOST: ws.nrao.edu