diff --git a/.azure-pipelines/templates/release.yaml b/.azure-pipelines/templates/release.yaml new file mode 100644 index 000000000..6afaf9439 --- /dev/null +++ b/.azure-pipelines/templates/release.yaml @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: 2025 Sarah Vaupel +# +# 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 \ No newline at end of file diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml index 064d2564d..5852b40d8 100755 --- a/azure-pipelines.yaml +++ b/azure-pipelines.yaml @@ -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 \ No newline at end of file + - template: .azure-pipelines/templates/release.yaml + parameters: + releaseTag: split(variables['Build.SourceBranch'], '/')[2] \ No newline at end of file