Table of Contents |
---|
SeaLights .NET Core agent is integrated into the Cloud Foundry .NET core buildpack. So you can use it in your application by performing the following simple steps:
Create SeaLights service configuration
Push an application
Bind an application with the service
Restage an application
Create Service Configuration
To manage application integrations with third-party services Cloud Foundry has the mechanism of the User-Provided Services. So the first step is to create such a service with the configuration. Here is the command “create-user-provided-service“ that does that:
Code Block |
---|
cf cups sealights -p '{"token":"ey…", "bsIdbuildSessionId":"as…"}' |
Info |
Note: you have to escape the "
character in the windows commands line, so
...
the command will look like this:
Code Block |
---|
cf cups sealights -p '{\"token\":\"ey…\", \"bsId buildSessionId\":\"as…\"}' |
You will be able to change the parameters later with the command “update-user-provided-service”.
See below the complete list of the available parameters
Panel | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Important is only a prefix of the service name. It’s mean that service “sealights-build001” will also enable sealights integration. This can be useful when you create ups in pipeline - you can pass build number to the service name, do bind, and then just unbinde it in a clean-up build stage |
Push an application
You can push an application as usual with the command “push” just taking into account that to perform the testListener
phase in the CloudFoundry container you have to publish an application unit tests
Code Block |
---|
cf push |
Info |
Note: you can use a manifest.yml file to simplify an application deployment
Bind Application with the service
...
Code Block |
---|
cf bind-service [app name] [sealights service name] |
Restage Application
To In order to apply changes you have to publish your application again, or just restage it with a command restage
...
Sealights user-provided service options
Prameter name | Description | ||||||
---|---|---|---|---|---|---|---|
| The verb that will be passed to the sealights agent. If not provided - an application will be started without modifications of the start command - that means without sealights agent. | ||||||
| By default pointer to the latest released version. Use this parameter if you want to use some specific agent version | ||||||
| This URL can be used to replace agent installation package completely with another one. Expect url to tar.gz archive | ||||||
| Allow to determine customer lab id - unique ID for a set of test labs in case multiple labs are running simultaneously |
mode
Default value: testListener
.
token
Sealights token
tokenFile
File that contains Sealights token. Should be deployed together with target application
bsId
Sealights workflow session
bsIdFile
File that contains Sealights session id.
target
Default value is ‘dotnet’. Will be used dotnet runtime version that specified in the target application. If an application is published without framework dependencies - will be used an agent’s version - 6.0.3
If target parameter is exist - specified parameter will be used.
targetArgs
Default value for testListener
is test <target.dll>
If target parameter is exist - specified parameter will be used.
workingDir
Root application folder
profilerLogDir
Path to log folder for Profiler
profilerLogLevel
Profiler log level
proxy
Address of proxy to run connection through
| Address of proxy that will be used to download an agent |
| The proxy username if needed |
| The proxy password if needed |
ignoreCertificateErrors
Ignore server certificate error
tools
tags
notCli
appName
application name - will be displayed in dashboard
branchName
current branch name
buildName
current build name
includeNamespace
filter for the application namespaces. Only specified namespaces will be handled
workspacePath
current workspace path
ignoreGeneratedCode
testStage
Name of the test stage
...
| If | ||||
| Allows to replace application launch command |
Info |
---|
All other parameters will be passed to the Agent as is. This allows to support all future changes of the agent without the buildpack modifications |
How does it work
Sealights use the AfterCompile hook in the dotnet-core-buildpack
to install an agent and all required dependencies in the target container. So , once the application is pushed to the cloud foundry service , the following steps occur:
Sealights hook verifies that the application is bound with the sealights service
If so, hook download a package with an agent
Install the agent from the package
Install dotnet runtime specific used by the agent
Modify target application start command
Code Block [cd to the working directory] && dotnet SL.DotNet.dll [verb] [options]
In case when verb is
startBackgroundTestListener
andtestListenerSessionKey
is provided buildpack integration will create an additional file -sealights.envrc
with all environment variables required for the profiler to attach to the target application.
The start command will look like this:Code Block [cd to the working directory] && dotnet SL.DotNet.dll [verb] [options] && source sealights.envrc && [start target application]
Once the service is ready you can execute additional commands via cf run-task API