We planned to upgrade GitLab and Mattermost to the latest version this Friday morning (early). You may experience some downtime!

Build docker container in CI

For tags, we'll also push and tag that container.
parent 8f875bfd
......@@ -13,13 +13,19 @@ variables:
PY36_IMAGE: thalia/python-thalia:3.6
PIP_CACHE_DIR: "${CI_PROJECT_DIR}/pip-cache"
stages:
- test
- deploy
pep8:
stage: test
image: $PY35_IMAGE
before_script:
script:
- tox -e flake8
.djangotest: &djangotest
stage: test
services:
- postgres:latest
before_script:
......@@ -44,6 +50,7 @@ python36-django20:
DJANGO_VERSION: django20
docs:
stage: test
image: $PY35_IMAGE
before_script:
# install django deps
......@@ -60,6 +67,45 @@ docs:
- ./generate-apidocs.sh
- git diff --exit-code
build docker image:
stage: test
services:
- docker:dind
image: thalia/docker-compose
tags:
- docker
before_script:
- echo $GITLAB_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.gitlab.com
script:
- docker-compose build --build-arg install_dev_requirements=0 web
- docker-compose run --rm web test
- docker tag $DOCKER_LATEST $DOCKER_TAG
- docker push $DOCKER_TAG
variables:
DOCKER_LATEST: registry.gitlab.com/thaliawww/concrexit:latest
DOCKER_TAG: registry.gitlab.com/thaliawww/concrexit:$CI_COMMIT_SHA
tag docker image:
stage: deploy
services:
- docker:dind
image: docker:git
tags:
- docker
only:
- tags
dependencies:
- build docker image
before_script:
- echo $GITLAB_REGISTRY_PASSWORD | docker login --username thaliawww --password-stdin registry.gitlab.com
script:
- docker pull $DOCKER_TAG
- docker push $DOCKER_TAG_PRODUCTION
variables:
DOCKER_TAG: registry.gitlab.com/thaliawww/concrexit:$CI_COMMIT_SHA
DOCKER_TAG_PRODUCTION: registry.gitlab.com/thaliawww/concrexit:$CI_COMMIT_TAG
cache:
key: "$CI_JOB_NAME"
paths:
......
......@@ -67,4 +67,4 @@ COPY docs /usr/src/app/docs
# Cache docs between builds if not mounting to FS
VOLUME /concrexit/docs
RUN echo "Don't build releases without release.sh!"
RUN echo "Don't build releases yourself, let CI do it!"
......@@ -42,6 +42,9 @@ version_major=${version%.*}
echo "Changing directory to root of repository"
cd "${0%/*}"
echo "Making sure we're up-to-date"
git fetch --tags
echo "Changing to branch 'release/$version_major'"
git checkout "release/$version_major"
......@@ -57,23 +60,6 @@ fi
if yesno "Do you want to push the tag to the repository?"; then
echo "Pushing tags:"
git push --tags
echo "Don't forget to fill in the release description"
fi
if ! yesno "Do you want to build a docker container?"; then
exit 1
fi
if [ -n "$(git status --porcelain)" ]; then
echo "Unclean working directory!"
git status
exit 1
fi
docker_tag="registry.gitlab.com/thaliawww/concrexit:$version"
docker build --build-arg install_dev_requirements=0 --pull -t "$docker_tag" .
if yesno "Do you want to push the container?"; then
docker push "$docker_tag"
echo "Don't forget to fill in the release description on the website:"
echo "https://gitlab.science.ru.nl/thalia/concrexit/tags/v$version/release/edit"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment