How to upload .net core build artifacts into JFrog Artifactory Cloud - asp.net-core

I have configured build pipeline for .net core application in Azure DevOps. In that I have added the Artifactory Generic Upload build task to upload build artifacts into JFrog Artifactory instead of keeping in Azure DevOps Server.
In the Artifactory Generic Upload task, I am using this file spec configuration.
{
"files": [
{
"pattern": "*.zip",
"target": "generic-local" // This is my generic repository name in JFrog Artifactory Cloud
}
]
}
Whenever I run the build, then I am getting the below error.
> [Error] No errors, but also no files affected (fail-no-op flag).
{
"status": "success",
"totals": {
"success": 0,
"failure": 0
}
}
##[debug]task result: Failed
##[error]Error: Command failed: C:\hostedtoolcache\windows\jfrog\1.38.4\x64\jfrog.exe rt u --url="https://xxxxx.jfrog.io/artifactory" --user=*** --password=*** --fail-no-op=true --dry-run=false --insecure-tls=false --threads=3 --retries=3 --symlinks=false
So, can anyone suggest me how to upload .net core build artifacts into JFrog Artifactory Cloud.

I have changed the File Spec like this below:
{
"files": [
{
"pattern": "$(Build.ArtifactStagingDirectory)/*.zip",
"target": "generic-local/generic-local/drop/" // Format: "Repository_Name/Repository_Path/Folder_Name/"
}
]
}
With this File Spec configuration, I am able to upload .NET Core build artifacts into JFrog Artifactory.
Reference documentation : https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-UploadingFiles

Related

Serilog & Elastic Search aspnetcore with docker not working

I have installed both elastic search and kibana 8.6.1
I am using Serilog.AspnetCore 6.1, Serilog.Enrichers.Environment 2.2, and Serilog.Sinks.ElasticSearch 9.0
I have configured my application with Serilog to log data to elastic search
configuration
.Enrich.FromLogContext()
.Enrich.WithMachineName()
.WriteTo.Debug()
.WriteTo.Console()
.WriteTo.Elasticsearch(new ElasticsearchSinkOptions(new Uri(elasticConfigurationSettings.Uri))
{
IndexFormat = $"applogs-{context.HostingEnvironment.ApplicationName?.ToLower().Replace(".", "-")}-{context.HostingEnvironment.EnvironmentName?.ToLower().Replace(".", "-")}-{DateTime.UtcNow:yyyy-MM}",
TypeName = null,
AutoRegisterTemplate = true
})
.Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName ?? "Environment Missing")
.Enrich.WithProperty("Application", context.HostingEnvironment.ApplicationName ?? "Application Unknown")
.ReadFrom.Configuration(context.Configuration);
SelfLog.Enable(Console.Error);
Below is my Serilog settings in the appsettings.json file
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Information",
"System": "Warning"
}
}
},
"ElasticConfiguration": {
"Uri": "http://localhost:9200"
}
I have an httphandler that has logging statements
logger.LogInformation("Sending request to {Url}", request.RequestUri);
logger.LogInformation("Received a success response from {Url}", response.RequestMessage.RequestUri);
but I never see any data in kibana. Any help would be appreciated.
you have to networking your containers with each other
you can using them by adding Container Orchestrator and making you're project multi-container app
see more information about it in this link
I was able to get things working.
I changed
"ElasticConfiguration": {
"Uri": "http://localhost:9200"
}
to
"ElasticConfiguration": {
"Uri": "http://elasticsearch:9200"
}
since this is the name of the container w/in docker.
I updated my docker-compose file to update a few settings within elasticsearch 8.6.1
- ES_JAVA_OPTS=-Xms512m -Xmx512m
- xpack.security.enabled=false
- discovery.type=single-node
- ELASTIC_CLIENT_APIVERSIONING=1
I updated my Kibana settings as well
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
In addition, I came across this SO post discussing Serilog and ES8, which helped me update my common logging library
I am now able to launch Kibana and see my logs.

Vite manifest: resources/css/app.css on Cpanel server

Laravel Jetstream Livewire Vite Cpanel Deployment
My SetUp:
Laravel: v9.22.1
PHP: v8.1.8
Everything works perfectly on local enviorement but when I deploy the app on Cpanel I get this error:
Unable to locate file in Vite manifest: resources/css/app.css.
I think is something related with Vite because if I dont run npm run build in my local it shows the same error:
Unable to locate file in Vite manifest: resources/css/app.css.
I
In my chase this problem was caused because in my manifest inside the build folder I had this error :
![problem][1]
[1]: https://i.stack.imgur.com/2jAVk.png
Correcting the \ to /
{
"resources/js/app.js": {
"file": "assets/app.ab93cf8a.js",
"src": "resources/js/app.js",
"isEntry": true
},
"resources/css/app.css": {
"file": "assets/app.9fa9f508.css",
"src": "resources/css/app.css"
}
}
fix the problem.

Nunit.framework dll from the package doesnt get copied to bin folder

I'm currently running .net framework 4.6 and added the NUnit, NUnit3TestAdapter nuget package to the test project that i am working on and I see that the test's are not being discovered.
Upon some investigtion, I see that nunit.framework.dll is not being copied to the bin folder. Did some more research and I see the following in the assets.json file, and Nunit's build/NUnit.props file which is supposed to have the MSBuild settings is empty and does not have any.
"NUnit/3.13.3": {
"type": "package",
"compile": {
"lib/net45/nunit.framework.dll": {}
},
"runtime": {
"lib/net45/nunit.framework.dll": {}
},
"build": {
"build/NUnit.props": {}
}
},
However Nbuild/Unit3TestAdapter.props file which is installed from the official Nunit has the MSBuild settings. Is there a reason why build/NUnit.props does not have the build setting where as build/Unit3TestAdapter.props has these?
Also, Is there a work-around to get these copied to local or should I add the reference's manually than getting these from the package?

Connecting to s3 bucket with Media Library Strapi

I've used Strapi for a while as a headless cms and, in their most recent update, they changed the File Upload plugin to Media Library. You used to be able to connect an s3 bucket to your app via File Upload's settings- does anyone have any idea how you do the same thing now that Media Library has replaced it?
If you are using strapi version 3.0.0-beta.20.x
What you have to do is to create a settings.json file with below config
./extensions/upload/config/settings.json
{
"provider": "aws-s3",
"providerOptions": {
"accessKeyId": "dev-key",
"secretAccessKey": "dev-secret",
"region": "aws-region",
"params": {
"Bucket": "my-bucket"
}
}
}
You can check out the plugin for more details

Gulp task to web deploy from Visual Studio

I have not found a concrete example on how to do the publishing via a Gulp Task. Anyone has an idea?
This is how i'm trying at the moment.
gulp.task("Deploy-To-Azure", function() {
var targets = ["Build"];
console.log("Publishing to Azure");
return gulp.src(["./src/Feature/Accounts/code"])
.pipe(foreach(function (stream, file) {
return stream
.pipe(debug({ title: "Building project:" }))
.pipe(msbuild({
targets: targets,
configuration: "Azure",
logCommand: false,
verbosity: "verbose",
stdout: true,
errorOnFail: true,
maxcpucount: 0,
toolsVersion: 14.0,
properties: {
DeployOnBuild: "true",
DeployDefaultTarget: "Web Deploy",
WebPublishMethod: "FileSystem",
DeleteExistingFiles: "false",
_FindDependencies: "false",
Configuration: "Release"
}
}))
.pipe(debug({title: "Finished building project"}));
}));
});
But it looks like the project is built but not deployed. I think my properties are not complete. Any ideas are appreciated. Thank you
I attempted to use those same MSBuild properties from the commandline and received the following error:
>c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild /p:DeployOnBuild=true /p:WebPub
lishMethod=FileSystem /p:DeleteExistingFiles=false /p:DeployDefaultTarget="Web Deploy"
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.P
ublishing.targets(4449,11): error MSB4057: The target "Web Deploy" does not exi
st in the project. [c:\users\me\documents\visual studio 2015\projects\w
ebapplication12\WebApplication12.csproj]
Unless you've created a custom MSBuild Target named "Web Deploy". This won't work.
When I remove the /p:DeployDefaultTarget="Web Deploy" property a WebDeploy package is created in the /obj/[configuration]/Package folder.
Try DeployDefaultTarget: "WebPublish"