-
Notifications
You must be signed in to change notification settings - Fork 110
Expand file tree
/
Copy pathmacos_64_env_gen.yml
More file actions
250 lines (235 loc) · 7.57 KB
/
macos_64_env_gen.yml
File metadata and controls
250 lines (235 loc) · 7.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
parameters:
pythonVersion: ''
artifactName: ''
grpcBuild: ''
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: ${{ parameters.pythonVersion }}
allowUnstable: true
addToPath: true
- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: 'internal/PythonWorker_Internal_PublicPackages'
- powershell: |
# Parse the Python minor version
$PY_VER = "$(pythonVersion)"
Write-Host "Python version: $PY_VER"
# Extract minor version as integers
$versionParts = $PY_VER.Split('.')
$PY_MAJOR = [int]$versionParts[0]
Write-Host "Major version: $PY_MAJOR"
Write-Host "##vso[task.setvariable variable=majorVersion;]$PY_MAJOR"
$PY_MINOR = [int]$versionParts[1]
Write-Host "Minor version: $PY_MINOR"
Write-Host "##vso[task.setvariable variable=minorVersion;]$PY_MINOR"
# Detect if this is an RC build
if ($PY_VER -match "rc") {
Write-Host "RC version detected"
Write-Host "##vso[task.setvariable variable=isRC;]true"
}
else {
Write-Host "Stable version detected"
Write-Host "##vso[task.setvariable variable=isRC;]false"
}
# Set build-related variables based on Python minor version
if( $PY_MINOR -ge 13 )
{
Write-Host "##vso[task.setvariable variable=workerPath;]$(proxyV4Path)"
Write-Host "##vso[task.setvariable variable=proxyWorker;]true"
}
else
{
Write-Host "##vso[task.setvariable variable=workerPath;]$(prodV4Path)"
Write-Host "##vso[task.setvariable variable=proxyWorker;]false"
}
displayName: 'Set necessary variables'
env:
pythonVersion: ${{ parameters.pythonVersion }}
- powershell: |
Write-Host "workerPath: $(workerPath)"
Write-Host "proxyWorker: $(proxyWorker)"
displayName: 'Display variables'
- task: ShellScript@2
inputs:
disableAutoCwd: true
scriptPath: 'eng/pack/scripts/mac_arm64_deps.sh'
args: '${{ parameters.pythonVersion }}'
displayName: 'Install dependencies'
# condition: eq(variables['isRC'], 'false')
# - task: ShellScript@2
# inputs:
# disableAutoCwd: true
# scriptPath: 'eng/pack/scripts/rc_mac_arm64_deps.sh'
# args: '${{ parameters.pythonVersion }}'
# displayName: 'Build dependencies from source'
# condition: eq(variables['isRC'], 'true')
- bash: |
pip install pip-audit
cd workers
pip-audit -r requirements.txt
displayName: 'Run vulnerability scan'
continueOnError: true
- task: CopyFiles@2
inputs:
contents: '$(workerPath)'
targetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)/deps'
contents: |
**
!grpc_tools/**/*
!grpcio_tools*/*
!build/**
!docs/**
!eng/**
!python/**
!tests/**
!setuptools*/**
!_distutils_hack/**
!distutils-precedence.pth
!pkg_resources/**
!*.dist-info/**
!werkzeug/debug/shared/debugger.js
!proxy_worker/**
targetFolder: '$(Build.ArtifactStagingDirectory)'
condition: eq(variables['proxyWorker'], false)
displayName: 'Copy azure_functions_worker files'
- powershell: |
$root = "$(Build.ArtifactStagingDirectory)"
$cythonDir = Join-Path $root "grpc/_cython"
# Define expected files/folders relative to root
$expected = @(
".artifactignore",
"azure",
"azurefunctions",
"azure_functions_worker",
"azure_functions_worker/protos/FunctionRpc_pb2.py",
"azure_functions_worker/protos/FunctionRpc_pb2_grpc.py",
"azure_functions_worker/protos/_src",
"azure_functions_worker/protos/identity",
"azure_functions_worker/protos/identity/ClaimsIdentityRpc_pb2.py",
"azure_functions_worker/protos/identity/ClaimsIdentityRpc_pb2_grpc.py",
"azure_functions_worker/protos/shared",
"azure_functions_worker/protos/shared/NullableTypes_pb2.py",
"azure_functions_worker/protos/shared/NullableTypes_pb2_grpc.py",
"dateutil",
"google",
"grpc",
"markupsafe",
"six.py",
"werkzeug",
"worker.py"
)
$missing = @()
foreach ($item in $expected) {
$path = Join-Path $root $item
if (-not (Test-Path $path)) {
$missing += $item
}
}
# === gRPC check ===
$grpcPattern = "*$(majorVersion)$(minorVersion)*-${{ parameters.grpcBuild }}"
$grpcMatch = Get-ChildItem -Path $cythonDir -Name -ErrorAction SilentlyContinue |
Where-Object { $_ -like $grpcPattern }
if (-not $grpcMatch) {
$missing += "grpc/_cython/$grpcPattern"
} else {
Write-Host "✅ Found gRPC binary: $grpcMatch"
}
if ($missing.Count -gt 0) {
Write-Error "Validation failed. Missing expected files/folders:`n$($missing -join "`n")"
exit 1
}
else {
Write-Host "✅ Validation passed. All expected files/folders are present."
}
displayName: "Validate azure_functions_worker artifact contents"
condition: eq(variables['proxyWorker'], false)
- task: CopyFiles@2
inputs:
sourceFolder: '$(Build.SourcesDirectory)/deps'
contents: |
**
!grpc_tools/**/*
!grpcio_tools*/*
!build/**
!docs/**
!eng/**
!python/**
!tests/**
!setuptools*/**
!_distutils_hack/**
!distutils-precedence.pth
!pkg_resources/**
!*.dist-info/**
!werkzeug/debug/shared/debugger.js
!azure_functions_worker/**
!dateutil/**
!Cython/**
!__pycache__/**
!bin/**
!cython.py
!pip/**
!pyximport/**
!typing_extensions.py
!wheel/**
targetFolder: '$(Build.ArtifactStagingDirectory)'
condition: eq(variables['proxyWorker'], true)
displayName: 'Copy proxy_worker files'
- powershell: |
$root = "$(Build.ArtifactStagingDirectory)"
$cythonDir = Join-Path $root "grpc/_cython"
# Define expected files/folders relative to root
$expected = @(
".artifactignore",
"azure",
"azure_functions_runtime",
"azure_functions_runtime_v1",
"azurefunctions",
"google",
"grpc",
"markupsafe",
"proxy_worker",
"proxy_worker/protos/FunctionRpc_pb2.py",
"proxy_worker/protos/FunctionRpc_pb2_grpc.py",
"proxy_worker/protos/_src",
"proxy_worker/protos/identity",
"proxy_worker/protos/identity/ClaimsIdentityRpc_pb2.py",
"proxy_worker/protos/identity/ClaimsIdentityRpc_pb2_grpc.py",
"proxy_worker/protos/shared",
"proxy_worker/protos/shared/NullableTypes_pb2.py",
"proxy_worker/protos/shared/NullableTypes_pb2_grpc.py",
"six.py",
"uvloop",
"werkzeug",
"worker.py"
)
$missing = @()
foreach ($item in $expected) {
$path = Join-Path $root $item
if (-not (Test-Path $path)) {
$missing += $item
}
}
# === gRPC check ===
$grpcPattern = "*$(majorVersion)$(minorVersion)*-${{ parameters.grpcBuild }}"
$grpcMatch = Get-ChildItem -Path $cythonDir -Name -ErrorAction SilentlyContinue |
Where-Object { $_ -like $grpcPattern }
if (-not $grpcMatch) {
$missing += "grpc/_cython/$grpcPattern"
} else {
Write-Host "✅ Found gRPC binary: $grpcMatch"
}
if ($missing.Count -gt 0) {
Write-Error "Validation failed. Missing expected files/folders:`n$($missing -join "`n")"
exit 1
}
else {
Write-Host "✅ Validation passed. All expected files/folders are present."
}
displayName: "Validate proxy_worker artifact contents"
condition: eq(variables['proxyWorker'], true)