Help using aliases to run parallel jobs with workflow

I’m having an issue trying to set this config, I want each job to install all dependencies, after setting the machine. So I specified the dependencies set with an alias (also using alias for many others actions) in order to leave the config file clean.

Here’s my config, using version 2, I based most of my config on this doc:

version: 2

  - &all_tests
    - "run_admin_tests"
    - "run_automationbot_tests"
  - &setup
      name: Setup environment for tests with Python 3
      command: |
          pyenv versions
          pyenv global 3.8.2
          pip install -U selenium
          pip install --upgrade pip
          pip install -U webium
          pip install allure-pytest==2.7.1
          pip install pytest==5.4.3
          pip install pytest-html
          pip install pyperclip==1.5.27
          pip install seleniumwrapper
          pip install selenium-wire
          pip install pycryptodome
          pip install requests
          pip install pytz
          pip install Faker==3.0.1
          sudo apt-get update; sudo apt-get install pigz
          python -c "import selenium; print(selenium.__version__)"
          sudo apt-add-repository -y ppa:qameta/allure
          sudo apt-get update
          sudo apt install xsel
          sudo apt-get install allure
          sudo apt-get clean
          sudo apt-get install dpkg
          curl -L -o google-chrome.deb
          sudo dpkg -i google-chrome.deb
          sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
          rm google-chrome.deb
          sudo cp chromedriver /usr/local/bin/chromedriver
  - &install_dependencies
      - run: *setup
  - &admin
      name: Run Admin Tests
      command: |
          cd tests/admin_tests && python -m pytest --alluredir=/tmp/my_allure_results
  - &automationbot
      name: Run Automation Bot Tests
      command: |
          cd tests/automation_bot_tests && python -m pytest --alluredir=/tmp/my_allure_results
  - &run_tests_admin
      - checkout
      - run: *install_dependencies
      - run: *admin
  - &run_tests_automationbot
      - checkout
      - run: *install_dependencies
      - run: *automationbot

    machine: {image: 'ubuntu-1604:202004-01'}
    steps: *run_tests_admin
    no_output_timeout: 20m

    machine: {image: 'ubuntu-1604:202004-01'}
    steps: *run_tests_automationbot
    no_output_timeout: 20m

    machine: {image: 'ubuntu-1604:202004-01'}
    run: *install_dependencies
    - run:
        name: Generate Allure Report
        when: always
        command: |
            allure generate -o /tmp/my_allure_results/report /tmp/my_allure_results
    - store_artifacts:
        path: /tmp/my_allure_results/report

  version: 2
    - "run_admin_tests"
    - "run_automationbot_tests"
    - "report":
        requires: *all_tests

I’m getting this error:
Configuration errors: 1 error occurred:
** * In step 2 definition: ‘’ expected a map, got ‘slice’**

Also config editor is marking an error inside the &install_dependencies alias: Incorrect Type. Expected: "String"

I’ve tried so many combinations without config editor errors but I still can’t make the dependencies to be installed before running the tests.

Can anybody help me out to find out what I’m doing wrong here?

Thanks in Advance

I managed to solve this by replacing the alias call here:

  • &install_dependencies
    • run: *setup


  • &install_dependencies
    <<: *set_test_environment

So I removed the run: and just injected the alias call there. Also changed setup alias name for set_test_environment but that shouldn’t make any difference of course.

I don’t know why it wasn’t calling the alias with the way before despite I followed the config example using similar syntax.

Anyway, closing this as this is working now.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.