Merged PR 1529: Floating Docker Branch-Tags

Es wird zusätzlich zu den bisherigen Docker-Tags, ein Docker-Tag vergeben, das den aktuellen Branch repräsentiert. Da dieses (identische) Tag für jeden neuen Build aus einem Branch wieder vergeben wird, wandert das Tag auf das neueste Docker-Image aus diesem Branch (vgl. Tag _latest_)

Beispiele:
develop => refs_head_develop
release/2.3 => refs_head_release_2.3

(cherry picked from commit 8880ed0df6)
This commit is contained in:
Michael Auer
2023-05-24 16:12:28 +00:00
parent 4b56b973c8
commit c228147c00

View File

@@ -20,27 +20,7 @@ variables:
- group: 'GithubCMF'
jobs:
# - job: cibuild_fast
# displayName: ISAClient CI Fast
# pool:
# name: 'Default'
# demands:
# - Agent.OS -equals Linux
# - docker
# condition: and(ne(variables['Build.SourceBranch'], 'refs/heads/develop'), ne(variables['Build.SourceBranch'], 'refs/heads/integration'), ne(variables['Build.SourceBranch'], 'refs/heads/master'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/hotfix/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))
# steps:
# - task: npmAuthenticate@0
# displayName: 'npm auth'
# inputs:
# workingFile: .npmrc
# - task: Docker@2
# displayName: 'build ISAClient Debug'
# inputs:
# command: 'build'
# Dockerfile: Dockerfile
# buildContext:
# tags: '$(Build.BuildNumber)-$(Build.SourceVersion)'
# arguments: '--build-arg SEMVERSION=$(Major).$(Minor).$(Patch)'
- job: unittests
displayName: Unit Tests
pool:
@@ -99,6 +79,7 @@ jobs:
fi
displayName: Remove docker image
condition: always()
- job: cibuild_debug
displayName: ISAClient CI Debug
pool:
@@ -107,7 +88,15 @@ jobs:
- Agent.OS -equals Linux
- docker
condition: and(ne(variables['Build.SourceBranch'], 'refs/heads/integration'), ne(variables['Build.SourceBranch'], 'refs/heads/master'), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/hotfix/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')))
variables:
- name: DockerTagSourceBranch
value: $[replace(variables['Build.SourceBranch'], '/', '_')]
- name: 'DockerTag'
value: |
$(Build.BuildNumber)-$(Build.SourceVersion)
$(DockerTagSourceBranch)
steps:
- task: npmAuthenticate@0
displayName: 'npm auth'
inputs:
@@ -121,7 +110,7 @@ jobs:
command: 'build'
Dockerfile: Dockerfile
buildContext:
tags: '$(Build.BuildNumber)-$(Build.SourceVersion)'
tags: '$(DockerTag)'
arguments: |
--no-cache
--target publish
@@ -135,7 +124,7 @@ jobs:
containerRegistry: 'Harbor isa'
repository: 'isa/ui'
command: 'push'
tags: '$(Build.BuildNumber)-$(Build.SourceVersion)'
tags: '$(DockerTag)'
- task: PublishBuildArtifacts@1
displayName: 'Artefakt veröffentlichen: HelmValues'
@@ -169,6 +158,13 @@ jobs:
- Agent.OS -equals Linux
- docker
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/integration'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/heads/hotfix/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'))
variables:
- name: DockerTagSourceBranch
value: $[replace(variables['Build.SourceBranch'], '/', '_')]
- name: 'DockerTag'
value: |
$(Build.BuildNumber)-$(Build.SourceVersion)
$(DockerTagSourceBranch)
steps:
- task: npmAuthenticate@0
displayName: 'npm auth'
@@ -183,7 +179,7 @@ jobs:
command: 'build'
Dockerfile: Dockerfile
buildContext:
tags: '$(Build.BuildNumber)-$(Build.SourceVersion)'
tags: '$(DockerTag)'
arguments: |
--no-cache
--target publish
@@ -198,7 +194,7 @@ jobs:
containerRegistry: 'Harbor isa'
repository: 'isa/ui'
command: 'push'
tags: '$(Build.BuildNumber)-$(Build.SourceVersion)'
tags: '$(DockerTag)'
- task: PublishBuildArtifacts@1