SeaLights .NET Core Agent - Cloud Foundry Integration

SeaLights .NET agent is integrated into the Cloud Foundry .NET core buildpack. So you can use it in your application by performing the following simple steps:

  1. Create SeaLights service configuration

  2. Push an application

  3. Bind an application with the service

  4. 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:

cf cups sealights -p '{"token":"ey…", "buildSessionId":"as…"}'

Note: you have to escape the " character in the windows commands line, so the command will look like this:

cf cups sealights -p '{\"token\":\"ey…\", \"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

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

cf push

Note: you can use a manifest.yml file to simplify an application deployment

Bind Application with the service

Now you can bind your published application with the service

Restage Application

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

Prameter name

Description

verb REQUIRED

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.

version

By default pointer to the latest released version. Use this parameter if you want to use some specific agent version

customAgentUrl

This URL can be used to replace agent installation package completely with another one. Expect url to tar.gz archive

labId

Allow to determine customer lab id - unique ID for a set of test labs in case multiple labs are running simultaneously

proxy

Address of proxy that will be used to download an agent

proxyUsername

The proxy username if needed

proxyPassword

The proxy password if needed

parseArgsFromCmd

If true parameters workingDir target targetArgs will be parsed from the application launch command

customCommand DEV

Allows to replace application launch command

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:

  1. Sealights hook verifies that the application is bound with the sealights service

  2. If so, hook download a package with an agent

  3. Install the agent from the package

  4. Install dotnet runtime specific used by the agent

  5. Modify target application start command

    In case when verb is startBackgroundTestListener and testListenerSessionKey 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:

  6. Once the service is ready you can execute additional commands via cf run-task API