Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for --processes auto to do the same as not setting it #588

Open
Lakitna opened this issue Jun 26, 2024 · 0 comments
Open

Allow for --processes auto to do the same as not setting it #588

Lakitna opened this issue Jun 26, 2024 · 0 comments

Comments

@Lakitna
Copy link

Lakitna commented Jun 26, 2024

Context

I maintain an Azure DevOps pipeline template that is used by multiple teams. In this template, I'm exposing a bunch of run options. Most relevant to this issue are "run tests in parallel" (using pabot) and "number of parallel processes" used.

The "number of parallel processes" used option takes a positive integer, auto, or all. I'm currently using the following code to achieve this (simplified and redacted):

parameters:
  - name: parallel
    type: boolean
    default: false
  - name: parallelProcesses
    default: "auto"
jobs:
  - job: "robot_framework"
    ...
    variables:
      - name: robotframeworkCli
        ${{ if and(eq(parameters['parallel'], true), eq(parameters['parallelProcesses'], 'auto')) }}:
          value: pabot --testlevelsplit --pabotlib
        ${{ elseif and(eq(parameters['parallel'], true), ne(parameters['parallelProcesses'], 'auto')) }}:
          value: pabot --testlevelsplit --pabotlib --processes ${{parameters.parallelProcesses}}
        ${{ else }}:
          value: robot
    steps:
      - powershell: |
          ${{ variables.robotframeworkCli }} my/amazing/test/path

The improvement

I would love to be able to call pabot with --processes auto. This should behave the same way as calling pabot without the --processes argument.

This small change can make my pipeline template a bunch simpler:

parameters:
  - name: parallel
    type: boolean
    default: false
  - name: parallelProcesses
    default: "auto"
jobs:
  - job: "robot_framework"
    ...
    variables:
      - name: robotframeworkCli
        ${{ if eq(parameters['parallel'], true) }}:
          value: pabot --testlevelsplit --pabotlib --processes ${{parameters.parallelProcesses}}
        ${{ else }}:
          value: robot
    steps:
      - powershell: |
          ${{ variables.robotframeworkCli }} my/amazing/test/path

If you're open to this change, please let me know and I'll open a PR ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant