Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 02bb1e0

Browse files
committed
Azure DevOps Updates
1 parent 2883aea commit 02bb1e0

6 files changed

Lines changed: 274 additions & 22 deletions

File tree

.github/workflows/azure-artifacts-publish.yml renamed to .github/workflows/publish-nupkg.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
name: Build and Publish to Azure Artifacts
1+
name: Build and Publish to Azure Artifacts / GitHub Packages
22

33
on:
44
release:
55
types: [published]
66

77
env:
8-
AZURE_ARTIFACTS_FEED_URL: https://pkgs.dev.azure.com/intuitionps/01c84548-9607-4655-80e7-6ad95390a38c/_packaging/private/nuget/v3/index.json
8+
AZURE_ARTIFACTS_FEED_URL: https://pkgs.dev.azure.com/intuitionps/01c84548-9607-4655-80e7-6ad95390a38c/_packaging/private/nuget/v3/index.json
9+
GITHUB_PACKAGES_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
10+
PROJECT_NAME: Ellucian.Ethos.Integration
911
BUILD_CONFIGURATION: 'Release' # set this to the appropriate build configuration
10-
DOTNET_VERSION: '6.x'
11-
12+
DOTNET_VERSION: '6.x'
13+
1214
jobs:
1315
build:
14-
runs-on: ubuntu-latest
16+
runs-on: windows-latest
1517
steps:
1618
# Checkout the repo
1719
- uses: actions/checkout@v2
@@ -25,13 +27,15 @@ jobs:
2527
# Run dotnet build and test
2628
- name: dotnet build and test
2729
run: |
30+
dotnet nuget add source ${{ env.GITHUB_PACKAGES_URL }} --name intuitionps --username ${{ github.actor }} --password ${{ secrets.GH_PACKAGES_PAT }}
31+
dotnet nuget add source https://api.nuget.org/v3/index.json -name nugetorg
2832
dotnet restore
2933
dotnet build --configuration '${{ env.BUILD_CONFIGURATION }}'
3034
dotnet test --configuration '${{ env.BUILD_CONFIGURATION }}'
3135
3236
az-artifacts-build-and-deploy:
3337
needs: build
34-
runs-on: ubuntu-latest
38+
runs-on: windows-latest
3539
steps:
3640
# Checkout the repo
3741
- uses: actions/checkout@v2
@@ -52,14 +56,16 @@ jobs:
5256
# Run dotnet build and package
5357
- name: dotnet build and publish
5458
run: |
59+
dotnet nuget add source ${{ env.GITHUB_PACKAGES_URL }} --name intuitionps --username ${{ github.actor }} --password ${{ secrets.GH_PACKAGES_PAT }}
60+
dotnet nuget add source https://api.nuget.org/v3/index.json -name nugetorg
5561
dotnet restore
5662
dotnet build --configuration '${{ env.BUILD_CONFIGURATION }}' /p:Version=${{ github.event.release.tag_name }}
5763
dotnet pack -c '${{ env.BUILD_CONFIGURATION }}'
5864
59-
# Publish the package to Azure Artifacts
65+
# Publish the package to Azure Artifacts | must specify our version since the ellucian-developer/integration-sdk-csharp gets packaged as well
6066
- name: 'dotnet publish to Azure Artifacts'
61-
run: dotnet nuget push --api-key AzureArtifacts Ellucian.Ethos.Integration/bin/Release/Ellucian.Ethos.Integration.${{ github.event.release.tag_name }}.nupkg
67+
run: dotnet nuget push --api-key AzureArtifacts ${{ env.PROJECT_NAME }}.${{ github.event.release.tag_name }}\bin\Release\*.nupkg
6268

63-
# Publish the package to GitHub Packages
69+
# Publish the package to GitHub Packages | must specify our version since the ellucian-developer/integration-sdk-csharp gets packaged as well
6470
- name: 'dotnet publish to GitHub Packages'
65-
run: dotnet nuget push --api-key ${{ secrets.GH_PACKAGES_PAT }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json Ellucian.Ethos.Integration/bin/Release/Ellucian.Ethos.Integration.${{ github.event.release.tag_name }}.nupkg
71+
run: dotnet nuget push --api-key ${{ secrets.GH_PACKAGES_PAT }} --source ${{ env.GITHUB_PACKAGES_URL }} ${{ env.PROJECT_NAME }}.${{ github.event.release.tag_name }}\bin\Release\*.nupkg

Ellucian.Ethos.Integration/Ellucian.Ethos.Integration.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The Ethos Integration SDK makes the application development process less expensi
3131
<PackageReadmeFile>README.md</PackageReadmeFile>
3232
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
3333
<PackageProjectUrl>https://github.com/ellucian-developer/integration-sdk-csharp</PackageProjectUrl>
34+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
3435
</PropertyGroup>
3536

3637
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"version": 1,
3+
"dependencies": {
4+
"net6.0": {
5+
"Microsoft.Extensions.DependencyInjection": {
6+
"type": "Direct",
7+
"requested": "[6.0.0, )",
8+
"resolved": "6.0.0",
9+
"contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==",
10+
"dependencies": {
11+
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
12+
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
13+
}
14+
},
15+
"Microsoft.Extensions.Http": {
16+
"type": "Direct",
17+
"requested": "[6.0.0, )",
18+
"resolved": "6.0.0",
19+
"contentHash": "15+pa2G0bAMHbHewaQIdr/y6ag2H3yh4rd9hTXavtWDzQBkvpe2RMqFg8BxDpcQWssmjmBApGPcw93QRz6YcMg==",
20+
"dependencies": {
21+
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
22+
"Microsoft.Extensions.Logging": "6.0.0",
23+
"Microsoft.Extensions.Logging.Abstractions": "6.0.0",
24+
"Microsoft.Extensions.Options": "6.0.0"
25+
}
26+
},
27+
"Newtonsoft.Json": {
28+
"type": "Direct",
29+
"requested": "[13.0.1, )",
30+
"resolved": "13.0.1",
31+
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
32+
},
33+
"Microsoft.Extensions.DependencyInjection.Abstractions": {
34+
"type": "Transitive",
35+
"resolved": "6.0.0",
36+
"contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg=="
37+
},
38+
"Microsoft.Extensions.Logging": {
39+
"type": "Transitive",
40+
"resolved": "6.0.0",
41+
"contentHash": "eIbyj40QDg1NDz0HBW0S5f3wrLVnKWnDJ/JtZ+yJDFnDj90VoPuoPmFkeaXrtu+0cKm5GRAwoDf+dBWXK0TUdg==",
42+
"dependencies": {
43+
"Microsoft.Extensions.DependencyInjection": "6.0.0",
44+
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
45+
"Microsoft.Extensions.Logging.Abstractions": "6.0.0",
46+
"Microsoft.Extensions.Options": "6.0.0",
47+
"System.Diagnostics.DiagnosticSource": "6.0.0"
48+
}
49+
},
50+
"Microsoft.Extensions.Logging.Abstractions": {
51+
"type": "Transitive",
52+
"resolved": "6.0.0",
53+
"contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA=="
54+
},
55+
"Microsoft.Extensions.Options": {
56+
"type": "Transitive",
57+
"resolved": "6.0.0",
58+
"contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==",
59+
"dependencies": {
60+
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
61+
"Microsoft.Extensions.Primitives": "6.0.0"
62+
}
63+
},
64+
"Microsoft.Extensions.Primitives": {
65+
"type": "Transitive",
66+
"resolved": "6.0.0",
67+
"contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==",
68+
"dependencies": {
69+
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
70+
}
71+
},
72+
"System.Diagnostics.DiagnosticSource": {
73+
"type": "Transitive",
74+
"resolved": "6.0.0",
75+
"contentHash": "frQDfv0rl209cKm1lnwTgFPzNigy2EKk1BS3uAvHvlBVKe5cymGyHO+Sj+NLv5VF/AhHsqPIUUwya5oV4CHMUw==",
76+
"dependencies": {
77+
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
78+
}
79+
},
80+
"System.Runtime.CompilerServices.Unsafe": {
81+
"type": "Transitive",
82+
"resolved": "6.0.0",
83+
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
84+
}
85+
}
86+
}
87+
}

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Ellucian Ethos Integration SDK
22
> Modifications by Intuition Payment Solutions
33
4+
![Azure DevOps Release Pipeline Status](https://vsrm.dev.azure.com/intuitionps/_apis/public/Release/badge/01c84548-9607-4655-80e7-6ad95390a38c/18/46)
5+
6+
[![Build and Publish to Azure Artifacts / GitHub Packages](https://github.com/iNtuitionPS/ethos-integration-sdk-fork/actions/workflows/publish-nupkg.yml/badge.svg)](https://github.com/iNtuitionPS/ethos-integration-sdk-fork/actions/workflows/publish-nupkg.yml)
7+
8+
| Branch | Build Pipeline Status |
9+
|:---|:---|
10+
| `main` | <img align="center" src="https://dev.azure.com/intuitionps/iNtuition%20API%20Service%20Environment/_apis/build/status%2FBuild%20Pipeline%20-%20CI%20%5B%20Ethos%20Integration%20SDK%20%5D?branchName=main"> |
11+
| `developmment` | N/A |
12+
13+
#
14+
415
Ethos Integration SDK provides utilities and libraries that make it easier for developers to quickly start building Ethos-based integrations.
516

617
The Ethos Integration SDK for .NET allows you to easily develop applications in C# that integrate with Ellucian Ethos Integration. The SDK

_azure-pipelines-CI.yml

Lines changed: 112 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build Pipeline - Continuous Integration
2-
# if trigger is not merge commit from pull request, then pipeline will abort
2+
# if commit is not from a pull request, then the pipeline will abort - bypass this check by setting the SkipPullRequestCheck variable at queue time
33

44
trigger:
55
- main
@@ -12,41 +12,124 @@ pool:
1212
variables:
1313
solution: '**/*.sln'
1414
buildPlatform: 'Any CPU'
15-
buildConfiguration: 'Release'
15+
NUGET_PACKAGES: $(Pipeline.Workspace)/.nuget/packages
1616

1717
steps:
18+
- checkout: self
19+
persistCredentials: true
20+
1821
- task: PowerShell@2
1922
displayName: Get Pull Request
23+
condition: and(succeeded(), eq(variables['SkipPullRequestCheck'], ''))
2024
inputs:
2125
targetType: 'inline'
2226
script: |
2327
try {
2428
$headers = @{ "Authorization" = "Bearer $(GitHubToken)"}
2529
$uri = 'https://api.github.com/repos/$(Build.Repository.Name)/commits/$(Build.SourceVersion)/pulls'
30+
Write-Output "uri = $uri"
2631
$response = Invoke-WebRequest -Uri $uri -Headers $headers -Method Get
2732
$content = $response.content | ConvertFrom-Json
28-
if (-not($content -and $content[0] -and $content[0].id)) {
29-
throw "** abort non-PR commit"
33+
# Check if the $content is not empty and iterate through each pull request
34+
if (-not ($content -and $content.Count -gt 0)) {
35+
Write-Host "##vso[task.logissue type=error;]Failed: Commit is not from a pull request."
36+
exit 1
37+
}
38+
$matchedPullRequest = $null
39+
foreach ($pullRequest in $content) {
40+
if ($pullRequest.merge_commit_sha -eq "$(Build.SourceVersion)") {
41+
$matchedPullRequest = $pullRequest
42+
break
43+
}
44+
}
45+
# Check if a matching pull request was found
46+
if (-not $matchedPullRequest) {
47+
Write-Host "##vso[task.logissue type=error;]Failed: No pull request found with merge commit SHA = '$(Build.SourceVersion)'."
48+
exit 1
3049
}
50+
# If a matching pull request is found, set the variables and continue
51+
Write-Host "##vso[task.setvariable variable=pullRequestHeadRef;]$($matchedPullRequest.head.ref)"
52+
Write-Host "##vso[task.setvariable variable=pullRequestBaseRef;]$($matchedPullRequest.base.ref)"
3153
} catch {
32-
Write-Host "Error getting pull request | $_"
54+
Write-Host "##vso[task.logissue type=error;]Error getting pull request - | $_"
3355
exit 1
3456
}
57+
58+
- task: PowerShell@2
59+
displayName: Reset Development Branch
60+
condition: and(succeeded(), eq(variables['SkipPullRequestCheck'], ''))
61+
inputs:
62+
targetType: 'inline'
63+
script: |
64+
if ("$(pullRequestHeadRef)" -eq "development" -and "$(pullRequestBaseRef)" -eq "main") {
65+
# Define required headers for Azure DevOps | url is pulled from 'common' variable group in library
66+
$azureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$(AzureDevOpsToken)")); "Content-Type" = "application/json"}
67+
# Define the base URL for Azure DevOps API
68+
$azureDevOpsRequestUri = "$(AzureDevOpsBuildApiUrl)/_apis/build/definitions/$(System.DefinitionId)?api-version=7.0"
69+
try {
70+
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", "$(GitHubToken)")))
71+
# Get the current pipeline definition
72+
$current_definition = Invoke-RestMethod -Method Get -Uri $azureDevOpsRequestUri -Headers $azureDevOpsAuthenicationHeader
73+
# Disable build pipeline
74+
$current_definition.queueStatus = "disabled"
75+
$disabled_definition = $current_definition | ConvertTo-Json -Depth 100
76+
Invoke-RestMethod -Method Put -Uri $azureDevOpsRequestUri -Headers $azureDevOpsAuthenicationHeader -Body $disabled_definition
77+
# Perform the reset
78+
git config user.email "no-reply@intuitionps.com"
79+
git config user.name "intuitionps Azure DevOps"
80+
git checkout development
81+
if ($LASTEXITCODE -ne 0) { throw "git checkout development" }
82+
git fetch origin
83+
if ($LASTEXITCODE -ne 0) { throw "git fetch origin" }
84+
git reset --hard origin/main
85+
if ($LASTEXITCODE -ne 0) { throw "git reset --hard origin/main" }
86+
git push --force origin development
87+
if ($LASTEXITCODE -ne 0) { throw "git push --force origin development" }
88+
Write-Host "Successfully reset development branch from main branch."
89+
} catch {
90+
Write-Host "##vso[task.logissue type=error;]Error resetting development branch with main branch - | $_"
91+
} finally {
92+
try {
93+
# Get the current pipeline definition
94+
$current_definition = Invoke-RestMethod -Method Get -Uri $azureDevOpsRequestUri -Headers $azureDevOpsAuthenicationHeader
95+
# Enable build pipeline
96+
$current_definition.queueStatus = "enabled"
97+
$enabled_definition = $current_definition | ConvertTo-Json -Depth 100
98+
Invoke-RestMethod -Method Put -Uri $azureDevOpsRequestUri -Headers $azureDevOpsAuthenicationHeader -Body $enabled_definition
99+
} catch {
100+
Write-Host "##vso[task.logissue type=error;]Error re-enabling build pipeline - | $_"
101+
}
102+
}
103+
} else {
104+
Write-Host "##vso[task.logissue type=warning;]Aborted: Only reset if base branch is 'main' and head branch is 'development'."
105+
}
106+
ignoreLASTEXITCODE: true
35107

36108
- task: NuGetToolInstaller@1
37109
displayName: Install NuGet Tool
38110

111+
- task: Cache@2
112+
displayName: Cache NuGet packages
113+
inputs:
114+
key: 'nuget | "$(Agent.OS)" | **/packages.lock.json,!**/bin/**,!**/obj/**'
115+
restoreKeys: |
116+
nuget | "$(Agent.OS)"
117+
nuget
118+
path: '$(NUGET_PACKAGES)'
119+
39120
- task: NuGetCommand@2
40121
displayName: Restore Solution
41122
inputs:
42123
restoreSolution: '$(solution)'
124+
feedsToUse: 'select'
125+
vstsFeed: '01c84548-9607-4655-80e7-6ad95390a38c/3823d26d-e8ca-40c4-a6f3-c3bd13f9658b'
43126

44127
- task: SonarQubePrepare@5
45128
displayName: SonarQube - Prepare Analysis Configuration
46129
inputs:
47130
SonarQube: 'SonarQube'
48131
scannerMode: 'MSBuild'
49-
projectKey: 'Ethos-Integration-SDK'
132+
projectKey: '$(SonarQubeProjectKey)'
50133

51134
- task: VSBuild@1
52135
displayName: Build Solution
@@ -64,9 +147,30 @@ steps:
64147
inputs:
65148
pollingTimeoutSec: '300'
66149

67-
- task: sonar-buildbreaker@8
150+
- task: PowerShell@2
151+
displayName: SonarQube - Get Project Status
68152
inputs:
69-
SonarQube: 'SonarQube'
153+
targetType: 'inline'
154+
script: |
155+
try {
156+
$headers = @{
157+
"Content-Type" = "application/json"
158+
"Authorization" = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$(SonarQubeToken):"))
159+
}
160+
$uri = 'https://ca-intuition-devops-sonarqube.azurewebsites.net/api/qualitygates/project_status?projectKey=$(SonarQubeProjectKey)&branch=$(Build.SourceBranchName)'
161+
Write-Output "uri = $uri"
162+
$response = Invoke-WebRequest -Uri $uri -Headers $headers -Method Get
163+
$content = $response.Content | ConvertFrom-Json
164+
$status = $content.projectStatus.status
165+
Write-Output "SonarQube Project Status = $status"
166+
if ($content.projectStatus.status -eq "ERROR") {
167+
Write-Host "##vso[task.logissue type=error;]Failed: Code analysis did not pass SonarQube quality gate."
168+
exit 1
169+
}
170+
} catch {
171+
Write-Host "##vso[task.logissue type=error;]Error getting project status - | $_"
172+
exit 1
173+
}
70174
71175
- task: PublishBuildArtifacts@1
72176
displayName: Publish Pipeline Artifacts

0 commit comments

Comments
 (0)