From 309d80a92182d7fca2fba8a1120228382d7dc4e7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 26 May 2021 10:37:33 +0200 Subject: [PATCH] ci: build image with timestamp for flux Signed-off-by: Jens Langhammer --- azure-pipelines.yml | 8 ++++++-- scripts/az_do_set_branch.py | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 24e7923d5..0e439630e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -417,11 +417,15 @@ stages: repository: 'authentik/server' command: 'build' Dockerfile: 'Dockerfile' - tags: 'gh-$(branchName)' + tags: | + gh-$(branchName) + gh-$(branchName)-$(timestamp) arguments: '--build-arg GIT_BUILD_HASH=$(Build.SourceVersion)' - task: Docker@2 inputs: containerRegistry: 'beryjuorg-harbor' repository: 'authentik/server' command: 'push' - tags: 'gh-$(branchName)' + tags: | + gh-$(branchName) + gh-$(branchName)-$(timestamp) diff --git a/scripts/az_do_set_branch.py b/scripts/az_do_set_branch.py index 554ba87ab..300dbcae7 100644 --- a/scripts/az_do_set_branch.py +++ b/scripts/az_do_set_branch.py @@ -1,5 +1,6 @@ """Helper script to get the actual branch name, docker safe""" import os +from time import time env_pr_branch = "SYSTEM_PULLREQUEST_SOURCEBRANCH" default_branch = "BUILD_SOURCEBRANCHNAME" @@ -9,3 +10,4 @@ if env_pr_branch in os.environ: branch_name = os.environ[env_pr_branch].replace("/", "-") print("##vso[task.setvariable variable=branchName]%s" % branch_name) +print("##vso[task.setvariable variable=timestamp]%s" % int(time()))