Added foundation for versioning

This commit is contained in:
Clemens Geibel 2022-05-10 17:02:57 +02:00
parent 5d0a94dfaa
commit e87bdb031d
4 changed files with 30 additions and 8 deletions

View file

@ -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

1
development-version.sh Executable file
View file

@ -0,0 +1 @@
VERSION=1.0.0 $@

View file

@ -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()

16
release.sh Executable file
View file

@ -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