AWS CodeBuild Integration
AWS CodeBuild is a fully managed build service in the cloud. CodeBuild compiles your source code, runs unit tests, and produces artifacts that are ready to deploy.
This document shows you how to run your Katalon project on AWS CodeBuild.
An active Katalon Runtime Engine license.
A Katalon project stored on AWS CodeCommit, GitHub, or Bitbucket.
Configure the buildspec file
To learn more about buildspec, refer to AWS documentation:
- In the repository containing your Katalon project, create the buildspec.yml file in the root (top-level) directory. Below is our sample buildspec. You can get this sample buildspec file from our GitHub repository: buildspec.yml.
- docker pull katalonstudio/katalon
- docker run -t --rm -v "$(pwd)":/katalon/katalon/source katalonstudio/katalon katalon-execute.sh -apiKey=$KATALON_API_KEY -browserType="Chrome" -retry=0 -statusDelay=15 -testSuitePath="Test Suites/TS_RegressionTest"
KatalonTestReports: # CodeBuild will create a report group called "KatalonTestReports".
files: #Store all of the files
- You need a valid Katalon API key to run Katalon tests. Refer to Generate a Katalon API Key for more information about Katalon API key generation. To protect your Katalon API key, you can store your Katalon API key in Parameter Store or in Secrets Manager.For example:
- In Parameter Store:
- In Secrets Manager:To learn more about environment variables, refer to the following AWS documentation: Environment Variable.
- In the
pre-buildphase, you can specify the version of Katalon Studio to run your test with the syntax
katalonstudio/katalon:<version_tag>, for example
katalonstudio/katalon:8.1.2. If you leave as
katalonstudio/katalon, this build uses the latest version of Katalon Studio.
- In the
buildphase, you can input your desired katalonc commands. All of katalonc supported arguments can be found in this document: Command-line syntax in Katalon Runtime Engine.
Create an AWS build project
- Sign in to Amazon Web Services and go to the CodeBuild service.
- In CodeBuild > Build projects, click Create build project.
- Give your project a name.
- In Source, select a source provider and specify the repository that contains your Katalon project.For example, we connect with a repository on GitHub using a personal access token.
- Specify the environment. Make sure that you select the Privileged checkbox if you wish to build Docker images or provide your builds with elevated privileges.
- In the Additional configuration of Environment, the Timeout and Queued timeout fields are pre-populated and you can change them according to what your needs are.In Environment variables, you can add your Katalon API key as a parameter here.
- In Buildspec, choose Use a buildspec file.
- When you are done, scroll to the bottom of the page and select Create build project.
- In the newly created build project, select Start build.
If your project is integrated with Katalon TestOps, you can go to Katalon TestOps to view your reports.