Skip to content

Commit bbea3aa

Browse files
Re-add missing sources build stage for Azure Pipelines package build (#407)
1 parent fe8a059 commit bbea3aa

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

devops/pipeline/binary_package.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ trigger:
9898
pr: none
9999

100100
stages:
101+
- template: stages/source_build.yaml
102+
parameters:
103+
containerPath: $(CONTAINER_REGISTRY)/ubuntu20.04-dev-amd64:latest
104+
publishArtifact: true
105+
101106
- ${{ each target in parameters.build_targets }}:
102107
- template: stages/binary_build.yaml
103108
parameters:
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Source build stage definition
2+
# Parameters:
3+
# - (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)
4+
# - (Optional) prefix [string]: the prefix for the stage/job to be used - default: source
5+
# - (Optional) publishArtifact [boolean]: publishes the built artifacts (packages) as pipeline artifacts - default: true
6+
7+
parameters:
8+
- name: prefix
9+
type: string
10+
default: source
11+
12+
- name: containerPath
13+
type: string
14+
15+
- name: publishArtifact
16+
type: boolean
17+
default: false
18+
19+
stages:
20+
- stage: source_build
21+
displayName: Source
22+
dependsOn: []
23+
24+
jobs:
25+
- job: ${{ parameters.prefix }}
26+
27+
pool:
28+
vmImage: 'ubuntu-20.04'
29+
30+
steps:
31+
32+
- checkout: self
33+
submodules: recursive
34+
clean: true
35+
36+
- task: Docker@2
37+
displayName: Login to ACR
38+
inputs:
39+
command: login
40+
containerRegistry: $(SERVICE_CONNECTION)
41+
42+
- script: |
43+
CONTAINER_ID=`docker run -di -v $(Build.SourcesDirectory):/AzOsConfig ${{ parameters.containerPath }}`
44+
echo CONTAINER_ID=$CONTAINER_ID
45+
echo "##vso[task.setvariable variable=CONTAINER_ID]$CONTAINER_ID"
46+
# Extract TWEAK version from full version string
47+
BUILD_VERSION_ARRAY=(`echo $(Build.BuildNumber) | tr '.' ' '`)
48+
TWEAK_VERSION=${BUILD_VERSION_ARRAY[-1]}
49+
echo TWEAK_VERSION=$TWEAK_VERSION
50+
echo "##vso[task.setvariable variable=TWEAK_VERSION]$TWEAK_VERSION"
51+
displayName: Container Setup
52+
53+
- script: |
54+
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"
55+
displayName: Generate build
56+
57+
- script: |
58+
docker exec $(CONTAINER_ID) bash -c "cd /AzOsConfig/build && cmake --build . && cmake --build . --target dist && mkdir staging && cp -r /AzOsConfig/build/dist/* staging"
59+
displayName: Build & Stage Source Package
60+
61+
- publish: $(Build.SourcesDirectory)/build/staging
62+
displayName: Publishing source package
63+
artifact: OSConfig_$(Build.BuildNumber)_SOURCES
64+
condition: eq(${{ parameters.publishArtifact }}, true)

0 commit comments

Comments
 (0)