Skip to main content

Use specific executor based on branch with dynamic configuration

Switch executors based on branch

It is possible to utilize a common tool such as sed in order to choose an executor to run by changing the line in place like so:

setup: trueversion: 2.1orbs:
  continuation: circleci/[email protected]:
  setup:
    when:
      equal: [ main, << pipeline.git.branch >> ]
    jobs:
      - continuation/continue:
        configuration_path: ".circleci/continue-config1.yml"
        parameters: /home/circleci/parameters.json
  pre-steps:
    - checkout
    - run:
  name: Based on branch, choose executor
  command: |
    sed -i 's/base\:edge/node\:latest/g' ./.circleci/continue-config1.yml
    cat ./.circleci/continue-config1.yml
Did this answer your question?