ci: build image with timestamp for flux

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-26 10:37:33 +02:00
parent 1bd41116a4
commit 309d80a921
2 changed files with 8 additions and 2 deletions

View File

@ -417,11 +417,15 @@ stages:
repository: 'authentik/server' repository: 'authentik/server'
command: 'build' command: 'build'
Dockerfile: 'Dockerfile' Dockerfile: 'Dockerfile'
tags: 'gh-$(branchName)' tags: |
gh-$(branchName)
gh-$(branchName)-$(timestamp)
arguments: '--build-arg GIT_BUILD_HASH=$(Build.SourceVersion)' arguments: '--build-arg GIT_BUILD_HASH=$(Build.SourceVersion)'
- task: Docker@2 - task: Docker@2
inputs: inputs:
containerRegistry: 'beryjuorg-harbor' containerRegistry: 'beryjuorg-harbor'
repository: 'authentik/server' repository: 'authentik/server'
command: 'push' command: 'push'
tags: 'gh-$(branchName)' tags: |
gh-$(branchName)
gh-$(branchName)-$(timestamp)

View File

@ -1,5 +1,6 @@
"""Helper script to get the actual branch name, docker safe""" """Helper script to get the actual branch name, docker safe"""
import os import os
from time import time
env_pr_branch = "SYSTEM_PULLREQUEST_SOURCEBRANCH" env_pr_branch = "SYSTEM_PULLREQUEST_SOURCEBRANCH"
default_branch = "BUILD_SOURCEBRANCHNAME" default_branch = "BUILD_SOURCEBRANCHNAME"
@ -9,3 +10,4 @@ if env_pr_branch in os.environ:
branch_name = os.environ[env_pr_branch].replace("/", "-") branch_name = os.environ[env_pr_branch].replace("/", "-")
print("##vso[task.setvariable variable=branchName]%s" % branch_name) print("##vso[task.setvariable variable=branchName]%s" % branch_name)
print("##vso[task.setvariable variable=timestamp]%s" % int(time()))