Skip to content
Snippets Groups Projects
Commit ac43795c authored by Adam Fekete's avatar Adam Fekete
Browse files

cleanup

parent e00eef92
No related branches found
No related tags found
1 merge request!121Draft: Resolve "Refactoring the infrastructure"
# default installed image for docker executor is: python:3.6 image: gitlab-registry.mpcdf.mpg.de/nomad-lab/nomad-fair/ci-runner
# using an image that can do git, docker, docker-compose
# https://docs.gitlab.com/ee/ci/docker/using_docker_build.html
image: docker:dind
variables: # variables:
GIT_SUBMODULE_STRATEGY: recursive # DEV_IMAGE: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG}
APP_REGISTRY: gitlab-registry.mpcdf.mpg.de/nomad-lab/aitoolkit-app # STAGING_IMAGE: ${CI_REGISTRY_IMAGE}:staging
DEVELOP_REGISTRY: gitlab-registry.mpcdf.mpg.de/nomad-lab/aitoolkit-develop
stages: stages:
- build - build
- deploy - deploy
- release
build to develop: build to develop:
stage: build stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_UPDATE_FLAGS: --jobs 4
before_script: before_script:
- echo "Building the single user notebook image" - echo "Building the single user notebook image"
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker info # - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN gitlab-registry.mpcdf.mpg.de
script: # - docker info
# Using cache to speed up the build process # Using cache to speed up the build process
- docker pull ${CI_REGISTRY_IMAGE}:develop || true # - docker pull ${STAGING_IMAGE} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:develop --tag ${CI_REGISTRY_IMAGE}:develop${CI_COMMIT_SHORT_SHA} --tag ${CI_REGISTRY_IMAGE}:develop --tag ${DEVELOP_REGISTRY}:develop${CI_COMMIT_SHORT_SHA} --tag ${DEVELOP_REGISTRY}:develop .
- docker push ${CI_REGISTRY_IMAGE}:develop${CI_COMMIT_SHORT_SHA}
- docker push ${CI_REGISTRY_IMAGE}:develop
- docker login -u ai_toolkit -p ${AI_TOOLKIT_TOKEN} ${DEVELOP_REGISTRY}
- docker push ${DEVELOP_REGISTRY}:develop${CI_COMMIT_SHORT_SHA}
- docker push ${DEVELOP_REGISTRY}:develop
rules:
# Execute jobs when a new commit is pushed to develop branch
- if: $CI_COMMIT_BRANCH == "develop"
build to staging:
stage: build
before_script:
- echo "Building the single user notebook image"
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker info
script: script:
# Using cache to speed up the build process --cache-from ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} # Using cache to speed up the build process --cache-from ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
- docker pull ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} || true - docker build -t ${DEV_IMAGE} .
- docker build --tag ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}${CI_COMMIT_SHORT_SHA} --tag ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME} . - docker push ${DEV_IMAGE}
- docker push ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}${CI_COMMIT_SHORT_SHA}
- docker push ${CI_REGISTRY_IMAGE}:${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}
rules: rules:
# Execute jobs when a new commit is pushed to master branch # Execute jobs when a new commit is pushed to master branch
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
build to production: build to staging:
stage: build stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_UPDATE_FLAGS: --jobs 4
before_script: before_script:
- echo "Building the single user notebook image" - echo "Building the single user notebook image"
- echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
- docker info
script: script:
# Using cache to speed up the build process - docker build -t ${STAGING_IMAGE} .
- docker pull ${CI_REGISTRY_IMAGE}:latest || true - docker push ${STAGING_IMAGE}
- docker build --cache-from ${CI_REGISTRY_IMAGE}:latest --build-arg CACHEBUST=$(date +%s) --tag ${CI_REGISTRY_IMAGE}:production${CI_COMMIT_SHORT_SHA} --tag ${CI_REGISTRY_IMAGE}:latest .
- docker push ${CI_REGISTRY_IMAGE}:production${CI_COMMIT_SHORT_SHA}
- docker push ${CI_REGISTRY_IMAGE}:latest
rules: rules:
# Execute jobs when a new commit is pushed to master branch # Execute jobs when a new commit is pushed to develop branch
- if: $CI_COMMIT_BRANCH == 'master' - if: $CI_COMMIT_BRANCH == "develop"
# build to production:
# stage: build
# variables:
# GIT_SUBMODULE_STRATEGY: recursive
# GIT_SUBMODULE_UPDATE_FLAGS: --jobs 4
# before_script:
# - echo "Building the single user notebook image"
# - echo $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER $CI_REGISTRY --password-stdin
# script:
# - docker build -t ${STAGING_IMAGE} .
# - docker push ${STAGING_IMAGE}
# rules:
# # Execute jobs when a new commit is pushed to master branch
# - if: $CI_COMMIT_BRANCH == 'master'
deploy to develop: deploy to develop:
image: python:3.6
stage: deploy stage: deploy
variables:
GIT_SUBMODULE_STRATEGY: none
script:
- ./.gitlab-ci/update_tag_develop.sh
- ./.gitlab-ci/update_tag_app_develop.sh
- ./.gitlab-ci/update_metainfo_gui_develop.sh
environment: environment:
name: develop name: dev/$CI_COMMIT_REF_NAME
url: https://analytics-toolkit.nomad-coe.eu/develop deployment_tier: development
url: https://analytics-toolkit.nomad-coe.eu/dev/${CI_ENVIRONMENT_SLUG}
auto_stop_in: 7 days
on_stop: stop deploy dev
before_script:
- mkdir ~/.kube/
- echo ${CI_K8S_CONFIG} | base64 -d > ~/.kube/config
- helm repo add jupyterhub https://jupyterhub.github.io/helm-chart
- helm repo update
- helm version
script:
- helm upgrade ${CI_ENVIRONMENT_SLUG} jupyterhub/jupyterhub
--install
--namespace analytitcs
--values deployments/dev-values.yaml
--set hub.baseUrl=/dev/${CI_ENVIRONMENT_SLUG}
--set fullnameOverride=${CI_ENVIRONMENT_SLUG}-dev
--set singleuser.podNameTemplate="${CI_ENVIRONMENT_SLUG}-dev-{username}"
--set hub.config.GenericOAuthenticator.oauth_callback_url=https://analytics-toolkit.nomad-coe.eu/dev/${CI_ENVIRONMENT_SLUG}/hub/oauth_callback
--set singleuser.image.name=${CI_REGISTRY_IMAGE}
--set singleuser.image.tag=${CI_COMMIT_REF_SLUG}
--set roll=true
--wait
rules: rules:
# Execute jobs when a new commit is pushed to develop branch # Execute jobs when a new commit is pushed to develop branch
- if: $CI_COMMIT_BRANCH == "develop" - if: $CI_COMMIT_BRANCH == "develop"
deploy to staging: stop deploy dev:
image: python:3.6
stage: deploy stage: deploy
variables:
GIT_SUBMODULE_STRATEGY: none
script:
- ./.gitlab-ci/update_tag_staging.sh
environment: environment:
name: staging name: dev/$CI_COMMIT_REF_NAME
url: https://nomad-lab.eu/dev/analytics/staging action: stop
rules: before_script:
# Execute jobs when a new commit is pushed to master branch - mkdir ~/.kube/
- if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master" - echo ${CI_K8S_CONFIG} | base64 -d > ~/.kube/config
script:
- helm uninstall ${CI_ENVIRONMENT_SLUG} --namespace analytics
when: manual
needs: ["build"]
# deploy to staging:
# stage: deploy
# environment:
# name: staging
# url: https://nomad-lab.eu/dev/analytics/staging
# script:
# - ./.gitlab-ci/update_tag_staging.sh
# rules:
# # Execute jobs when a new commit is pushed to master branch
# - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
deploy to production: # deploy to production:
image: python:3.6 # stage: deploy
stage: deploy # environment:
script: # name: production
- ./.gitlab-ci/update_tag_production.sh # url: https://nomad-lab.eu/prod/analytics/hub
environment: # script:
name: production # - ./.gitlab-ci/update_tag_production.sh
url: https://nomad-lab.eu/prod/analytics/hub # rules:
rules: # # Execute jobs when a new commit is pushed to master branch
# Execute jobs when a new commit is pushed to master branch # - if: $CI_COMMIT_BRANCH == 'develop'
- if: $CI_COMMIT_BRANCH == 'master'
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment