Configure MAIA Agent for Build, Deploy and Test

  1. Export the variables in the environment file to BLT_ENV.

    export BLT_ENV=path_to_maia_agent/environment.yml
  2. Verify that it is possible to check out a repository with the MAIA Agent command checkout.

    bundle exec maia checkout -c component_name
  3. The code in the component with component_name should be cloned to the path defined in SRC_ROOT.

Simple build and test example

This is an example that you can run on the same host as the MAIA installation. Follow the steps in the example and verify that the installation, on a very basic level, is working ok, . The example can also serve as an template to start developing and integrating to a more advanced solution for you.

Prerequisites:
First step:
rm -rf /tmp/run_dir
mkdir /tmp/run_dir
Setup in MAIA:

login as admin (the username and password is published in the installation log file).

name: testuser

email: testuser@example.com

select local auth and add a password

name: maiatest

in the first tab: add testuser as member of team maiatest

in the Team permissions tab: select the below permissions to the team.

  • Access all records

  • Create commits

  • Create/destroy environments

  • Create artifacts

  • Create test_results and test_suites

Click on 'Reveal', enter testuser password then cut-and-paste the token to the file /tmp/run_dir/api-token

GIT repository
mkdir -p /tmp/repo/first
cd /tmp/run_dir/repo/first
git init
git checkout -b master
cp <path_to_example>/code/* > first
git add .
git commit -a -m "First commit"
Setup and run MAIA Agent
export BLT_ENV=<path_to_example>/environment.yml
cd /tmp/run_dir

cat > Gemfile
source 'https://maiadev.t2data.com/gems'
gem 'maia-agent'

bundle config --local path .bundle
bundle install
cd /tmp/run_dir
bundle exec maia git_scan -r first

A commit should appear (with a warning triangle) in the Latest Commits widget.

Open the Commits page from the Main menu, to see the commit with track: 'first:master' and comment: 'First commit' (with a warning triangle).

bundle exec maia checkout -c first -t master

A clone of the repo should be created at /tmp/run_dir/src

bundle exec maia build -c first -t master

Open the Built artifacts page from the Main menu to see one artifact with name: first_1.1-XXXXX version: 2.4.0

bundle exec maia test -c first -t master

Open the Test executions page from the Main menu to see one successful test run.

Debugging

Log file:

/opt/data/t2maia/var/log/maia_core/production_XXX.log

Enable debug in maia_agent:

Add option -d

Reset MAIA to init state:
/opt/data/t2maia/bin/ipv stop
/opt/data/t2maia/bin/ipv reset
/opt/data/t2maia/bin/ipv start