EOX GitLab Instance

Skip to content
Snippets Groups Projects
.gitlab-ci.yml 9.06 KiB
Newer Older
variables:
  DOCKER_TLS_CERTDIR: ""

Mussab Abdalla's avatar
Mussab Abdalla committed
stages:
  - build
Lubomir Dolezal's avatar
Lubomir Dolezal committed
  - chart
Nikola Jankovic's avatar
Nikola Jankovic committed
  - deploy
build-tag:
  image: registry.gitlab.eox.at/esa/prism/vs/docker-base-testing:latest
  stage: build
  services:
    - docker:19.03.13-dind
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  script:
    - IMAGE_1="$CI_REGISTRY_IMAGE/pvs_core"
    - docker pull "$IMAGE_1":latest || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE_1":latest -t "$IMAGE_1":dev -t "$IMAGE_1":$CI_COMMIT_TAG core/
    - IMAGE_2="$CI_REGISTRY_IMAGE/pvs_preprocessor"
    - docker pull "$IMAGE_2":latest || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE_2":latest -t "$IMAGE_2":dev -t "$IMAGE_2":$CI_COMMIT_TAG preprocessor/
    - IMAGE_3="$CI_REGISTRY_IMAGE/pvs_client"
    - docker pull "$IMAGE_3":latest || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE_3":latest -t "$IMAGE_3":dev -t "$IMAGE_3":$CI_COMMIT_TAG client/
    - IMAGE_4="$CI_REGISTRY_IMAGE/pvs_cache"
    - docker pull "$IMAGE_4":latest || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE_4":latest -t "$IMAGE_4":dev -t "$IMAGE_4":$CI_COMMIT_TAG cache/
    - IMAGE_5="$CI_REGISTRY_IMAGE/fluentd"
    - docker pull "$IMAGE_5":latest || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE_5":latest -t "$IMAGE_5":dev -t "$IMAGE_5":$CI_COMMIT_TAG fluentd/
    - IMAGE_6="$CI_REGISTRY_IMAGE/pvs_ingestor"
    - docker pull "$IMAGE_6":latest || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE_6":latest -t "$IMAGE_6":dev -t "$IMAGE_6":$CI_COMMIT_TAG ingestor/
    - IMAGE_7="$CI_REGISTRY_IMAGE/pvs_sftp"
Mussab Abdalla's avatar
Mussab Abdalla committed
    - docker pull "$IMAGE_7":latest || true
    - docker build --cache-from "$IMAGE_7":latest -t "$IMAGE_7":dev -t "$IMAGE_7":$CI_COMMIT_TAG sftp/
Stephan's avatar
Stephan committed
    - IMAGE_8="$CI_REGISTRY_IMAGE/pvs_shibauth"
    - docker pull "$IMAGE_8":latest || true
    - docker build --cache-from "$IMAGE_8":latest -t "$IMAGE_8":dev -t "$IMAGE_8":$CI_COMMIT_TAG shibauth/
Nikola Jankovic's avatar
Nikola Jankovic committed
    # - cd ./testing && ./gitlab_test.sh
    # - if [ $? -ne 0 ]; then exit 1; fi  # actually fail build
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    # - cd -
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker push "$IMAGE_1":$CI_COMMIT_TAG
    - docker push "$IMAGE_2":$CI_COMMIT_TAG
    - docker push "$IMAGE_3":$CI_COMMIT_TAG
    - docker push "$IMAGE_4":$CI_COMMIT_TAG
    - docker push "$IMAGE_5":$CI_COMMIT_TAG
    - docker push "$IMAGE_6":$CI_COMMIT_TAG
Mussab Abdalla's avatar
Mussab Abdalla committed
    - docker push "$IMAGE_7":$CI_COMMIT_TAG
Stephan's avatar
Stephan committed
    - docker push "$IMAGE_8":$CI_COMMIT_TAG
build-master-staging:
  image: registry.gitlab.eox.at/esa/prism/vs/docker-base-testing:latest
Lubomir Dolezal's avatar
Lubomir Dolezal committed
  stage: build
  services:
    - docker:19.03.13-dind
Lubomir Dolezal's avatar
Lubomir Dolezal committed
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  script:
    - if [[ "$CI_COMMIT_BRANCH" = "master" ]] ; then TAG_USED="latest"; else TAG_USED="staging"; fi
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - IMAGE_1="$CI_REGISTRY_IMAGE/pvs_core"
    - docker pull "$IMAGE_1":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_1":"$TAG_USED" -t "$IMAGE_1":dev -t "$IMAGE_1":"$TAG_USED" core/
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - IMAGE_2="$CI_REGISTRY_IMAGE/pvs_preprocessor"
    - docker pull "$IMAGE_2":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_2":"$TAG_USED" -t "$IMAGE_2":dev -t "$IMAGE_2":"$TAG_USED" preprocessor/
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - IMAGE_3="$CI_REGISTRY_IMAGE/pvs_client"
    - docker pull "$IMAGE_3":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_3":"$TAG_USED" -t "$IMAGE_3":dev -t "$IMAGE_3":"$TAG_USED" client/
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - IMAGE_4="$CI_REGISTRY_IMAGE/pvs_cache"
    - docker pull "$IMAGE_4":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_4":"$TAG_USED" -t "$IMAGE_4":dev -t "$IMAGE_4":"$TAG_USED" cache/
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - IMAGE_5="$CI_REGISTRY_IMAGE/fluentd"
Mussab Abdalla's avatar
Mussab Abdalla committed
    - docker pull "$IMAGE_5":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_5":"$TAG_USED" -t "$IMAGE_5":dev -t "$IMAGE_5":"$TAG_USED" fluentd/
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - IMAGE_6="$CI_REGISTRY_IMAGE/pvs_ingestor"
    - docker pull "$IMAGE_6":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_6":"$TAG_USED" -t "$IMAGE_6":dev -t "$IMAGE_6":"$TAG_USED" ingestor/
    - IMAGE_7="$CI_REGISTRY_IMAGE/pvs_sftp"
Mussab Abdalla's avatar
Mussab Abdalla committed
    - docker pull "$IMAGE_7":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_7":latest -t "$IMAGE_7":dev -t "$IMAGE_7":"$TAG_USED" sftp/
Stephan's avatar
Stephan committed
    - IMAGE_8="$CI_REGISTRY_IMAGE/pvs_shibauth"
    - docker pull "$IMAGE_8":"$TAG_USED" || true
    - docker build --cache-from "$IMAGE_8":latest -t "$IMAGE_8":dev -t "$IMAGE_8":"$TAG_USED" shibauth/
Mussab Abdalla's avatar
Mussab Abdalla committed
    - cd ./testing && ./gitlab_test.sh
    - if [ $? -ne 0 ]; then exit 1; fi  # actually fail build
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    # - cd -
    - docker push "$IMAGE_1":"$TAG_USED"
    - docker push "$IMAGE_2":"$TAG_USED"
    - docker push "$IMAGE_3":"$TAG_USED"
    - docker push "$IMAGE_4":"$TAG_USED"
    - docker push "$IMAGE_5":"$TAG_USED"
    - docker push "$IMAGE_6":"$TAG_USED"
Mussab Abdalla's avatar
Mussab Abdalla committed
    - docker push "$IMAGE_7":"$TAG_USED"
Stephan's avatar
Stephan committed
    - docker push "$IMAGE_8":"$TAG_USED"
Lubomir Dolezal's avatar
Lubomir Dolezal committed
  only:
    - staging
    - master
  except:
    - tags
      - emg-pvs_database.txt
      - emg-pvs_preprocessor.txt
      - emg-pvs_registrar.txt
      - emg-pvs_renderer.txt
  image: registry.gitlab.eox.at/esa/prism/vs/docker-base-testing:latest
    - docker:19.03.13-dind
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  script:
Mussab Abdalla's avatar
Mussab Abdalla committed
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_core"
    - docker pull "$IMAGE":staging || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev core/
Mussab Abdalla's avatar
Mussab Abdalla committed
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_preprocessor"
    - docker pull "$IMAGE":staging || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev preprocessor/
Mussab Abdalla's avatar
Mussab Abdalla committed
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_client"
    - docker pull "$IMAGE":staging || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev client/
Mussab Abdalla's avatar
Mussab Abdalla committed
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_cache"
    - docker pull "$IMAGE":staging || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev cache/
    - IMAGE="$CI_REGISTRY_IMAGE/fluentd"
    - docker pull "$IMAGE":staging || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev fluentd/
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_ingestor"
    - docker pull "$IMAGE":staging || true
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev ingestor/
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_sftp"
    - docker pull "$IMAGE":staging || true
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev sftp/
Stephan's avatar
Stephan committed
    - IMAGE="$CI_REGISTRY_IMAGE/pvs_shibauth"
    - docker pull "$IMAGE":staging || true
    - docker build --cache-from "$IMAGE":staging -t "$IMAGE":dev shibauth/
Mussab Abdalla's avatar
Mussab Abdalla committed
    - cd ./testing && ./gitlab_test.sh
    - if [ $? -ne 0 ]; then exit 1; fi  # actually fail build
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - staging
    - master
      # - emg-pvs_cache.txt
      # - emg-pvs_client.txt
      - emg-pvs_database.txt
      # - emg-pvs_fluentd.txt
      # - emg-pvs_ingestor.txt
      - emg-pvs_preprocessor.txt
      # - emg-pvs_redis.txt
      - emg-pvs_registrar.txt
      - emg-pvs_renderer.txt
      # - emg-pvs_seeder.txt
      # - emg-pvs_sftp.txt
Nikola Jankovic's avatar
Nikola Jankovic committed

review-docs:
  image: python:3.8-slim
  stage: build
  script:
    - apt-get update && apt-get install -y build-essential rsync grsync git texlive-base texlive-latex-extra latexmk
Nikola Jankovic's avatar
Nikola Jankovic committed
    - git fetch origin
Nikola Jankovic's avatar
Nikola Jankovic committed
    - git branch -f master origin/master
    - git branch -f staging origin/staging
    - pip3 install sphinx sphinx_rtd_theme recommonmark sphinx-multiversion
    - cd documentation/operator-guide && make build
    - mv _build/html/ ../../public
    - cd ../user-guide && make build
    - mv _build/html/ ../../public/user
  artifacts:
    paths:
      - public
    expire_in: 1 week
  environment:
    name: review/$CI_COMMIT_REF_NAME
    url: "https://$CI_PROJECT_ROOT_NAMESPACE.pages.eox.at/-/prism/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/$CI_DEFAULT_BRANCH/index.html"
    on_stop: stop_review_app
    auto_stop_in: 1 week
  variables:
    PUBLIC_URL: "/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public"
  only:
    - branches
  except:
    - master
    - staging

stop_review_app:
  stage: deploy
  script: echo "stopping review"
  environment:
    name: review/$CI_COMMIT_REF_NAME
    action: stop
Nikola Jankovic's avatar
Nikola Jankovic committed
  only:
    - branches
  except:
    - master
    - staging
Nikola Jankovic's avatar
Nikola Jankovic committed

pages:
  image: python:3.8-slim
  stage: build
  script:
    - apt-get update && apt-get install -y build-essential rsync grsync git texlive-base texlive-latex-extra latexmk
Nikola Jankovic's avatar
Nikola Jankovic committed
    - git fetch origin
Nikola Jankovic's avatar
Nikola Jankovic committed
    - git branch -f master origin/master
    - git branch -f staging origin/staging
    - pip3 install sphinx sphinx_rtd_theme recommonmark sphinx-multiversion
    - cd documentation/operator-guide && make build
    - mv _build/html/ ../../public
    - cd ../user-guide && make build
    - mv _build/html/ ../../public/user
  artifacts:
    paths:
      - public
  only:
    - master
    - tags
    - staging
Lubomir Dolezal's avatar
Lubomir Dolezal committed

publish-helm-chart:
  image: devth/helm:v3.5.3
  stage: chart
  script:
    # push Helm chart
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - "upload_filename=$(helm package ./chart | sed 's/^Successfully packaged chart and saved it to: \\(.*\\)/\\1/')"
Lubomir Dolezal's avatar
Lubomir Dolezal committed
    - curl -u $HELM_CHART_REPOSITORY_CREDENTIALS -v -X POST https://charts-public.hub.eox.at/api/charts --data-binary "@${upload_filename}"
  only:
    - tags
    - staging