diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eb36cbb..a0dcf43 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,8 @@ services: - docker:19.03.12-dind build: - stage: build + stage: image + rules: + - if: '$CI_COMMIT_TAG != null' script: - cd infrastructure/docker && pyb image test publish diff --git a/development-version.sh b/development-version.sh new file mode 100755 index 0000000..7b94120 --- /dev/null +++ b/development-version.sh @@ -0,0 +1 @@ +VERSION=1.0.0 $@ diff --git a/infrastructure/docker/build.py b/infrastructure/docker/build.py index ce7e6a8..25d175c 100644 --- a/infrastructure/docker/build.py +++ b/infrastructure/docker/build.py @@ -13,7 +13,7 @@ class MyBuild(DevopsDockerBuild): @init def initialize(project): - project.build_depends_on('ddadevops>=0.6.1') + project.build_depends_on('ddadevops>=0.12.4') stage = 'notused' dockerhub_user = environ.get('DOCKERHUB_USER') if not dockerhub_user: @@ -21,8 +21,11 @@ def initialize(project): dockerhub_password = environ.get('DOCKERHUB_PASSWORD') if not dockerhub_password: dockerhub_password = gopass_password_from_path('meissa/web/docker.com') + tag = environ.get('CI_COMMIT_TAG') + if not tag: + tag = get_tag_from_latest_commit() config = create_devops_docker_build_config( - stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password) + stage, PROJECT_ROOT_PATH, MODULE, dockerhub_user, dockerhub_password, docker_publish_tag=tag) build = MyBuild(project, config) build.initialize_build_dir() @@ -37,13 +40,13 @@ def drun(project): build = get_devops_build(project) build.drun() -@task -def test(project): - build = get_devops_build(project) - build.test() - @task def publish(project): build = get_devops_build(project) build.dockerhub_login() build.dockerhub_publish() + +@task +def test(project): + build = get_devops_build(project) + build.test() diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..ad45df6 --- /dev/null +++ b/release.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +source development-version.sh + +if [ -z "$VERSION" ] +then + echo "Error: VERSION needs to be set!" +else + echo "Release version: $VERSION" + # TODO: git tag and commit + while IFS='.' read -ra NUM; do + echo "VERSION=${NUM[0]}.${NUM[1]}.$((NUM[2]+1)) \$@" > development-version.sh + done <<< "$VERSION" + + echo "Version bumped in file 'development-version.sh'" +fi