Skip to content

Commit

Permalink
Testing Jenkins and SonarQ
Browse files Browse the repository at this point in the history
  • Loading branch information
AbreuHD committed Dec 23, 2024
1 parent 2be2035 commit c6df65e
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 52 deletions.
38 changes: 0 additions & 38 deletions .github/workflows/main.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Core.Application/Core.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

<ItemGroup>
<PackageReference Include="AutoMapper" Version="13.0.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.65" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.17" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
Expand Down
7 changes: 4 additions & 3 deletions Infraestructure.Persistence/Infrastructure.Persistence.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Empty file added Jenkins/ProdJenkins
Empty file.
63 changes: 63 additions & 0 deletions Jenkins/TestJenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
pipeline {
agent { label 'Africa' }
environment {
FTP_SERVER = credentials('abreu_fpt_host')
NUGET_SOURCE = 'credentials('private_nuget_uri')
}

stages {
stage('Restore dependencies') {
steps {
echo 'Restoring project dependencies from NuGet...'
sh 'dotnet restore KuhakuCentral.sln --source $NUGET_SOURCE'
}
}

stage('SonarQube Analysis') {
steps {
script {
def scannerHome = tool 'SonarQ-DotNET8'
withSonarQubeEnv('SonarQ') {
sh "dotnet ${scannerHome}/SonarScanner.MSBuild.dll begin /k:\"Kuhaku\""
sh "dotnet build"
sh "dotnet ${scannerHome}/SonarScanner.MSBuild.dll end"
}
}
}
}

stage('Compile project') {
steps {
echo 'Compiling the project...'
sh 'dotnet build KuhakuCentral.sln --configuration Release'
}
}

stage('Deploy to FTP') {
steps {
withCredentials([usernamePassword(credentialsId: 'abreu_kuhaku_test_ftp_credentials', usernameVariable: 'FTP_USER', passwordVariable: 'FTP_PASSWORD')]) {
script {
// Asumiendo que el directorio de salida se encuentra en bin/Release/net8.0/
def buildDirectory = 'bin/Release/net8.0/'
if (fileExists(buildDirectory)) {
echo "Directory exists. Deploying files to FTP..."
sh """
lftp -e "
set ssl:verify-certificate no;
open ftp://$FTP_USER:$FTP_PASSWORD@$FTP_SERVER;
mirror -R $buildDirectory .;
bye;
"
"""
} else {
echo "Build directory not found. No files to upload."
error "Deployment failed: Directory $buildDirectory not found."
}
}
}
}
}

}

}
6 changes: 6 additions & 0 deletions KuhakuCentral.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Testing Scraping", "Testing
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebScrapingTesting", "WebScrapingTesting\WebScrapingTesting.csproj", "{6F652130-A97A-434D-B1CC-466612A8DE5F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Jenkinsfiles", "Jenkinsfiles", "{8377DF25-0E24-45F4-BFF4-1760CE19591B}"
ProjectSection(SolutionItems) = preProject
.Jenkins\ProdJenkins = .Jenkins\ProdJenkins
.Jenkins\TestJenkins = .Jenkins\TestJenkins
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
3 changes: 2 additions & 1 deletion Presentation.KuhakuCentral/Extensions/ServicesExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Asp.Versioning;
using Microsoft.AspNetCore.Mvc;
using Microsoft.OpenApi.Models;

namespace KuhakuCentral.Extensions
Expand Down
18 changes: 11 additions & 7 deletions Presentation.KuhakuCentral/KuhakuCentral.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Auth.Infraestructure.Identity" Version="0.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8">
<PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageReference Include="Auth" Version="0.0.0-alpha.0.29" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.11" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.7.3" />
<PackageReference Include="MimeKit" Version="4.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion WebScrapingTesting/WebScrapingTesting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.65" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.71" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="ScrapySharp" Version="3.0.0" />
</ItemGroup>

Expand Down

0 comments on commit c6df65e

Please sign in to comment.