From 5bedea604c9ab964cd2f25f12fc3835acb070758 Mon Sep 17 00:00:00 2001 From: Mohamed Bilal Date: Wed, 28 Aug 2019 11:39:48 +0530 Subject: [PATCH 01/26] Updated telemetry header to include java runtime version --- .../java/com/microsoft/graph/httpcore/TelemetryHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java b/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java index 3e0b8ec06..d6730ce23 100644 --- a/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java +++ b/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java @@ -13,6 +13,7 @@ public class TelemetryHandler implements Interceptor{ public static final String SDK_VERSION = "SdkVersion"; public static final String VERSION = "v1.0.0"; public static final String GRAPH_VERSION_PREFIX = "graph-java-core"; + public static final String JAVA_VERSION_PREFIX = "java"; public static final String CLIENT_REQUEST_ID = "client-request-id"; @Override @@ -25,7 +26,8 @@ public Response intercept(Chain chain) throws IOException { telemetryOptions = new TelemetryOptions(); String featureUsage = "(featureUsage=" + telemetryOptions.getFeatureUsage() + ")"; - String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage; + String javaVersion = System.getProperty("java.version"); + String sdkversion_value = GRAPH_VERSION_PREFIX + "/" + VERSION + " " + featureUsage + " " + JAVA_VERSION_PREFIX + "/" + javaVersion; telemetryAddedBuilder.addHeader(SDK_VERSION, sdkversion_value); if(request.header(CLIENT_REQUEST_ID) == null) { From 03112554599cbabd40ac42ef3a4652a54d58ed61 Mon Sep 17 00:00:00 2001 From: Mohamed Bilal Date: Wed, 28 Aug 2019 11:51:44 +0530 Subject: [PATCH 02/26] Updated patch version --- gradle.properties | 2 +- readme.md | 4 ++-- .../java/com/microsoft/graph/httpcore/TelemetryHandler.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 77dfc55e9..5203616e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -27,7 +27,7 @@ mavenGroupId = com.microsoft.graph mavenArtifactId = microsoft-graph-core mavenMajorVersion = 1 mavenMinorVersion = 0 -mavenPatchVersion = 0 +mavenPatchVersion = 1 mavenArtifactSuffix = nightliesUrl = http://dl.bintray.com/MicrosoftGraph/Maven diff --git a/readme.md b/readme.md index eaf78529e..d16859cdd 100644 --- a/readme.md +++ b/readme.md @@ -19,7 +19,7 @@ repository { dependency { // Include the sdk as a dependency - compile('com.microsoft.graph:microsoft-graph-core:1.0.0') + compile('com.microsoft.graph:microsoft-graph-core:1.0.1') } ``` @@ -29,7 +29,7 @@ Add the dependency in `dependencies` in pom.xml com.microsoft.graph microsoft-graph-core - 1.0.0 + 1.0.1 ``` diff --git a/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java b/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java index d6730ce23..e9a84bbc4 100644 --- a/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java +++ b/src/main/java/com/microsoft/graph/httpcore/TelemetryHandler.java @@ -11,7 +11,7 @@ public class TelemetryHandler implements Interceptor{ public static final String SDK_VERSION = "SdkVersion"; - public static final String VERSION = "v1.0.0"; + public static final String VERSION = "v1.0.1"; public static final String GRAPH_VERSION_PREFIX = "graph-java-core"; public static final String JAVA_VERSION_PREFIX = "java"; public static final String CLIENT_REQUEST_ID = "client-request-id"; From bba6234bfab61e6c5649e12e9e941b8775980cf7 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 17 Jun 2020 12:49:51 -0700 Subject: [PATCH 03/26] Set up CI with Azure Pipelines [skip ci] --- .azure-pipelines/prValidate.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .azure-pipelines/prValidate.yml diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml new file mode 100644 index 000000000..aa912913d --- /dev/null +++ b/.azure-pipelines/prValidate.yml @@ -0,0 +1,19 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +trigger: +- master + +pool: + vmImage: 'ubuntu-latest' + +steps: +- script: echo Hello, world! + displayName: 'Run a one-line script' + +- script: | + echo Add other tasks to build, test, and deploy your project. + echo See https://aka.ms/yaml + displayName: 'Run a multi-line script' From ce298e2449dad57b5ea19bc07383a6dc53915e60 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Wed, 17 Jun 2020 15:00:46 -0700 Subject: [PATCH 04/26] add validate script --- Scripts/validateMavenVersion.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Scripts/validateMavenVersion.ps1 diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 new file mode 100644 index 000000000..e69de29bb From fa4945fad1a32f44238008da56a7a9905dc5fc24 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 17 Jun 2020 15:04:56 -0700 Subject: [PATCH 05/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 61 +++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index aa912913d..e358edc5a 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -3,17 +3,58 @@ # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml -trigger: -- master -pool: - vmImage: 'ubuntu-latest' +pr: + branches: + include: + -master + -main + -dev + paths: + exclude: + - .azure-pipelines + - .gradle/wrapper + - .gitignore + - CONTRIBUTING.md + - LICENSE + - THIRD PARTY NOTICES + - gradle.properties + - gradlew + - gradlew.bat + - readme.md + - settings.gradle + +trigger: none # disable triggers based on commits. + +variables: + PACKAGE_NAME: 'microsoft.graph.core' + PROJECT_PATH: '.\src\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj' + +pool: + vmImage: windows-latest steps: -- script: echo Hello, world! - displayName: 'Run a one-line script' +- checkout: self + clean: true + fetchDepth: 1 + +- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 + displayName: 'Run CredScan' + inputs: + debugMode: false + +- task: PowerShell@2 + condition: $(Build.SourceBranchName) != dev + inputs: + filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' + pwsh: true + -- script: | - echo Add other tasks to build, test, and deploy your project. - echo See https://aka.ms/yaml - displayName: 'Run a multi-line script' +- task: Gradle@2 + inputs: + gradleWrapperFile: 'gradlew' + tasks: 'build' + publishJUnitResults: true + testResultsFiles: '**/TEST-*.xml' + javaHomeOption: 'JDKVersion' + sonarQubeRunAnalysis: false \ No newline at end of file From 07cd2d344812a3afa4961f3b6e259f838992d59b Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 17 Jun 2020 17:17:47 -0700 Subject: [PATCH 06/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index e358edc5a..e2a40effd 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -57,4 +57,15 @@ steps: publishJUnitResults: true testResultsFiles: '**/TEST-*.xml' javaHomeOption: 'JDKVersion' - sonarQubeRunAnalysis: false \ No newline at end of file + sonarQubeRunAnalysis: false + + +- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0 + displayName: 'Graph Client Tooling pipeline fail notification' + inputs: + addressType: serviceEndpoint + serviceEndpointName: 'microsoftgraph pipeline status' + title: '$(Build.DefinitionName) failure notification' + text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' + condition: failed() + enabled: true \ No newline at end of file From 0db442bef409fe2ff3e7525d662fc90fae39b505 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Thu, 18 Jun 2020 17:16:14 -0700 Subject: [PATCH 07/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index e2a40effd..5d5253035 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -7,9 +7,9 @@ pr: branches: include: - -master - -main - -dev + - master + - main + - dev paths: exclude: - .azure-pipelines @@ -44,12 +44,11 @@ steps: debugMode: false - task: PowerShell@2 - condition: $(Build.SourceBranchName) != dev + condition: and(failed(), eq($(Build.SourceBranchName), 'dev') inputs: filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' pwsh: true - - task: Gradle@2 inputs: gradleWrapperFile: 'gradlew' From 1176583356553cee4133e288b7c5dc019bf1ab7d Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Thu, 18 Jun 2020 17:18:35 -0700 Subject: [PATCH 08/26] updated script file to check if the local maven version is greater than those on the repo --- Scripts/validateMavenVersion.ps1 | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index e69de29bb..736ae4ee6 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -0,0 +1,66 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +<# +.Synopsis + Ensure the maven version is updated in the case that the pull request is + to the main/master branch of the repo. +.Description +#> + + + +$fullFileName = $PWD.toString + "\gradle.properties" +$file = get-item $fullFileName +$findVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2 +$localVersions = $findVersions -split "`r`n" + +$localMajorVersion = $localVersions[0] +$localMajorVersion = [int]$localMajorVersion.Substring($localMajorVersion.Length-1) + +$localMinorVersion = $localVersions[1] +$localMinorVersion = [int]$localMinorVersion.Substring($localMinorVersion.Length-1) + +$localPatchVersion = $localVersions[2] +$localPatchVersion = [int]$localPatchVersion.Substring($localPatchVersion.Length-1) + + +$web_client = New-Object System.Net.WebClient + +$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=g:"com.microsoft.graph"+AND+a:"microsoft-graph-core"&core=gav&rows=20&wt=json' +$jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json +$mavenVersions = $jsonResult.response.docs.v.split(".") +$mavenMajorVersion = [int]$mavenVersions[0] +$mavenMinorVersion = [int]$mavenVersions[1] +$mavenPatchVersion = [int]$mavenVersions[2] + +$bintrayAPIurl = 'https://api.bintray.com/search/packages?name=microsoft-graph-core' +$jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json +$bintrayVersions = $jsonResult.latest_version.split(".") +$bintrayMajorVersion = [int]$bintrayVersions[0] +$bintrayMinorVersion = [int]$bintrayVersions[1] +$bintrayPatchVersion = [int]$bintrayVersions[2] + +if(($bintrayMinorVersion -ne $mavenMinorVersion) -OR +($bintrayMajorversion -ne $mavenMajorVersion) -OR +($bintraypatchversion -ne $mavenpatchversion)) +{ + "The current Maven and Bintray versions are not the same" +} +else { + if(($localMajorVersion -gt $bintrayMajorVersion) -OR + ($localMinorVersion -gt $bintrayMinorVersion) -OR + ($localPatchVersion -gt $bintrayPatchVersion)) + { + "The current pull request is of a greater version" + } +} + + + + + + + + + From 062421164c6bcb2a10d840a4908f7835486fbfb5 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Fri, 19 Jun 2020 12:19:57 -0700 Subject: [PATCH 09/26] Update script --- Scripts/validateMavenVersion.ps1 | 39 ++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index 736ae4ee6..517daa2a4 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -29,32 +29,41 @@ $web_client = New-Object System.Net.WebClient $mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=g:"com.microsoft.graph"+AND+a:"microsoft-graph-core"&core=gav&rows=20&wt=json' $jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json -$mavenVersions = $jsonResult.response.docs.v.split(".") -$mavenMajorVersion = [int]$mavenVersions[0] -$mavenMinorVersion = [int]$mavenVersions[1] -$mavenPatchVersion = [int]$mavenVersions[2] +$mavenVersions = $jsonResult.response.docs.v +$mavenSplit = $mavenVersions.split(".") +$mavenMajorVersion = [int]$mavenSplit[0] +$mavenMinorVersion = [int]$mavenSplit[1] +$mavenPatchVersion = [int]$mavenSplit[2] $bintrayAPIurl = 'https://api.bintray.com/search/packages?name=microsoft-graph-core' $jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json -$bintrayVersions = $jsonResult.latest_version.split(".") -$bintrayMajorVersion = [int]$bintrayVersions[0] -$bintrayMinorVersion = [int]$bintrayVersions[1] -$bintrayPatchVersion = [int]$bintrayVersions[2] +$bintrayVersions = $jsonResult.latest_version +$bintraySplit = $bintrayVersions.split(".") +$bintrayMajorVersion = [int]$bintraySplit[0] +$bintrayMinorVersion = [int]$bintraySplit[1] +$bintrayPatchVersion = [int]$bintraySplit[2] + + +write-host 'The current version in the Maven central repository is:' $mavenVersions +write-host 'The current version in the Bintray central repository is:' $bintrayVersions if(($bintrayMinorVersion -ne $mavenMinorVersion) -OR ($bintrayMajorversion -ne $mavenMajorVersion) -OR ($bintraypatchversion -ne $mavenpatchversion)) { - "The current Maven and Bintray versions are not the same" + Write-Warning "The current Maven and Bintray versions are not the same" } -else { - if(($localMajorVersion -gt $bintrayMajorVersion) -OR + +if(($localMajorVersion -gt $bintrayMajorVersion) -OR ($localMinorVersion -gt $bintrayMinorVersion) -OR ($localPatchVersion -gt $bintrayPatchVersion)) - { - "The current pull request is of a greater version" - } -} +{ + write-host "The current pull request is of a greater version" +} +else +{ + write-error "The local version has not been updated or is of an earlier version than that on the remote repository" +} From 106ce1f0590aef891673fcbd97b0e7485efe1d03 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Fri, 19 Jun 2020 12:58:26 -0700 Subject: [PATCH 10/26] Update script --- Scripts/validateMavenVersion.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index 517daa2a4..be954a7bd 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -27,7 +27,7 @@ $localPatchVersion = [int]$localPatchVersion.Substring($localPatchVersion.Length $web_client = New-Object System.Net.WebClient -$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=g:"com.microsoft.graph"+AND+a:"microsoft-graph-core"&core=gav&rows=20&wt=json' +$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=microsoft-graph-core&rows=20&wt=json' $jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json $mavenVersions = $jsonResult.response.docs.v $mavenSplit = $mavenVersions.split(".") From a7f91c596751c072c408d4b0ead902e46e0b77db Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 13:00:35 -0700 Subject: [PATCH 11/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 5d5253035..6060ecffc 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -44,7 +44,7 @@ steps: debugMode: false - task: PowerShell@2 - condition: and(failed(), eq($(Build.SourceBranchName), 'dev') + condition: and(failed(), eq($(Build.SourceBranchName), 'dev')) inputs: filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' pwsh: true From 147f217dcfc108e56523ad1902d1229444112833 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 13:25:59 -0700 Subject: [PATCH 12/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 6060ecffc..be007509f 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -44,7 +44,7 @@ steps: debugMode: false - task: PowerShell@2 - condition: and(failed(), eq($(Build.SourceBranchName), 'dev')) + condition: and(failed, eq(variables['Build.SourceBranchName'], 'dev')) inputs: filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' pwsh: true From bff7e8708f84ef38c60d10caab910b21955c10d1 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 13:27:59 -0700 Subject: [PATCH 13/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index be007509f..f28b930aa 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -44,7 +44,7 @@ steps: debugMode: false - task: PowerShell@2 - condition: and(failed, eq(variables['Build.SourceBranchName'], 'dev')) + condition: and(failed(), eq(variables['Build.SourceBranchName'], 'dev')) inputs: filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' pwsh: true From 507f146e979cf315883e9eba2cde3acddfc5790e Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 14:24:44 -0700 Subject: [PATCH 14/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index f28b930aa..1d45e8b7d 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -27,7 +27,7 @@ pr: trigger: none # disable triggers based on commits. variables: - PACKAGE_NAME: 'microsoft.graph.core' + PACKAGE_NAME: 'microsoft-graph-core' PROJECT_PATH: '.\src\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj' pool: From ba079637570043a8748ee265ddd1dfcfa0790f33 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 14:28:43 -0700 Subject: [PATCH 15/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 1d45e8b7d..e42b3c09c 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -28,7 +28,7 @@ trigger: none # disable triggers based on commits. variables: PACKAGE_NAME: 'microsoft-graph-core' - PROJECT_PATH: '.\src\Microsoft.Graph.Core\Microsoft.Graph.Core.csproj' + GRADLE_PATH: '.\gradle.properties' pool: vmImage: windows-latest From b97fe2131fc4640c00627f9793c8c5ad5dbd97d4 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 14:42:36 -0700 Subject: [PATCH 16/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index e42b3c09c..25f966a43 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -28,7 +28,7 @@ trigger: none # disable triggers based on commits. variables: PACKAGE_NAME: 'microsoft-graph-core' - GRADLE_PATH: '.\gradle.properties' + PROPERTIES_PATH: '.\gradle.properties' pool: vmImage: windows-latest @@ -48,6 +48,7 @@ steps: inputs: filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' pwsh: true + arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"' - task: Gradle@2 inputs: From 91d5dd0799f3243e38d25e1d10f32f74d7edfaf4 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Fri, 19 Jun 2020 14:42:51 -0700 Subject: [PATCH 17/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 25f966a43..3cc4d718b 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -46,7 +46,7 @@ steps: - task: PowerShell@2 condition: and(failed(), eq(variables['Build.SourceBranchName'], 'dev')) inputs: - filePath: '$(System.DefaultWorkingDirectory)/Scripts/validateMavenVersion.ps1' + filePath: '$(System.DefaultWorkingDirectory)\Scripts\validateMavenVersion.ps1' pwsh: true arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"' From 070838f2ef2e76e997890f6f329513d1ea1e1559 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Fri, 19 Jun 2020 14:51:20 -0700 Subject: [PATCH 18/26] Update script --- Scripts/validateMavenVersion.ps1 | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index be954a7bd..50354341a 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -8,10 +8,18 @@ .Description #> +.Parameter packageName +.Parameter propertiesPath +Param( + [parameter(Mandatory = $true)] + [string]$packageName, -$fullFileName = $PWD.toString + "\gradle.properties" -$file = get-item $fullFileName + [parameter(Mandatory = $true)] + [string]$propertiesPath +) + +$file = get-item $propertiesPath $findVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2 $localVersions = $findVersions -split "`r`n" @@ -24,10 +32,9 @@ $localMinorVersion = [int]$localMinorVersion.Substring($localMinorVersion.Length $localPatchVersion = $localVersions[2] $localPatchVersion = [int]$localPatchVersion.Substring($localPatchVersion.Length-1) - $web_client = New-Object System.Net.WebClient -$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=microsoft-graph-core&rows=20&wt=json' +$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=$packageName&rows=20&wt=json' $jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json $mavenVersions = $jsonResult.response.docs.v $mavenSplit = $mavenVersions.split(".") @@ -35,7 +42,7 @@ $mavenMajorVersion = [int]$mavenSplit[0] $mavenMinorVersion = [int]$mavenSplit[1] $mavenPatchVersion = [int]$mavenSplit[2] -$bintrayAPIurl = 'https://api.bintray.com/search/packages?name=microsoft-graph-core' +$bintrayAPIurl = 'https://api.bintray.com/search/packages?name=$packageName' $jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json $bintrayVersions = $jsonResult.latest_version $bintraySplit = $bintrayVersions.split(".") @@ -43,26 +50,22 @@ $bintrayMajorVersion = [int]$bintraySplit[0] $bintrayMinorVersion = [int]$bintraySplit[1] $bintrayPatchVersion = [int]$bintraySplit[2] - write-host 'The current version in the Maven central repository is:' $mavenVersions write-host 'The current version in the Bintray central repository is:' $bintrayVersions if(($bintrayMinorVersion -ne $mavenMinorVersion) -OR ($bintrayMajorversion -ne $mavenMajorVersion) -OR -($bintraypatchversion -ne $mavenpatchversion)) -{ +($bintraypatchversion -ne $mavenpatchversion)){ Write-Warning "The current Maven and Bintray versions are not the same" } if(($localMajorVersion -gt $bintrayMajorVersion) -OR ($localMinorVersion -gt $bintrayMinorVersion) -OR - ($localPatchVersion -gt $bintrayPatchVersion)) -{ - write-host "The current pull request is of a greater version" + ($localPatchVersion -gt $bintrayPatchVersion)){ + Write-Host "The current pull request is of a greater version" } -else -{ - write-error "The local version has not been updated or is of an earlier version than that on the remote repository" +else{ + Write-Error "The local version has not been updated or is of an earlier version than that on the remote repository" } From 37581066485d5bd8a180fff6ff62147a41e35a90 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Mon, 22 Jun 2020 00:27:21 -0700 Subject: [PATCH 19/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index 3cc4d718b..f30298ae9 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -67,5 +67,5 @@ steps: serviceEndpointName: 'microsoftgraph pipeline status' title: '$(Build.DefinitionName) failure notification' text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' - condition: failed() + condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) enabled: true \ No newline at end of file From ad035d162c28ebaf0f0e3c470fda0bec1f951b60 Mon Sep 17 00:00:00 2001 From: ramsessanchez Date: Mon, 22 Jun 2020 00:32:49 -0700 Subject: [PATCH 20/26] Updated script file reflecting the feedback and requested fixes --- Scripts/validateMavenVersion.ps1 | 66 ++++++++++++-------------------- 1 file changed, 24 insertions(+), 42 deletions(-) diff --git a/Scripts/validateMavenVersion.ps1 b/Scripts/validateMavenVersion.ps1 index 50354341a..282567a45 100644 --- a/Scripts/validateMavenVersion.ps1 +++ b/Scripts/validateMavenVersion.ps1 @@ -6,6 +6,9 @@ Ensure the maven version is updated in the case that the pull request is to the main/master branch of the repo. .Description + Retrieves the local, Maven, and Bintray versions of the Java-Core build. + Checks that the Maven and Bintray versions are aligned, trigger warning if not. + Checks that the current local version is greater than those currently deployed. #> .Parameter packageName @@ -19,60 +22,39 @@ Param( [string]$propertiesPath ) +#Find the local version from the Gradle.Properties file $file = get-item $propertiesPath -$findVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2 -$localVersions = $findVersions -split "`r`n" +$findLocalVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2 +$findLocalVersions = $findLocalVersions -split "`r`n" -$localMajorVersion = $localVersions[0] -$localMajorVersion = [int]$localMajorVersion.Substring($localMajorVersion.Length-1) - -$localMinorVersion = $localVersions[1] -$localMinorVersion = [int]$localMinorVersion.Substring($localMinorVersion.Length-1) - -$localPatchVersion = $localVersions[2] -$localPatchVersion = [int]$localPatchVersion.Substring($localPatchVersion.Length-1) +$localMajor = $findLocalVersions[0].Substring($findLocalVersions[0].Length-1) +$localMinor = $findLocalVersions[1].Substring($findLocalVersions[1].Length-1) +$localPatch = $findLocalVersions[2].Substring($findLocalVersions[2].Length-1) +$localVersion = [version]"$localMajor.$localMinor.$localPatch" +#Set Web Client and retrieve Maven and Bintray versions from their respective repos. $web_client = New-Object System.Net.WebClient -$mavenAPIurl = 'https://search.maven.org/solrsearch/select?q=$packageName&rows=20&wt=json' +$mavenAPIurl = "https://search.maven.org/solrsearch/select?q=$packageName&rows=20&wt=json" $jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json -$mavenVersions = $jsonResult.response.docs.v -$mavenSplit = $mavenVersions.split(".") -$mavenMajorVersion = [int]$mavenSplit[0] -$mavenMinorVersion = [int]$mavenSplit[1] -$mavenPatchVersion = [int]$mavenSplit[2] +$mavenVersion = [version]$jsonResult.response.docs.latestVersion -$bintrayAPIurl = 'https://api.bintray.com/search/packages?name=$packageName' +$bintrayAPIurl = "https://api.bintray.com/search/packages?name=$packageName" $jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json -$bintrayVersions = $jsonResult.latest_version -$bintraySplit = $bintrayVersions.split(".") -$bintrayMajorVersion = [int]$bintraySplit[0] -$bintrayMinorVersion = [int]$bintraySplit[1] -$bintrayPatchVersion = [int]$bintraySplit[2] +$bintrayVersion = [version]$jsonResult.latest_version -write-host 'The current version in the Maven central repository is:' $mavenVersions -write-host 'The current version in the Bintray central repository is:' $bintrayVersions +#Inform host of current Maven and Bintray versions +write-host 'The current version in the Maven central repository is:' $mavenVersion +write-host 'The current version in the Bintray central repository is:' $bintrayVersion -if(($bintrayMinorVersion -ne $mavenMinorVersion) -OR -($bintrayMajorversion -ne $mavenMajorVersion) -OR -($bintraypatchversion -ne $mavenpatchversion)){ +#Warn in case Maven and Bintray versions are not the same. +if($mavenVersion -ne $bintrayVersion){ Write-Warning "The current Maven and Bintray versions are not the same" } - -if(($localMajorVersion -gt $bintrayMajorVersion) -OR - ($localMinorVersion -gt $bintrayMinorVersion) -OR - ($localPatchVersion -gt $bintrayPatchVersion)){ +#Success if Local version has been updated, Error otherwise. +if($localVersion -gt $bintrayVersion){ Write-Host "The current pull request is of a greater version" } else{ - Write-Error "The local version has not been updated or is of an earlier version than that on the remote repository" -} - - - - - - - - - + Write-Error "The current local version is not updated. Please update the local version in the Gradle.Properties file." +} \ No newline at end of file From 05d14af84df5dd5e3c00995b13d4e39b3e8ebb3e Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Tue, 23 Jun 2020 09:53:03 -0700 Subject: [PATCH 21/26] Update prValidate.yml --- .azure-pipelines/prValidate.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index f30298ae9..c07665fd0 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -1,9 +1,4 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - - +# Build and test Java Core to make sure a valid pull request is being made pr: branches: include: @@ -68,4 +63,4 @@ steps: title: '$(Build.DefinitionName) failure notification' text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) - enabled: true \ No newline at end of file + enabled: true From f2b43ff6127db888e204faba5f62e0796aa70056 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Tue, 23 Jun 2020 17:10:10 -0700 Subject: [PATCH 22/26] Set up CI with Azure Pipelines [skip ci] --- .azure-pipelines/buildAndPackage.yml | 91 ++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .azure-pipelines/buildAndPackage.yml diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml new file mode 100644 index 000000000..dc49c769d --- /dev/null +++ b/.azure-pipelines/buildAndPackage.yml @@ -0,0 +1,91 @@ +trigger: + branches: + include: + - dev + - main + - master + paths: + include: + - src/* + exclude: + - .gitignore + - CONTRIBUTING.md + - LICENSE + - THIRD PARTY NOTICES + - build.gradle + - gradle.properties + - gradlew + - gradlew.bat + - readme.md + - settings.gradle + +pr: none + +pool: + vmImage: 'windows-latest' + +steps: +- checkout: self + clean: true + fetchDepth: 1 + +- task: DownloadSecureFile@1 + inputs: + secureFile: 'local.properties' + +- task: DownloadSecureFile@1 + inputs: + secureFile: 'secring.gpg' + +- task: DownloadSecureFile@1 + inputs: + secureFile: 'secring.gpg.lock' + +- task: CopyFiles@2 + inputs: + SourceFolder: '$(Agent.TempDirectory)' + Contents: '**' + TargetFolder: '$(System.DefaultWorkingDirectory)' + +- task: Gradle@2 + inputs: + gradleWrapperFile: 'gradlew' + tasks: 'build' + publishJUnitResults: true + testResultsFiles: '**/TEST-*.xml' + javaHomeOption: 'JDKVersion' + sonarQubeRunAnalysis: false + +- task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: drop' + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + +- task: CopyFiles@2 + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)' + Contents: | + **/libs/* + build.gradle + gradlew + gradlew.bat + settings.gradle + gradle.properties + **/gradle/wrapper/* + TargetFolder: '$(Build.ArtifactStagingDirectory)/' + +- task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + ArtifactName: 'drop' + publishLocation: 'Container' + +- task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0 + displayName: 'Graph Client Tooling pipeline fail notification' + inputs: + addressType: serviceEndpoint + serviceEndpointName: 'microsoftgraph pipeline status' + title: '$(Build.DefinitionName) failure notification' + text: 'This pipeline has failed. View the build details for further information. This is a blocking failure.' + condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) + enabled: true \ No newline at end of file From 63a7e94a15f97bca0c04980eb5037fdb0b95367a Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 24 Jun 2020 11:53:25 -0700 Subject: [PATCH 23/26] Update buildAndPackage.yml for Azure Pipelines --- .azure-pipelines/buildAndPackage.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index dc49c769d..aa1101135 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -29,6 +29,11 @@ steps: clean: true fetchDepth: 1 +- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 + displayName: 'Run CredScan' + inputs: + debugMode: false + - task: DownloadSecureFile@1 inputs: secureFile: 'local.properties' From b70b126ae68b50268ae8df552ec7e02eafe4225d Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 24 Jun 2020 11:56:07 -0700 Subject: [PATCH 24/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index c07665fd0..f04766b60 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -63,4 +63,4 @@ steps: title: '$(Build.DefinitionName) failure notification' text: 'This pipeline has failed. View the build details for further information. This is a blocking failure. ' condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) - enabled: true + enabled: true \ No newline at end of file From 98d49b8b6900507d4ee91a0070b0cf0bd88536e2 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 24 Jun 2020 11:56:24 -0700 Subject: [PATCH 25/26] Update prValidate.yml for Azure Pipelines --- .azure-pipelines/prValidate.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure-pipelines/prValidate.yml b/.azure-pipelines/prValidate.yml index f04766b60..cdd049d0e 100644 --- a/.azure-pipelines/prValidate.yml +++ b/.azure-pipelines/prValidate.yml @@ -54,7 +54,6 @@ steps: javaHomeOption: 'JDKVersion' sonarQubeRunAnalysis: false - - task: YodLabs.O365PostMessage.O365PostMessageBuild.O365PostMessageBuild@0 displayName: 'Graph Client Tooling pipeline fail notification' inputs: From 77bd5f437b4cfae905308decae007487b03d8f55 Mon Sep 17 00:00:00 2001 From: ramsessanchez <63934382+ramsessanchez@users.noreply.github.com> Date: Wed, 24 Jun 2020 15:54:24 -0700 Subject: [PATCH 26/26] Update buildAndPackage.yml --- .azure-pipelines/buildAndPackage.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.azure-pipelines/buildAndPackage.yml b/.azure-pipelines/buildAndPackage.yml index aa1101135..ad8e81eea 100644 --- a/.azure-pipelines/buildAndPackage.yml +++ b/.azure-pipelines/buildAndPackage.yml @@ -1,3 +1,8 @@ +#Copyright (c) Microsoft Corporation. All rights reserved. +#Licensed under the MIT License. +#Building and packaging the artifacts of the Java-Core libraries using the build.gradle file. +#Ready the package for deployment and release. + trigger: branches: include: @@ -93,4 +98,4 @@ steps: title: '$(Build.DefinitionName) failure notification' text: 'This pipeline has failed. View the build details for further information. This is a blocking failure.' condition: and(failed(), ne(variables['Build.Reason'], 'Manual')) - enabled: true \ No newline at end of file + enabled: true