Skip to content

Commit

Permalink
Re-add missing sources build stage for Azure Pipelines package build (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
robertschaedler3 committed Sep 30, 2022
1 parent fe8a059 commit bbea3aa
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
5 changes: 5 additions & 0 deletions devops/pipeline/binary_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ trigger:
pr: none

stages:
- template: stages/source_build.yaml
parameters:
containerPath: $(CONTAINER_REGISTRY)/ubuntu20.04-dev-amd64:latest
publishArtifact: true

- ${{ each target in parameters.build_targets }}:
- template: stages/binary_build.yaml
parameters:
Expand Down
64 changes: 64 additions & 0 deletions devops/pipeline/stages/source_build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Source build stage definition
# Parameters:
# - (Required) containerPath [string]: the full path to the container to be used for the build environmentr (Example. osconfig.azurecr.io/ubuntu20.04-dev-amd64:latest)
# - (Optional) prefix [string]: the prefix for the stage/job to be used - default: source
# - (Optional) publishArtifact [boolean]: publishes the built artifacts (packages) as pipeline artifacts - default: true

parameters:
- name: prefix
type: string
default: source

- name: containerPath
type: string

- name: publishArtifact
type: boolean
default: false

stages:
- stage: source_build
displayName: Source
dependsOn: []

jobs:
- job: ${{ parameters.prefix }}

pool:
vmImage: 'ubuntu-20.04'

steps:

- checkout: self
submodules: recursive
clean: true

- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: $(SERVICE_CONNECTION)

- script: |
CONTAINER_ID=`docker run -di -v $(Build.SourcesDirectory):/AzOsConfig ${{ parameters.containerPath }}`
echo CONTAINER_ID=$CONTAINER_ID
echo "##vso[task.setvariable variable=CONTAINER_ID]$CONTAINER_ID"
# Extract TWEAK version from full version string
BUILD_VERSION_ARRAY=(`echo $(Build.BuildNumber) | tr '.' ' '`)
TWEAK_VERSION=${BUILD_VERSION_ARRAY[-1]}
echo TWEAK_VERSION=$TWEAK_VERSION
echo "##vso[task.setvariable variable=TWEAK_VERSION]$TWEAK_VERSION"
displayName: Container Setup
- script: |
docker exec $(CONTAINER_ID) bash -c "cmake -DCMAKE_BUILD_TYPE=Release -Duse_prov_client=ON -Dhsm_type_symm_key=ON -DCOMPILE_WITH_STRICTNESS=ON -DMAJOR_VERSION=$(MAJORVERSION) -DMINOR_VERSION=$(MINORVERSION) -DPATCH_VERSION=$(PATCHVERSION) -DTWEAK_VERSION=$(TWEAK_VERSION) -G Ninja -B/AzOsConfig/build -H/AzOsConfig/src"
displayName: Generate build
- script: |
docker exec $(CONTAINER_ID) bash -c "cd /AzOsConfig/build && cmake --build . && cmake --build . --target dist && mkdir staging && cp -r /AzOsConfig/build/dist/* staging"
displayName: Build & Stage Source Package
- publish: $(Build.SourcesDirectory)/build/staging
displayName: Publishing source package
artifact: OSConfig_$(Build.BuildNumber)_SOURCES
condition: eq(${{ parameters.publishArtifact }}, true)

0 comments on commit bbea3aa

Please sign in to comment.