ci(azure-pipelines): templatify release [skip ci]

This commit is contained in:
Sarah Vaupel 2025-02-05 11:31:36 +01:00
parent 871cc72995
commit 30ad995a40
2 changed files with 54 additions and 42 deletions

View File

@ -0,0 +1,51 @@
# SPDX-FileCopyrightText: 2025 Sarah Vaupel <sarah.vaupel@uniworx.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
parameters:
- name: releaseTag
type: string
jobs:
- job: test
displayName: Release fradrive-test
condition: or(eq(variables.releaseTest, true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
container:
image: devfra.azurecr.io/de.fraport.build/tools:1.1.0
endpoint: devfra
steps:
- checkout: self
- task: DownloadPipelineArtifact@2
displayName: Download binaries
inputs:
artifactName: backend
patterns: 'backend/bin/*'
targetPath: '$(Build.Repository.LocalPath)'
- script: |
ls -a .
pwd
find .
- task: Docker@2
displayName: Login to container registry
inputs:
command: login
containerRegistry: devfra
- task: Bash@3
displayName: Build container
inputs:
targetType: inline
script: |
cp docker/fradrive/Dockerfile .
docker build \
--tag $(imageUpstream)/fradrive:$(Build.BuildNumber) \
--build-arg FROM_IMG=devfra.azurecr.io/de.fraport.trusted/ubuntu \
--build-arg FROM_TAG=20.04 \
--build-arg PROJECT_DIR=$(Build.Repository.LocalPath) \
--build-arg IN_CI=true \
--build-arg IN_CONTAINER=true \
.
- task: Docker@2
displayName: Logout from container registry
inputs:
command: logout
containerRegistry: devfra

View File

@ -84,45 +84,6 @@ stages:
dependsOn:
- backend
jobs:
- job: test
displayName: Release fradrive-test
condition: eq(variables.releaseTest, true)
container:
image: devfra.azurecr.io/de.fraport.build/tools:1.1.0
endpoint: devfra
steps:
- checkout: self
- task: DownloadPipelineArtifact@2
displayName: Download binaries
inputs:
artifactName: backend
patterns: 'backend/bin/*'
targetPath: '$(Build.Repository.LocalPath)'
- script: |
ls -a .
pwd
find .
- task: Docker@2
displayName: Login to container registry
inputs:
command: login
containerRegistry: devfra
- task: Bash@3
displayName: Build container
inputs:
targetType: inline
script: |
cp docker/fradrive/Dockerfile .
docker build \
--tag $(imageUpstream)/fradrive:$(Build.BuildNumber) \
--build-arg FROM_IMG=devfra.azurecr.io/de.fraport.trusted/ubuntu \
--build-arg FROM_TAG=20.04 \
--build-arg PROJECT_DIR=$(Build.Repository.LocalPath) \
--build-arg IN_CI=true \
--build-arg IN_CONTAINER=true \
.
- task: Docker@2
displayName: Logout from container registry
inputs:
command: logout
containerRegistry: devfra
- template: .azure-pipelines/templates/release.yaml
parameters:
releaseTag: split(variables['Build.SourceBranch'], '/')[2]