Skip to content

Commit fa1577d

Browse files
Separate CI-Build and Sdk-Release pipelines (#3462)
* Sdk release and CI-build pipelines are seperated and restructured in Main * weekly pipelines should target main branch * CI build does not pack and sign
1 parent e29d86a commit fa1577d

File tree

4 files changed

+241
-143
lines changed

4 files changed

+241
-143
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 3 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ parameters:
1010
default: true
1111
- name: Pack
1212
type: boolean
13-
default: true
13+
default: false
1414
- name: Sign
1515
type: boolean
16-
default: true
16+
default: false
1717
- name: InternalFeed
1818
type: string
1919
default: '0985d294-5762-4bc2-a565-161ef349ca3e/PowerShell_V2_Build'
@@ -29,22 +29,16 @@ variables:
2929
GitUserName: "Microsoft Graph DevX Tooling"
3030
REGISTRY: 'msgraphprodregistry.azurecr.io'
3131
IMAGE_NAME: 'public/microsoftgraph/powershell'
32-
PREVIEW_BRANCH: 'refs/heads/main' # Updated to target your branch
3332

3433
trigger:
3534
branches:
3635
include:
3736
- main
38-
- dev
39-
tags:
40-
include:
41-
- v*
4237

4338
pr:
4439
branches:
4540
include:
4641
- main
47-
- dev
4842
resources:
4943
repositories:
5044
- repository: 1ESPipelineTemplates
@@ -111,133 +105,4 @@ extends:
111105
FolderPath: "$(Build.ArtifactStagingDirectory)"
112106
Pattern: "Microsoft.Graph*.nupkg"
113107

114-
- template: .azure-pipelines/common-templates/security-post-checks.yml@self
115-
- stage: 'Deploy_to_Internal_Feed'
116-
dependsOn: stage
117-
jobs:
118-
- deployment: 'DeployToInternalFeed'
119-
displayName: 'Deploy to Internal Feed'
120-
environment: 'PowerShellInternalFeed'
121-
templateContext:
122-
type: releaseJob
123-
isProduction: true
124-
inputs:
125-
- input: pipelineArtifact
126-
artifactName: drop
127-
targetPath: '$(System.DefaultWorkingDirectory)/drop'
128-
strategy:
129-
runOnce:
130-
deploy:
131-
steps:
132-
- task: 1ES.PublishNuget@1
133-
displayName: 'Publish NuGet to feed'
134-
inputs:
135-
useDotNetTask: false
136-
packageParentPath: '$(System.DefaultWorkingDirectory)'
137-
packagesToPush: '$(System.DefaultWorkingDirectory)/**/drop/**/*.nupkg'
138-
publishVstsFeed: ${{ parameters.InternalFeed }}
139-
nuGetFeedType: internal
140-
allowPackageConflicts: true
141-
- stage: 'Deploy_to_PsGallery'
142-
dependsOn: stage
143-
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main')) # Only deploy to PSGallery on main branch
144-
jobs:
145-
- deployment: 'DeployToPowerShellGallery'
146-
displayName: 'Deploy to PowerShell Gallery'
147-
environment: 'PowerShellGallery'
148-
templateContext:
149-
type: releaseJob
150-
isProduction: true
151-
inputs:
152-
- input: pipelineArtifact
153-
artifactName: drop
154-
targetPath: '$(System.DefaultWorkingDirectory)/drop'
155-
strategy:
156-
runOnce:
157-
deploy:
158-
steps:
159-
- task: 1ES.PublishNuget@1
160-
displayName: 'Publish NuGet to feed'
161-
inputs:
162-
useDotNetTask: false
163-
packageParentPath: '$(System.DefaultWorkingDirectory)'
164-
packagesToPush: '$(System.DefaultWorkingDirectory)/**/drop/**/*.nupkg'
165-
nuGetFeedType: external
166-
publishFeedCredentials: 'microsoftgraph PowerShell Gallery connection'
167-
168-
- stage: PushDockerImageToRegistry
169-
condition: and(or(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), not(contains(variables['Build.SourceBranch'], '-preview')))
170-
dependsOn: stage
171-
displayName: 'Push docker image'
172-
jobs:
173-
- job: PushDockerImage
174-
displayName: 'Push docker image'
175-
pool:
176-
name: Azure-Pipelines-1ESPT-ExDShared
177-
image: ubuntu-latest
178-
os: linux
179-
steps:
180-
- checkout: self
181-
182-
# Display the contents of the Build.SourcesDirectory
183-
- bash: |
184-
echo "Build.SourcesDirectory: $(Build.SourcesDirectory)"
185-
ls -la $(Build.SourcesDirectory)
186-
displayName: 'List contents of Build.SourcesDirectory'
187-
188-
- task: AzureCLI@2
189-
displayName: "Log in to Azure Container Registry"
190-
inputs:
191-
azureSubscription: 'ACR Images Push Service Connection' # service connection
192-
scriptType: 'bash'
193-
scriptLocation: 'inlineScript'
194-
'inlineScript': |
195-
az acr login --name $(REGISTRY)
196-
- powershell: |
197-
$date = Get-Date -Format "yyyyMMdd"
198-
Write-Host "##vso[task.setvariable variable=currentDate]$date"
199-
200-
- script: |
201-
docker run --privileged --rm tonistiigi/binfmt --install all
202-
displayName: 'Enable multi-platform builds'
203-
204-
- script: |
205-
docker buildx create --use --name mybuilder
206-
displayName: 'Set up Docker BuildX'
207-
208-
- powershell: |
209-
$version = $Env:BUILD_SOURCEBRANCH.replace("refs/tags/", "")
210-
Write-Output "##vso[task.setvariable variable=version]$version"
211-
displayName: 'Get truncated run number'
212-
213-
- bash: |
214-
echo "Build Number: $(Build.BuildNumber)"
215-
# Extract the last 3 characters for the run number
216-
runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$')
217-
echo "Extracted Run Number: $runnumber"
218-
219-
# If extraction fails, set a default
220-
if [ -z "$runnumber" ]; then
221-
echo "Extraction failed, using default value"
222-
runnumber=$(date +"%S%N" | cut -c1-3)
223-
echo "Generated fallback run number: $runnumber"
224-
fi
225-
226-
# Set the variable for later steps
227-
echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber"
228-
echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber"
229-
displayName: 'Get truncated run number'
230-
name: getrunnumber
231-
232-
- bash: |
233-
echo "Building docker images"
234-
# Format the date to be compatible with Docker tags
235-
formatted_date=$(date +"%Y%m%d%H%M%S")
236-
docker buildx build \
237-
--platform linux/amd64 \
238-
--push \
239-
-t "$(REGISTRY)/$(IMAGE_NAME):latest" \
240-
-t "$(REGISTRY)/$(IMAGE_NAME):$formatted_date.$RUNNUMBER" \
241-
"$(Build.SourcesDirectory)"
242-
displayName: 'Build and push docker images'
243-
108+
- template: .azure-pipelines/common-templates/security-post-checks.yml@self

0 commit comments

Comments
 (0)