Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to use shared scripts for build and remove docker use #93

Merged
merged 12 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/PackageManagerClientMSbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Look for PackageManagerClient
run: |
Write-Output "***Locating PackageManagerClient!***"
if (Test-Path -Path "${{ github.workspace }}\PackageManagerClient\bin\Debug\net6.0\Greg.dll") {
if (Test-Path -Path "${{ github.workspace }}\PackageManagerClient\bin\Debug\net8.0\Greg.dll") {
Write-Output "PackageManagerClient exists!"
} else {
Write-Error "PackageManagerClient was not found!"
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### 3.0.1
* switch pipeline.yml scripts to use internal shared scripts
### version 3.0
* update RestSharp to 109.0.1, this comes with many API breaking changes, some affecting us, see below:
* update RestSharp to 108.0.1, this comes with many API breaking changes, some affecting us, see below:
* removal of basic auth - our API no longer makes sense with RestSharp immutable clients.
* switch from newtonsoft.json to system.text.json
* add unit test project
Expand Down
46 changes: 0 additions & 46 deletions cicdscripts/BuildSolution.ps1

This file was deleted.

34 changes: 34 additions & 0 deletions cicdscripts/DownloadCICDResources.ps1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an improvement for later but I feel we can also move this script to the common CICDResources repo as it seems to be common to projects using the repo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I am not sure how we'd do that - this is the script that retrieves the common cicd resources... perhaps we could add something to the CI lib directly?

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<#
Purpose: Pull of the source from git
#>
$ErrorActionPreference = "Stop"

try {

#Redirecting GIT output
$env:GIT_REDIRECT_STDERR = '2>&1'

if ([string]::IsNullOrWhiteSpace($env:URL_REPO_TOOLS) -or [string]::IsNullOrWhiteSpace($env:BRANCH_TOOLS))
{
throw "The tool repository parameters had not been set properly"
}
else
{
$JUser = "$env:GITADSK_USERNAME"
$JPassword = [System.Web.HttpUtility]::UrlEncode("$env:GITADSK_PASSWORD")

$GitUrl = "https://" + "$JUser" + ":" + "$JPassword" + "@$env:URL_REPO_TOOLS"

git clone -b $env:BRANCH_TOOLS "$GitUrl" "$env:WORKSPACE\$env:COMMON_TOOLS_DIR"

if($LASTEXITCODE -ne 0)
{
throw "The download of the tools failed"
}
}

}
catch {
Write-Host $error[0]
throw $LASTEXITCODE
}
25 changes: 0 additions & 25 deletions cicdscripts/ExecuteContainerDeploy.ps1

This file was deleted.

18 changes: 0 additions & 18 deletions cicdscripts/PostDeploy.ps1

This file was deleted.

31 changes: 0 additions & 31 deletions cicdscripts/ProcessNugetPackage.ps1

This file was deleted.

46 changes: 46 additions & 0 deletions cicdscripts/PublishPackage.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[CmdletBinding()]
param (
[Parameter()]
[string[]]
$ReleaseBranches
)

$ErrorActionPreference = "Stop"

$regexBranches = @()
foreach ($branch in $ReleaseBranches -split ",")
{
$regexBranches += "(^" + $branch + "*)"
}
$regex = $regexBranches -join "|"

Write-Host $env:BRANCH_NAME
Write-Host $regex

<#
Regex matching release branches
#>
$reBranch = [regex]$regex

if ($env:BRANCH_NAME -match $reBranch)
{
try {

#deploy already built package.
$assemblyPath = "\bin\release"
$nupkgFile = Get-ChildItem $assemblyPath\*.nupkg -Depth 1
mjkkirschner marked this conversation as resolved.
Show resolved Hide resolved
dotnet nuget push $nupkgFile --api-key $env:API_KEY --source $env:NUGET_PUBLISH_SOURCE

if($LASTEXITCODE -ne 0) {
throw "The package-generation process failed"
}
}
catch {
Write-Host $error[0]
throw $LASTEXITCODE
}
}
else
{
Write-Host("Deployment is skipped because this is not a release branch")
}
26 changes: 0 additions & 26 deletions cicdscripts/RestartDockerDesktop.ps1

This file was deleted.

30 changes: 0 additions & 30 deletions cicdscripts/SetupHost.ps1

This file was deleted.

6 changes: 6 additions & 0 deletions config/nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
66 changes: 44 additions & 22 deletions pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
version: 0.1.1
env:
- JENKINS_NODE_WIN: "DynamoDockerWin"
- JENKINS_NODE_WIN: "Dynamo_Win_Perf"
- SLACK_QUANTUM_BUILD_CHANNEL : "#dynamo-jenkinsbuild"
- SLACK_QUANTUM_BUILD_CREDENTIAL_ID : "slack-notify-token"
- MAIL_QUANTUM_BUILD_RECIPIENT : "[email protected]"
- DOCKER_WORKSPACE : "c:\\Greg"
- NUGETTOOL : "Nuget\\nuget.exe"
- DOCKER_CONTAINER : "buildContainer"
- HARMONY_REPO : "DynamoDS/PackageManagerClient"
- NUNITTOOL : "NUnit\\NUnit.ConsoleRunner\\tools\\nunit3-console.exe"
- URL_REPO_TOOLS : "git.autodesk.com/Dynamo/CICDResources.git"
- BRANCH_TOOLS : "master"
- NUGET_PUBLISH_SOURCE: "https://api.nuget.org/v3/index.json"
- COMMON_TOOLS_DIR : "CICDResources_shared"
- DOTCOVERTOOL : "DotCover\\JetBrains.dotCover.CommandLineTools\\tools\\dotCover.exe"
- SONARSCANTOOL : "SonarScannerMsbuild\\dotnet-framework-sonarscanner\\tools\\SonarScanner.MSBuild.exe"
- NUGET_SOURCES : "nuget.org"
- NUGET_CONFIG : "Config\\nuget.config"


check_changelog_updated_on_pr: true
pipeline_os: "Windows"
force_slack_notification : true
language: csharp
use_garasign: true


schedule:
cron_schedule: "once_a_week"
Expand All @@ -22,37 +31,50 @@ jenkins_creds:
type: secretText
credentialsId: dynamovisualprogramming_nuget_api_key
secretText: APIKEY
-
type: usernamePassword
credentialsId: local-svc_p_ors
username: GITADSK_USERNAME
password: GITADSK_PASSWORD

build:
-
setup_proj_deps : true
solution: src\\GregClient.sln
scripts:
- "pwsh.exe -ExecutionPolicy ByPass -File .\\cicdscripts\\SetupHost.ps1"
- "pwsh.exe -ExecutionPolicy ByPass -File .\\cicdscripts\\BuildSolution.ps1"
- "pwsh.exe -ExecutionPolicy ByPass -File .\\cicdscripts\\DownloadCICDResources.ps1"
- "pwsh.exe -ExecutionPolicy ByPass -File .\\%COMMON_TOOLS_DIR%\\scripts\\SetupHost.ps1"
- "dotnet build src/gregClient.sln --configuration Release"
ci_test:
tests:
-
scripts:
- dotnet test src/GregClientTests/GregClientTests.csproj --logger:"junit;LogFilePath=testresults\\testresults.xml"

test_report_dir: GregClientTests/TestResults
test_report_pattern:
format: "junit"
pattern: "*.xml"

soc2:
harmony:
hidden_email_list: dynamo_ws_access
repository: env.HARMONY_REPO
third_party_lib_paths:
- "bin\\release"
- bin\\Release\\net8.0\\

deployment:
-
type: customized
scripts:
- "pwsh.exe -ExecutionPolicy ByPass -File .\\cicdscripts\\ExecuteContainerDeploy.ps1"
- "pwsh.exe -ExecutionPolicy ByPass -File .\\cicdscripts\\PostDeploy.ps1"

ci_test:
tests:
-

-
type: sign
files_to_sign:
- "bin\\Release\\net8.0\\greg.dll"
-
type: customized
scripts:
- "dotnet test src/GregClientTests/GregClientTests.csproj --logger:'junit;LogFilePath=testresults\\testresults.xml'"
- "pwsh.exe -ExecutionPolicy ByPass -File .\\cicdscripts\\PublishPackage.ps1 -ReleaseBranches master"




test_report_dir: TestResults
test_report_pattern:
format: "junit"
pattern: "*.xml"


Loading
Loading