Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
5bedea6
Updated telemetry header to include java runtime version
Aug 28, 2019
0311255
Updated patch version
Aug 28, 2019
16ee86b
Merge pull request #29 from microsoftgraph/mobilal/telemetry
NakulSabharwal Aug 28, 2019
bba6234
Set up CI with Azure Pipelines
ramsessanchez Jun 17, 2020
ce298e2
add validate script
ramsessanchez Jun 17, 2020
fa4945f
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 17, 2020
07cd2d3
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 18, 2020
0db442b
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
1176583
updated script file to check if the local maven version is greater th…
ramsessanchez Jun 19, 2020
0624211
Update script
ramsessanchez Jun 19, 2020
106ce1f
Update script
ramsessanchez Jun 19, 2020
a7f91c5
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
147f217
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
bff7e87
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
507f146
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
ba07963
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
b97fe21
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
91d5dd0
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 19, 2020
070838f
Update script
ramsessanchez Jun 19, 2020
0282cb6
Merge branch 'rsh/prValidate' of https://github.com/microsoftgraph/ms…
ramsessanchez Jun 19, 2020
3758106
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 22, 2020
ad035d1
Updated script file reflecting the feedback and requested fixes
ramsessanchez Jun 22, 2020
93edbfc
Merge pull request #32 from microsoftgraph/rsh/prValidate
ramsessanchez Jun 22, 2020
05d14af
Update prValidate.yml
ramsessanchez Jun 23, 2020
f2b43ff
Set up CI with Azure Pipelines
ramsessanchez Jun 24, 2020
63a7e94
Update buildAndPackage.yml for Azure Pipelines
ramsessanchez Jun 24, 2020
b70b126
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 24, 2020
98d49b8
Update prValidate.yml for Azure Pipelines
ramsessanchez Jun 24, 2020
77bd5f4
Update buildAndPackage.yml
ramsessanchez Jun 24, 2020
5944b3e
Merge pull request #34 from microsoftgraph/rsh/buildAndPackagePipeline
ramsessanchez Jun 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .azure-pipelines/buildAndPackage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#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:
- 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: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
displayName: 'Run CredScan'
inputs:
debugMode: false

- 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
65 changes: 65 additions & 0 deletions .azure-pipelines/prValidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Build and test Java Core to make sure a valid pull request is being made
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'
PROPERTIES_PATH: '.\gradle.properties'

pool:
vmImage: windows-latest

steps:
- 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: and(failed(), eq(variables['Build.SourceBranchName'], 'dev'))
inputs:
filePath: '$(System.DefaultWorkingDirectory)\Scripts\validateMavenVersion.ps1'
pwsh: true
arguments: '-packageName "$(PACKAGE_NAME)" -propertiesPath "$(PROPERTIES_PATH)"'

- task: Gradle@2
inputs:
gradleWrapperFile: 'gradlew'
tasks: 'build'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
javaHomeOption: 'JDKVersion'
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: and(failed(), ne(variables['Build.Reason'], 'Manual'))
enabled: true
60 changes: 60 additions & 0 deletions Scripts/validateMavenVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 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
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
.Parameter propertiesPath

Param(
[parameter(Mandatory = $true)]
[string]$packageName,

[parameter(Mandatory = $true)]
[string]$propertiesPath
)

#Find the local version from the Gradle.Properties file
$file = get-item $propertiesPath
$findLocalVersions = $file | Select-String -Pattern "mavenMajorVersion" -Context 0,2
$findLocalVersions = $findLocalVersions -split "`r`n"

$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"
$jsonResult = $web_client.DownloadString($mavenAPIurl) | ConvertFrom-Json
$mavenVersion = [version]$jsonResult.response.docs.latestVersion

$bintrayAPIurl = "https://api.bintray.com/search/packages?name=$packageName"
$jsonResult = $web_client.DownloadString($bintrayAPIurl) | ConvertFrom-Json
$bintrayVersion = [version]$jsonResult.latest_version

#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

#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"
}
#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 current local version is not updated. Please update the local version in the Gradle.Properties file."
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}
```

Expand All @@ -29,7 +29,7 @@ Add the dependency in `dependencies` in pom.xml
<dependency>
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-core</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
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";

@Override
Expand All @@ -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) {
Expand Down