Ahosti.Com
Read trending IT updates for cloud businesses, managed service providers, IT pros & what innovation digital transformation is driving in tech industry.

Automating SonarCloud with PowerShell – Half 1 Introduction

0 5

SonarCloud is the SaaS model of SonarQube, a device to detect and repair points in your code by inspecting code high quality and safety vulnerabilities. I wanted to automate the onboarding of each customers and code tasks into SonarCloud to remove the necessity to manually provision this stuff into the system.

SonarCloud has a Internet API which facilitated a variety of what I wanted to realize, nonetheless with some vital gaps which initially appeared to imply a few of the onboarding would want to nonetheless be handbook. Developing in Half 2 and later of this story will characteristic how I reverse engineered the Internet API to fill within the lacking components of the puzzle, however in Half 1 I’ll deal with an introduction of the fundamentals.

Pre-Requisites

The automation was carried out with PowerShell 7.x+. An API key for the SonarCloud Internet API is required and will be generated from the safety web page of your SonarCloud account:

Initially I assumed I’d solely want a number of API calls, nonetheless it become many, so I ended up making a PowerShell module, PSSonarCloud, to facilitate straightforward re-use of comparable calls.

Getting Began

Set up PSSonarCloud from the PowerShell Gallery:

Provide your SonarCloud API key to create a connection variable:

Retrieve an inventory of tasks belonging to your SonarCloud group:

Retrieve an inventory of customers belonging to your SonarCloud group:

Going Additional

The module at the moment accommodates 15 capabilities for working with the API:

This solely covers a comparatively small a part of the API, nonetheless as per most of my different PowerShell modules the capabilities are wrappers round a single operate Invoke-SonarCloudRestMethod which suggests ought to you must work with an API name that isn’t at the moment lined by PSSonarCloud then it must be simple.

For instance the next API name to record the branches of a challenge will not be a part of PSSonarCloud but:

The next code would get you there although:

You might also like
Loading...