Jc.ServerHealth 1.0.9

dotnet add package Jc.ServerHealth --version 1.0.9                
NuGet\Install-Package Jc.ServerHealth -Version 1.0.9                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jc.ServerHealth" Version="1.0.9" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jc.ServerHealth --version 1.0.9                
#r "nuget: Jc.ServerHealth, 1.0.9"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Jc.ServerHealth as a Cake Addin
#addin nuget:?package=Jc.ServerHealth&version=1.0.9

// Install Jc.ServerHealth as a Cake Tool
#tool nuget:?package=Jc.ServerHealth&version=1.0.9                

Jc.ServerHealth

WebApi 健康检查接口

引用这个模块后不需要做其他对事; 会自动增加以下接口

第一个:

/JcServerHealth/gethealth

请求方式:

Get&Post

返回值:
{
	"Code": "200",
	"Message": "ok",
	"Time": "时间戳",
	"Version": "版本号"
}

第二个

/JcServerHealth/get

返回值
ok

第三个

/JcServerHealth/version

返回值

Assembly的版本号名称 例如:2.0.0.1

在jenkins中使用

Shell脚本思路

#!/bin/bash

# 声明接口地址
url=http://{ip}:{port}/JcServerHealth/version

# 声明判断条件 版本号可以从 jira传过来等等
version=2.0.0.2

result=$(curl -s ${url} | grep "${version}")
if [ "$result" != "" ]; then
	echo "server is running"
    exit 0
else
	echo "server is wrong"
    exit 1
fi

明确健康检查接口及其接口返回结构

执行 grep 搜索关键标识结果的词

判断是否存在,做对应的逻辑输出和流程

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.9 253 11/30/2023
1.0.8 171 10/20/2023
1.0.7 160 7/14/2023
1.0.6 239 3/14/2023
1.0.5 239 3/13/2023
1.0.4 230 3/7/2023
1.0.3 237 3/7/2023