ci(azure-pipelines): parametrize build steps
This commit is contained in:
parent
189205767f
commit
dfb97df72b
@ -10,6 +10,13 @@ parameters:
|
|||||||
baseImage: baseImage
|
baseImage: baseImage
|
||||||
baseImageTag: baseImageTag
|
baseImageTag: baseImageTag
|
||||||
# extraBuildOptions: ''
|
# extraBuildOptions: ''
|
||||||
|
- name: buildSteps
|
||||||
|
type: object
|
||||||
|
default:
|
||||||
|
- dependencies
|
||||||
|
- compile
|
||||||
|
- lint
|
||||||
|
- test
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: ImageBuild_${{parameters.service.name}}
|
- job: ImageBuild_${{parameters.service.name}}
|
||||||
@ -62,4 +69,43 @@ jobs:
|
|||||||
displayName: Logout from container registry
|
displayName: Logout from container registry
|
||||||
inputs:
|
inputs:
|
||||||
command: logout
|
command: logout
|
||||||
containerRegistry: devFra
|
containerRegistry: devFra
|
||||||
|
|
||||||
|
- job: Build_${{parameters.service.name}}
|
||||||
|
displayName: Build ${{parameters.service.name}}
|
||||||
|
# TODO: wait for ImageBuild job iff the job was executed
|
||||||
|
# dependsOn: ImageBuild_${{parameters.service.name}}
|
||||||
|
# condition: succeeded()
|
||||||
|
container:
|
||||||
|
# image: devfra.azurecr.io/de.fraport.fradrive.build/frontend:$(Build.BuildNumber)
|
||||||
|
image: $(imageUpstream)/${{parameters.service.name}}:latest
|
||||||
|
endpoint: devfra
|
||||||
|
env:
|
||||||
|
PROJECT_DIR: $(Build.Repository.LocalPath)
|
||||||
|
IN_CONTAINER: true
|
||||||
|
IN_CI: true
|
||||||
|
steps:
|
||||||
|
- checkout: self
|
||||||
|
- ${{ each buildStep in parameters.buildSteps }}:
|
||||||
|
- template: .azure-pipelines/templates/service/build-step.yaml
|
||||||
|
parameters:
|
||||||
|
service: ${{ parameters.service.name }}
|
||||||
|
buildStep: ${{ buildStep }}
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: Copy ${{parameters.service.name}} artifacts
|
||||||
|
inputs:
|
||||||
|
# TODO: parametrize
|
||||||
|
Contents: |
|
||||||
|
assets/icons
|
||||||
|
assets/favicons
|
||||||
|
static/
|
||||||
|
well-known/
|
||||||
|
frontend/src/env.sass
|
||||||
|
config/manifest.json
|
||||||
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
||||||
|
- task: PublishBuildArtifacts@1
|
||||||
|
displayName: Publish ${{parameters.service.name}} artifacts
|
||||||
|
inputs:
|
||||||
|
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
||||||
|
ArtifactName: '${{parameters.service.name}}'
|
||||||
|
publishLocation: 'Container'
|
||||||
21
.azure-pipelines/templates/service/build-step.yaml
Normal file
21
.azure-pipelines/templates/service/build-step.yaml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2024-2025 Sarah Vaupel <sarah.vaupel@uniworx.de>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
parameters:
|
||||||
|
- name: service
|
||||||
|
- name: buildStep
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- task: Bash@3
|
||||||
|
name: ${{parameters.service}}_${{parameters.buildStep}}
|
||||||
|
env:
|
||||||
|
HTTPS_PROXY: http://proxy.frankfurt-airport.de:8080
|
||||||
|
HTTP_PROXY: http://proxy.frankfurt-airport.de:8080
|
||||||
|
NO_PROXY: 'localhost,127.0.0.1,*.docker.internal,*.azmk8s.io,devfra.azurecr.io,devfra.westeurope.data.azurecr.io'
|
||||||
|
FRAPORT_NOPROXY: 'dev.azure.com,*.dev.azure.com,*.fraport.de,*.frankfurt-airport.de'
|
||||||
|
PROJECT_DIR: $(Build.Repository.LocalPath)
|
||||||
|
inputs:
|
||||||
|
targetType: inline
|
||||||
|
script: |
|
||||||
|
make -- --${{parameters.buildStep}}-${{parameters.service}} IN_CONTAINER=true IN_CI=true PROJECT_DIR=${PROJECT_DIR}
|
||||||
@ -23,51 +23,4 @@ jobs:
|
|||||||
- ${{ each service in parameters.services }}:
|
- ${{ each service in parameters.services }}:
|
||||||
- template: .azure-pipelines/templates/service.yaml
|
- template: .azure-pipelines/templates/service.yaml
|
||||||
parameters:
|
parameters:
|
||||||
service: ${{ service }}
|
service: ${{ service }}
|
||||||
|
|
||||||
- job: FrontendBuild
|
|
||||||
# TODO: wait for FrontendImage iff the job was executed
|
|
||||||
# dependsOn: FrontendImage
|
|
||||||
# condition: succeeded()
|
|
||||||
container:
|
|
||||||
# image: devfra.azurecr.io/de.fraport.fradrive.build/frontend:$(Build.BuildNumber)
|
|
||||||
image: devfra.azurecr.io/de.fraport.fradrive.build/frontend:latest
|
|
||||||
endpoint: devfra
|
|
||||||
env:
|
|
||||||
PROJECT_DIR: $(Build.Repository.LocalPath)
|
|
||||||
IN_CONTAINER: true
|
|
||||||
IN_CI: true
|
|
||||||
steps:
|
|
||||||
- checkout: self
|
|
||||||
- task: Bash@3
|
|
||||||
name: frontendDependencies
|
|
||||||
displayName: Install frontend dependencies
|
|
||||||
env:
|
|
||||||
HTTPS_PROXY: http://proxy.frankfurt-airport.de:8080
|
|
||||||
HTTP_PROXY: http://proxy.frankfurt-airport.de:8080
|
|
||||||
NO_PROXY: 'localhost,127.0.0.1,*.docker.internal,*.azmk8s.io,devfra.azurecr.io,devfra.westeurope.data.azurecr.io'
|
|
||||||
FRAPORT_NOPROXY: 'dev.azure.com,*.dev.azure.com,*.fraport.de,*.frankfurt-airport.de'
|
|
||||||
PROJECT_DIR: $(Build.Repository.LocalPath)
|
|
||||||
inputs:
|
|
||||||
targetType: inline
|
|
||||||
script: |
|
|
||||||
make -- --dependencies-frontend IN_CONTAINER=true IN_CI=true PROJECT_DIR=${PROJECT_DIR}
|
|
||||||
- task: CopyFiles@2
|
|
||||||
name: frontendCopyArtifacts
|
|
||||||
displayName: Prepare frontend artifacts
|
|
||||||
inputs:
|
|
||||||
Contents: |
|
|
||||||
assets/icons
|
|
||||||
assets/favicons
|
|
||||||
static/
|
|
||||||
well-known/
|
|
||||||
frontend/src/env.sass
|
|
||||||
config/manifest.json
|
|
||||||
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
- task: PublishBuildArtifacts@1
|
|
||||||
name: frontendPublishArtifacts
|
|
||||||
displayName: Publish frontend artifacts
|
|
||||||
inputs:
|
|
||||||
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
|
||||||
ArtifactName: 'frontend'
|
|
||||||
publishLocation: 'Container'
|
|
||||||
Reference in New Issue
Block a user