Skip to content

Instantly share code, notes, and snippets.

View jonathanmedd's full-sized avatar

Jonathan Medd jonathanmedd

View GitHub Profile
@jonathanmedd
jonathanmedd / Add-SonarCloudOrganizationMember.ps1
Created January 4, 2022 18:06
Add-SonarCloudOrganizationMember
Connect-SonarCloud -APIKey 'xxxxxxxxxxxxxxxxx'
Add-SonarCloudOrganizationMember -organization 'org1' -userLogin 'testuser1@gitlab'
@jonathanmedd
jonathanmedd / New-SonarCloudProjectALMIntegrated.ps1
Created December 22, 2021 11:49
New-SonarCloudProjectALMIntegrated
Connect-SonarCloud -APIKey 'xxxxxxxxxxxxxxxxx'
New-SonarCloudProjectALMIntegrated -organization 'org1' -installationKeys '68320681'
@jonathanmedd
jonathanmedd / New-SonarCloudProject.ps1
Created December 22, 2021 11:20
New-SonarCloudProject
Connect-SonarCloud -APIKey 'xxxxxxxxxxxxxxxxx'
New-SonarCloudProject -organization 'org1' -projectName 'test-sonarcloud-onboard' -projectKey '68320681'
@jonathanmedd
jonathanmedd / Invoke-GitCleanup.ps1
Created December 2, 2021 15:28
Invoke-GitCleanup
function Invoke-GitCleanup {
param (
[Parameter()]
[ValidateNotNullOrEmpty()]
[String]$defaultBranch = 'main',
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[String]$branch
)
@jonathanmedd
jonathanmedd / Invoke-SonarCloudRestMethod.ps1
Created November 19, 2021 17:19
List the branches of a SonarCloud project
$parameters = @{
project = 'testorg_test-project-1'
}
$branches = Invoke-SonarCloudRestMethod -Method GET -URI '/project_branches/list' -queryParameters $parameters
$branches.branches
name : develop
isMain : True
@jonathanmedd
jonathanmedd / Get-Command-PSSonarCloud.ps1
Created November 19, 2021 15:43
Get-Command-PSSonarCloud
Get-Command -Module 'PSSonarCloud'
CommandType Name Version Source
----------- ---- ------- ------
Function Add-SonarCloudOrganizationMember 0.0 PSSonarCloud
Function Add-SonarCloudUserGroupMember 0.0 PSSonarCloud
Function Connect-SonarCloud 0.0 PSSonarCloud
Function Disconnect-SonarCloud 0.0 PSSonarCloud
Function Get-SonarCloudOrganizationMember 0.0 PSSonarCloud
@jonathanmedd
jonathanmedd / Get-SonarCloudOrganizationMember.ps1
Created November 19, 2021 15:36
Retrieve a list of users belonging to your SonarCloud organization:
Get-SonarCloudOrganizationMember -organization 'testorg'
Name : Test User 1
Login : testuser1@gitlab
Avatar : aLyqRLDYigty59tXaLyqRLDYigty59tX
GroupCount : 5
IsOrgAdmin : True
Name : Test User 2
Login : testuser2@gitlab
@jonathanmedd
jonathanmedd / Get-SonarCloudProject.ps1
Created November 19, 2021 14:54
Retrieve a list of projects belonging to your SonarCloud organization
Get-SonarCloudProject -organization 'testorg'
Name : Test Project 1
Key : testorg_test-project-1
Organization : testorg
Qualifier : TRK
Visibility : private
Name : Test Project 2
Key : testorg_test-project-2
@jonathanmedd
jonathanmedd / connect-sonarcloud.ps1
Created November 19, 2021 14:40
Supply your SonarCloud API key to create a connection variable
Connect-SonarCloud -APIKey 'xxx-xxx-xxx'
@jonathanmedd
jonathanmedd / install-module-pssonarcloud.ps1
Created November 19, 2021 14:36
Install PSSonarCloud from the PowerShell Gallery
Install-Module -Name PSSonarCloud