Switch to using a versioning system based on tags

This commit is contained in:
Daniel_I_Am 2020-08-16 21:41:19 +02:00
parent 885bbc0e7f
commit e1e898981b
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84

View File

@ -8,6 +8,7 @@ variables:
SOURCE_CODE_PATH: 'ChaosBot/*/'
stages:
- version
- build
- test
- release
@ -29,6 +30,22 @@ cache:
#
policy: pull-push
version:
stage: version
only:
changes:
- ChaosBot/**/*
refs:
- master
tags:
- docker
- hawkeye
script:
- 'git describe --tags > version'
artifacts:
paths:
- version
build:
stage: build
only:
@ -96,12 +113,12 @@ docker:
# Log in to the registry
- 'docker login -u=$REGISTRY_USER -p=$REGISTRY_PASS registry.chaoticlogic.us'
# Build the image
- 'docker -H unix:///var/run/docker.sock image build -t chaosbot:$CI_COMMIT_SHA ./'
- 'docker -H unix:///var/run/docker.sock image build -t chaosbot:`cat version` ./'
# Tag the image with a registry tag
- 'docker -H unix:///var/run/docker.sock image tag chaosbot:$CI_COMMIT_SHA registry.chaoticlogic.us/chaosbot:$CI_COMMIT_SHA'
- 'docker -H unix:///var/run/docker.sock image tag chaosbot:$CI_COMMIT_SHA registry.chaoticlogic.us/chaosbot:latest'
- 'docker -H unix:///var/run/docker.sock image tag chaosbot:`cat version` registry.chaoticlogic.us/chaosbot:$CI_COMMIT_SHA'
- 'docker -H unix:///var/run/docker.sock image tag chaosbot:`cat version` registry.chaoticlogic.us/chaosbot:latest'
# Push the registry images
- 'docker -H unix:///var/run/docker.sock image push registry.chaoticlogic.us/chaosbot:$CI_COMMIT_SHA'
- 'docker -H unix:///var/run/docker.sock image push registry.chaoticlogic.us/chaosbot:`cat version`'
- 'docker -H unix:///var/run/docker.sock image push registry.chaoticlogic.us/chaosbot:latest'