diff --git a/.gitignore b/.gitignore index 68a4e9ad8f207845fd1e8dc40769e4871a7ba508..d314422a0ba01f015d53c7464d4c7220014630eb 100644 --- a/.gitignore +++ b/.gitignore @@ -79,6 +79,7 @@ services/**/**/testing tmp delivery_root lustre/ +pgdata/ # ignore local NGAS local_ngas_root/cache/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50618075bfd71767609b22a2e26082400f31ab0d..1a47bc45b685ac552e9f863a66449be56b3710cb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,6 @@ stages: - build-base - push-base - - run-schema - cache-build - build - unit-test @@ -11,7 +10,6 @@ stages: - deploy - e2e-test - .post - # - deploy-test variables: # Gitlab optimization https://docs.gitlab.com/ee/ci/large_repositories/ @@ -26,11 +24,6 @@ variables: POSTGRES_USER: "archive" POSTGRES_PASSWORD: "docker" -# CI Postgres Service -services: - - name: ssa-containers.aoc.nrao.edu/ops/ci/db:workspaces - alias: db - image: docker:19.03.12 workflow: @@ -72,19 +65,6 @@ push base image: - Dockerfile.base - docker.properties -# Run Schema -run schema: - stage: run-schema - image: ${REGISTRY_URL}/ops/base:${PROJECT_NAME} - script: - - export PGPASSWORD=$POSTGRES_PASSWORD - - cd schema && ./bin/run-migrations.sh "docker" - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - when: always - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - when: always - # Cache build cache: stage: cache-build @@ -177,6 +157,10 @@ unit test coverage: e2e: stage: e2e-test image: docker/compose:1.27.4 + # CI Postgres Service + services: + - name: ssa-containers.aoc.nrao.edu/ops/ci/db:workspaces + alias: db variables: ENV_HOST: workflow before_script: @@ -197,6 +181,7 @@ e2e: - docker logs workspaces_capability_1 - docker logs workspaces_workflow_1 - docker logs workspaces_web_1 + - docker network prune -f - docker-compose -f docker-compose.ci.yml down - docker image rm -f base-build:ci - docker image rm -f e2e:${CI_COMMIT_SHORT_SHA} diff --git a/ci/cleanup.template.yml b/ci/cleanup.template.yml index a36d24d9363945dd88dc3f0f82e61de7ffceaf07..6492c8b9aceb0d6be252ddff6038ddbb3bce7a2d 100644 --- a/ci/cleanup.template.yml +++ b/ci/cleanup.template.yml @@ -4,9 +4,8 @@ - NAME="${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}" - | printf "%s\n" "- Removing Images -" \ - "${NAME}:${TAG}" \ "${NAME}:${CI_COMMIT_SHORT_SHA}" - - docker image rm --force "${NAME}:${TAG}" "${NAME}:${CI_COMMIT_SHORT_SHA}" "cache:${CI_COMMIT_SHORT_SHA}" + - docker image rm --force "${NAME}:${CI_COMMIT_SHORT_SHA}" "cache:${CI_COMMIT_SHORT_SHA}" rules: - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_COMMIT_MESSAGE =~ /\A(?i)-debug/' when: never diff --git a/ci/unit-test.template.yml b/ci/unit-test.template.yml index 220b6fb255e6dcf26e3d0cb77c550e88d3f72421..c2e9e6da1124ebacda24012ca6a955d9e8afadf4 100644 --- a/ci/unit-test.template.yml +++ b/ci/unit-test.template.yml @@ -1,4 +1,8 @@ .unit-test: + # Postgres DB service + services: + - name: ssa-containers.aoc.nrao.edu/ops/ci/db:workspaces + alias: db image: ${REGISTRY_URL}/${PROJECT_NAME}/${SERVICE_NAME}:${CI_COMMIT_SHORT_SHA} script: - | diff --git a/schema/bin/run-migrations.sh b/schema/bin/run-migrations.sh index ee68be168865c1768a3bedb5f68a4c32957c788e..787d7d36f678da1205fd059f9886232372e806ab 100755 --- a/schema/bin/run-migrations.sh +++ b/schema/bin/run-migrations.sh @@ -6,6 +6,8 @@ set -e set -o pipefail +ARG="${$1:-docker}" + if [[ $# -eq 0 ]] ; then echo 'ERROR: run-migrations requires an argument for CAPO_PROFILE' exit 0 @@ -14,4 +16,4 @@ fi # Python library installation pip install -r requirements.txt -env CAPO_PROFILE=$1 alembic upgrade head +env CAPO_PROFILE=$ARG alembic upgrade head