Test a build (updating)

Updated:2023-07-03

Summary

  • suitable when integrating MAIA Agent into an existing build pipeline.
  • the command must be executed from the directory of an already cloned repository.
  • execute maia git_scan prior to the maia build command, and after your own build command.
  • the build command creates an SBOM file that is transferred to the MAIA web app.
  • no build core command options should be used.
  • test Activities options may be used.

Prepare

Prepare, if not already done, the environment file and the configuration file to deploy a build.

​ The environment file must have following variables defined:

  • SRC_ROOT
  • LOG_ROOT
  • MAIA_CORE_HOST
  • MAIA_CORE_HTTP_PORT
  • MAIA_CORE_APP_CONTEXT
  • MAIA_CORE_USE_SSL
  • MAIA_CORE_API_TOKEN_FILE
  • COMPONENT_CONF_FILE
  • COMPONENT_STATE_FILE

Edit the parameters in the configuration file. The file must contain at least the parameters version, prepare_cmd and test.

See component configuration file for more information about parameters.

Example of a basic component configuration file.

version: 4.0
test:
   prepare_cmd: make test_prepare
   suites:
      - name: Suite 1
        cmd: 'make unit_test BUILD_LABEL=<%= build_label %>'

Check out the component with the MAIA agent command maia checkout. bundle exec maia checkout -c 2 Go to the root directory of the component. cd <%INSTALL_PATH%>/ 3 If the component has no configuration file, create a configuration file. touch MAIA.yml

Test without creating an Activity

Use the MAIA Agent command test to test a built component_name.

a. To test with an activity that is posted to the MAIA WebApp:

maia test -c component_name -p 0 -z "comment"

b. To test the component without an activity:

maia test -c component_name

c. To run test commands from a specific section in the configuration file, add the option -e and specify section_name:

maia test -c component_name -e section_name


If no section is specified, the MAIA Agent will search for test commands in the section test.

Test and create an Activity

Use the MAIA Agent command test to test a built component_name.

a. To test with an activity that is posted to the MAIA WebApp:

maia test -c component_name -p 0 -z "comment"

b. To test the component without an activity:

maia test -c component_name

c. To run test commands from a specific section in the configuration file, add the option -e and specify section_name:

maia test -c component_name -e section_name


If no section is specified, the MAIA Agent will search for test commands in the section test.

Results