Make sure TC_CLOUD_TOKEN is set to your corresponding token value, download the agent and start it before running the tests.
To use Testcontainers Cloud with Tekton you need to set TC_CLOUD_TOKEN to your corresponding service account token. You can generate the token in the Testcontainers Cloud dashboard. Then add the token to your pipeline by creating a secret and using it as a variable in your pipeline task.
For example, you can define a secret in a separate secret.yaml file like in the following example:
Next you need to configure your Tekton pipeline to install and use Testcontainers Cloud agent prior running the tests. For that you can use the Testcontainers Cloud agent installation script.
Here's a sample configuration for a Tekton task task.build.yaml which bind the above secret to the TC_CLOUD_TOKEN environment variable, and runs the script that installs and starts Testcontainers Cloud agent, and then calls to the Maven test command.
- name: source
- name: maven-build
- name: TC_CLOUD_TOKEN
sh -c "$(curl -fsSL https://get.testcontainers.cloud/bash)"
This is a flexible approach you can use to run Testcontainers Cloud in Tekton with the tests in other languages by swapping the mvn command for the corresponding build tool call.