Table of Contents | ||||
---|---|---|---|---|
|
Onboarding the .Net CD Agent
These steps outline the onboarding steps needed on the environment, with the CD agent, added to each component that builds up the Application Under Test.
Configuration steps
Tip |
---|
When the application is up and running and the Sealights CD Agent configured, you can see it is properly running from the Cockpit -> Live Agents Monitor screen. |
Agent’s Parameters Reference
Mandatory parameters
Property (CLI) | Required | Description | Env variable | JSON | |||||
---|---|---|---|---|---|---|---|---|---|
| Yes | Name of the target application |
|
| |||||
| Yes | The source branch of the application |
|
| |||||
| Yes | The build label/version of the current |
artifact
|
|
| |||||||
| Yes | CD-only lab id |
|
| |||||
| Yes | Path to the scanned folder where all binary files are located |
|
| |||||
| Yes | Comma-separated list of namespaces to include in the scan. |
|
|
Optional parameters
These parameters may be required due to your specific configuration or environment’s limitations (e.g., proxy).
Property | Description | Env variable | JSON | |||||
---|---|---|---|---|---|---|---|---|
| Comma-separated list of namespaces to exclude from the scan. Supports wildcard ( Default value: |
| ||||||
| Comma-separated list of files to include in scan. Supports wildcard ( Default value: |
| ||||||
| Comma-separated list of files to exclude from the scan. Supports wildcard ( |
| ||||||
| Comma-separated list of assemblies to include. Supports wildcard ( |
| ||||||
| Comma-separated list of assemblies to exclude from the scan. Supports wildcard ( Default value: |
| ||||||
| The project source root directory, where all paths will be made relative to |
|
| |||||
| The name of the target application that will be started |
| ||||||
| Arguments to be passed to the target process |
| ||||||
| The path to the working directory. By default, it’s using current working directory. |
|
Logging parameters
To enable logs, you can set the following parameters
Parameter (CLI) | Description | Env variable | JSON | |||||
---|---|---|---|---|---|---|---|---|
| Log level. Default and Recommended value is
|
|
| |||||
| Enables logging profiler data to file. Requires LogLevel to be specified. |
|
|
Sample Commands
Downloading the agent
Info |
---|
The different available options to download the agent are documented in a dedicated central page: https://sealights.atlassian.net/l/cp/g0omvaoL |
For example, you can use the following commands to automate the process
Linux |
| |||||
---|---|---|---|---|---|---|
Windows |
|
Configuration commands
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Simple Web App (Desktop, Windows)
This simple use case illustrates how to collect coverage with the CD agent from a web application started without parameters.
Code Block | ||
---|---|---|
| ||
C:\Sealights\Agent\SL.DotNet.exe cdAgent --appName "TestApp" --branchName "main" --buildName "1.16.10" --labId "integ_demo_DesktopWeatherApp" \ --binDir "C:\Program Files\WeatherApi" --includeNamespace "WeatherApi*" --target "C:\Program Files\WeatherApi\WeatherApi.exe" |
Microservice (Alpine-based docker file)
DockerFile
Code Block |
---|
FROM mcr.microsoft.com/dotnet/runtime:6.0-alpine WORKDIR /app COPY --from=build /app/out . COPY Scripts/start-app.sh . # Sealights - install prereq, agent, token, bsid # Best practice it to mount a pre-existing sealights directory depending on the environment (test or prod) RUN mkdir -p /sealights/{agent,logs} RUN wget -nv -O sealights-dotnet-agent-alpine.tar.gz https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-alpine-self-contained.tar.gz RUN tar -xzf ./sealights-dotnet-agent-alpine.tar.gz --directory /sealights/agent COPY ["SeaLights/sltoken.txt", "/sealights/"] RUN chmod -R 777 /sealights # Set the script as the entrypoint ENTRYPOINT ["sh", "start-app.sh", "YourAppName.dll"] |
Startup script
Code Block | ||
---|---|---|
| ||
#!/bin/sh # Check if sealights folder exists if [ -d "/app/sealights/" ]; then /app/sealights/agent/SL.DotNet cdAgent --appName ms-gateway-api --branchName poc --buildName $(cat /app/version.txt) \ --binDir /app --includeNamespace MyCompany.* --target dotnet --targetArgs $1 --workingDir /app \ --identifyMethodsByFqn --profilerLogLevel 6 --profilerLogDir /app/sealights/logs --labId integ_POC_DemoApp else dotnet $1 fi |