Skip to content

Commit 3f1f2ff

Browse files
authored
Merge pull request #2403 from microsoftgraph/ci/esrp-fixes
ci/esrp fixes
2 parents 30c95e7 + a13ce43 commit 3f1f2ff

File tree

4 files changed

+22
-251
lines changed

4 files changed

+22
-251
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ extends:
4343
#TODO maybe missing template context with sdl baselines?
4444
steps:
4545
- checkout: self
46-
persistCredentials: true
4746

4847
- task: JavaToolInstaller@1
4948
inputs:
@@ -68,54 +67,52 @@ extends:
6867
6968
- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
7069
displayName: Publish to local Maven for verification
71-
# condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
70+
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
7271

73-
# - script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
74-
# displayName: Publish to local Maven for verification
75-
# condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
72+
- script: ./gradlew --no-daemon publishToMavenLocal -PmavenCentralPublishingEnabled=true
73+
displayName: Publish to local Maven for verification
74+
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
7675

7776
- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true -PmavenCentralSnapshotArtifactSuffix=""
7877
displayName: Publish to local Maven ADO for ESRP
79-
# condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
78+
condition: contains(variables['build.sourceBranch'], 'refs/tags/v')
8079

81-
# - script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
82-
# displayName: Publish to local Maven ADO for ESRP
83-
# condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
80+
- script: ./gradlew --no-daemon publishMavenPublicationToADORepository -PmavenCentralPublishingEnabled=true
81+
displayName: Publish to local Maven ADO for ESRP
82+
condition: not(contains(variables['build.sourceBranch'], 'refs/tags/v'))
8483

8584
- pwsh: |
8685
$contents = Get-Content gradle.properties -Raw
87-
$major = $contents | Select-String -Pattern 'mavenMajorVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
88-
$minor = $contents | Select-String -Pattern 'mavenMinorVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
89-
$patch = $contents | Select-String -Pattern 'mavenPatchVersion = ([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
90-
# $snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
86+
$major = $contents | Select-String -Pattern 'mavenMajorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
87+
$minor = $contents | Select-String -Pattern 'mavenMinorVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
88+
$patch = $contents | Select-String -Pattern 'mavenPatchVersion\s*=\s*([0-9]+)' | ForEach-Object { $_.Matches.Groups[1].Value }
89+
$snapshot_suffix = if ($Env:BRANCH_NAME.StartsWith('refs/tags/v')) { '' } else { '-SNAPSHOT' }
9190
$version = "$major.$minor.$patch$snapshot_suffix"
9291
echo "Current version is $version"
9392
echo "##vso[task.setvariable variable=PACKAGE_VERSION;]$version"
9493
displayName: Get current version
9594
name: GetVersion
9695
env:
97-
BRANCH_NAME: $(Build.SourceBranchName)
96+
BRANCH_NAME: $(Build.SourceBranch)
9897
9998
- pwsh: |
10099
.\scripts\validatePackageContents.ps1 -ArtifactId microsoft-graph -Version $(PACKAGE_VERSION) -ValidateMavenMetadata $false
101100
displayName: Inspect contents of local Maven cache
102101
103102
- pwsh: |
104-
.\scripts\zipPackageContent.ps1 -OutputDirectory $Env:OUTPUT_DIRECTORY -ArtifactId microsoft-graph -PackageSegment abstractions -Version $(PACKAGE_VERSION)
105-
echo "list of zips:"
106-
Get-ChildItem -Path $Env:OUTPUT_DIRECTORY -Filter "*.zip" | ForEach-Object { Write-Host $_.FullName }
107-
displayName: Zip contents of local Maven cache
108-
env:
109-
OUTPUT_DIRECTORY: $(Build.ArtifactStagingDirectory)
103+
$packageFullPath = Join-Path -Path "./" -ChildPath "build/publishing-repository/com/microsoft/graph/microsoft-graph" -AdditionalChildPath "$(PACKAGE_VERSION)"
104+
echo "Package full path: $packageFullPath"
105+
echo "##vso[task.setvariable variable=PACKAGE_PATH;]$packageFullPath"
106+
displayName: Get the package full path
110107
111108
- task: 1ES.PublishPipelineArtifact@1
112109
displayName: "Publish Artifact: jars"
113110
inputs:
114111
artifactName: jars
115-
targetPath: "$(Build.ArtifactStagingDirectory)"
112+
targetPath: "$(PACKAGE_PATH)"
116113

117114
- stage: deploy
118-
# condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
115+
condition: and(or(contains(variables['build.sourceBranch'], 'refs/tags/v'), eq(variables['build.sourceBranch'], '${{ parameters.previewBranch }}')), succeeded())
119116
dependsOn: build
120117
jobs:
121118
- deployment: deploy_github
@@ -137,7 +134,7 @@ extends:
137134
deploy:
138135
steps:
139136
- pwsh: |
140-
$zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip"
137+
$zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.jar"
141138
$zip = $zips | Select-Object -First 1
142139
$zipName = $zip.Name
143140
if ($zipName -match "\d+.\d+.\d+")
@@ -148,18 +145,9 @@ extends:
148145
}
149146
else
150147
{
151-
Write-Error "No valid version found in zip file name."
148+
Write-Error "No valid version found in jar file name."
152149
exit 1
153150
}
154-
155-
- pwsh: |
156-
$zips = Get-ChildItem -Path "$(Pipeline.Workspace)" -Filter "*.zip"
157-
foreach ($zip in $zips) {
158-
$targetPath = $zip.FullName.Replace(".zip", "")
159-
Expand-Archive -Path $zip.FullName -DestinationPath $targetPath
160-
Remove-Item -Path $zip.FullName -Force
161-
}
162-
displayName: Unzip artifacts
163151
164152
- task: GitHubRelease@1
165153
inputs:
@@ -204,7 +192,7 @@ extends:
204192

205193
- deployment: deploy_maven
206194
# snapshots are not supported by ESRP release for now, but they are planning to add support. When it happens, simply remove the condition
207-
# condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
195+
condition: and(contains(variables['build.sourceBranch'], 'refs/tags/v'), succeeded())
208196
pool:
209197
name: Azure-Pipelines-1ESPT-ExDShared
210198
os: linux

.github/workflows/preview-and-release.yml

Lines changed: 0 additions & 170 deletions
This file was deleted.

build.gradle

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ plugins {
1212
id 'eclipse'
1313
id 'maven-publish'
1414
id 'signing'
15-
// TODO remove this dependency once we remove the GH WF
16-
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
1715
}
1816

1917
java {
@@ -89,20 +87,6 @@ publishing {
8987
}
9088
}
9189

92-
// TODO remove this configuration once we remove the GH WF
93-
nexusPublishing {
94-
repositories {
95-
sonatype {
96-
if (project.rootProject.file('local.properties').exists()) {
97-
Properties properties = new Properties()
98-
properties.load(project.rootProject.file('local.properties').newDataInputStream())
99-
username = properties.getProperty('sonatypeUsername')
100-
password = properties.getProperty('sonatypePassword')
101-
}
102-
}
103-
}
104-
}
105-
10690
group = project.property('mavenGroupId')
10791
version = "${mavenMajorVersion}.${mavenMinorVersion}.${mavenPatchVersion}${mavenCentralSnapshotArtifactSuffix}"
10892

scripts/zipPackageContent.ps1

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)