1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-14 20:42:27 +00:00
senpy/.gitlab-ci.yml

113 lines
3.1 KiB
YAML
Raw Normal View History

2017-05-19 12:38:29 +00:00
# Uncomment if you want to use docker-in-docker
# image: gsiupm/dockermake:latest
# services:
# - docker:dind
2017-02-13 11:04:29 +00:00
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
stages:
- test
2022-05-23 07:52:22 +00:00
- publish
2022-05-23 10:45:40 +00:00
- deploy
variables:
KUBENS: senpy
2017-05-19 12:38:29 +00:00
2022-05-23 07:52:22 +00:00
docker:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
2022-05-23 07:52:22 +00:00
PYTHON_VERSION: "3.10"
tags:
- docker
2017-02-13 11:04:29 +00:00
script:
2022-05-23 07:52:22 +00:00
- sed "s/{{PYVERSION}}/$PYTHON_VERSION/" Dockerfile.template > Dockerfile
2022-05-23 09:20:15 +00:00
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"https://index.docker.io/v1/\":{\"auth\":\"$HUB_AUTH\"}}}" > /kaniko/.docker/config.json
2022-05-23 07:52:22 +00:00
# The skip-tls-verify flag is there because our registry certificate is self signed
- /kaniko/executor --context $CI_PROJECT_DIR --skip-tls-verify --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --destination $HUB_REPO:$CI_COMMIT_TAG
2017-02-13 11:04:29 +00:00
only:
2017-02-13 18:41:18 +00:00
- tags
2017-02-13 11:04:29 +00:00
2022-05-23 10:51:47 +00:00
docker-latest:
stage: publish
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
variables:
PYTHON_VERSION: "3.10"
tags:
- docker
script:
- sed "s/{{PYVERSION}}/$PYTHON_VERSION/" Dockerfile.template > Dockerfile
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"},\"https://index.docker.io/v1/\":{\"auth\":\"$HUB_AUTH\"}}}" > /kaniko/.docker/config.json
# The skip-tls-verify flag is there because our registry certificate is self signed
- /kaniko/executor --context $CI_PROJECT_DIR --skip-tls-verify --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $HUB_REPO:$CI_COMMIT_SHORT_SHA
only:
refs:
- master
2022-05-23 07:52:22 +00:00
testpy37:
tags:
- docker
image: python:3.7
stage: test
script:
2022-05-23 07:52:22 +00:00
- pip install -r requirements.txt -r test-requirements.txt
- python setup.py test
2022-05-23 07:52:22 +00:00
testpy310:
tags:
- docker
image: python:3.10
stage: test
2017-05-19 12:38:29 +00:00
script:
2022-05-23 07:52:22 +00:00
- pip install -r requirements.txt -r test-requirements.txt
- python setup.py test
2017-05-19 12:38:29 +00:00
2022-05-23 07:52:22 +00:00
push_pypi:
only:
2022-05-23 07:52:22 +00:00
- tags
tags:
- docker
image: python:3.7
stage: publish
2017-05-19 15:55:52 +00:00
script:
2022-05-23 07:52:22 +00:00
- echo $CI_COMMIT_TAG > senpy/VERSION
- pip install twine
- python setup.py sdist bdist_wheel
- TWINE_PASSWORD=$PYPI_PASSWORD TWINE_USERNAME=$PYPI_USERNAME python -m twine upload dist/*
2017-05-19 15:55:52 +00:00
2022-05-23 07:52:22 +00:00
check_pypi:
2017-05-19 15:55:52 +00:00
only:
2022-05-23 07:52:22 +00:00
- tags
tags:
- docker
image: python:3.7
2022-05-23 10:45:40 +00:00
stage: deploy
script:
2022-05-23 07:52:22 +00:00
- pip install senpy==$CI_COMMIT_TAG
# Allow PYPI to update its index before we try to install
when: delayed
start_in: 10 minutes
2022-05-23 10:45:40 +00:00
2022-05-23 10:51:47 +00:00
latest-demo:
2022-05-23 10:45:40 +00:00
only:
refs:
- master
tags:
- docker
image: alpine/k8s:1.22.6
stage: deploy
environment: production
variables:
KUBECONFIG_FILE: "/kubeconfig"
2022-05-23 10:51:47 +00:00
IMAGEWTAG: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}"
2022-05-23 10:45:40 +00:00
KUBEAPP: "senpy"
script:
- cat ${KUBECONFIG} > $KUBECONFIG_FILE
- kubectl version
- cd k8s/
- cat *.yaml *.tmpl 2>/dev/null | envsubst | kubectl --kubeconfig $KUBECONFIG_FILE apply --namespace ${KUBENS:-default} -f -
- kubectl --kubeconfig $KUBECONFIG_FILE get all,ing -l app=${KUBEAPP} --namespace=${KUBENS:-default}