https://github.com/henryd24/azdevops-sonarcloud-create-project
Azure devops extension, which allows to verify if a project exists in sonarcloud and if it does not exist, to create it.
https://github.com/henryd24/azdevops-sonarcloud-create-project
azuredevops-extension azuredevops-task azurepipelines sonarcloud
Last synced: 2 months ago
JSON representation
Azure devops extension, which allows to verify if a project exists in sonarcloud and if it does not exist, to create it.
- Host: GitHub
- URL: https://github.com/henryd24/azdevops-sonarcloud-create-project
- Owner: henryd24
- License: apache-2.0
- Created: 2023-05-05T04:08:39.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-29T01:00:46.000Z (over 1 year ago)
- Last Synced: 2024-10-29T01:34:03.274Z (over 1 year ago)
- Topics: azuredevops-extension, azuredevops-task, azurepipelines, sonarcloud
- Language: TypeScript
- Homepage:
- Size: 303 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SonarCloud Project Creator & Checker
This Azure DevOps extension automates the verification and creation of projects in **SonarCloud**. It ensures your CI/CD pipelines run smoothly by pre-configuring projects, Quality Gates, and New Code definitions before the analysis begins. This extension is designed to help with [SonarCloud](https://sonarcloud.io/) by providing a helper task. It's not an official SonarSource extension.
## 🚀 Why use this task?
Standard SonarCloud analysis often relies on projects being manually created or using default settings. This task provides:
* **Auto-Provisioning:** Creates the project if it doesn't exist.
* **Standardization:** Automatically applies the correct Quality Gate and "New Code" definition.
* **Smart Verification:** Can be used just to check if a project exists without creating it.
## 🛠️ Recommended Usage
Place this task **before** the `Prepare Analysis Configuration` task from SonarSource. This ensures the environment is perfectly configured when the scanner starts.
```yaml
- task: sonarcloud-create-project@1
inputs:
SonarCloud: 'MySonarConnection'
sonarOrganization: 'my-org-key'
serviceKey: 'my-project-key'
serviceName: 'My Project Name'
createProject: 'true'
```
-----
## ⚙️ Input Configuration
### Core Settings
| Input Label | Parameter Name | Required | Description |
| :--- | :--- | :---: | :--- |
| **SonarCloud Service Connection** | `SonarCloud` | Yes | The Azure DevOps Service Connection for SonarCloud. |
| **Organization** | `sonarOrganization` | Yes | Select or enter the SonarCloud organization key. |
| **Project keyname** | `serviceKey` | Yes | Unique identifier for the project (e.g., `front-angular`). |
| **Project name** | `serviceName` | No | Human-readable name displayed in SonarCloud. |
| **Create project** | `createProject` | Yes | `Yes` to create if missing; `No` to only check existence. |
### Project Customization (Visible when Create Project = Yes)
| Input Label | Parameter Name | Required | Description |
| :--- | :--- | :---: | :--- |
| **Main Branch Name** | `mainBranch` | No | Default branch name (e.g., `trunk`, `release`). |
| **Visibility** | `visibility` | Yes | Project visibility: `private` or `public`. |
| **Tags** | `tags` | No | Comma-separated tags (e.g., `dev,node,aws`). |
| **Long-lived branches (regex)** | `long_live_branches` | No | Regex for long-lived branches (e.g., `(master\|qa)`). |
| **Select the quality gate** | `sonarQualityGate` | No | Select the Quality Gate to assign to the project. |
### New Code Definition (Advanced)
Found under the **Code Definition Options** group. Visible when `createProject` is enabled.
| Input Label | Parameter Name | Type | Description |
| :--- | :--- | :---: | :--- |
| **Configure New Code Definition** | `enableNewCodeDefinition` | boolean | Enables the "New Code" configuration group. |
| **New Code Definition Type** | `newCodeDefinitionType` | radio | `previous_version`, `days`, `date`, or `version`. |
| **New Code Definition Value** | `newCodeDefinitionValue` | string | Required if type is NOT `previous_version`. |
-----
## 🖼️ Preview
### General Setup

### Detailed Inputs

-----
## 💻 Technical Requirements
* **Runtime:** Compatible with agents running **Node 20** or **Node 24**.
* **Permissions:** The token used in the Service Connection must have **"Administer Projects"** permissions in SonarCloud.