Fan-out fan-in with build-router-start

So far I ended up with the following:

  • bitrise.yml in web - accepts call and dispatches to actual workflow in repo:
---
format_version: '7'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: other
workflows:
  ci:
    after_run:
    - run_from_repo
  run_from_repo:
    steps:
    - activate-ssh-key:
        run_if: ''
    - git-clone: {}
    - script:
        title: continue from repo
        inputs:
        - content: |-
            #!/bin/bash
            set -ex
            echo "workflow to run from trigger: ${WORKFLOW_TO_RUN:-primary}"
            bitrise run "${WORKFLOW_TO_RUN:-primary}"
  ios:
    after_run:
    - run_from_repo
    steps:
    - script@1.1.5:
        inputs:
        - content: |
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x

            envman add --key WORKFLOW_TO_RUN --value ios
  android:
    after_run:
    - run_from_repo
    steps:
    - script@1.1.5:
        inputs:
        - content: |
            #!/usr/bin/env bash
            # fail if any commands fails
            set -e
            # debug log
            set -x

            envman add --key WORKFLOW_TO_RUN --value android
trigger_map:
- push_branch: task/ci-2.0
  workflow: ci

  • bitrise.yml in repo - does actual job of building an app:
format_version: "7"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: other
trigger_map:
- push_branch: '*'
  workflow: primary
- pull_request_source_branch: '*'
  workflow: primary
workflows:
  primary:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@4.0.14: {}
    - script@1.1.5:
        title: Do anything with Script step
        inputs:
        - content: |-
            #!/bin/bash
            echo "Trigger $SOURCE_BITRISE_BUILD_NUMBER"
    - build-router-start@0.11.2:
        inputs:
        - access_token: $BITRISE_ACCESS_TOKEN
        - workflows: |-
            ios
            android
    - script@1.1.5:
        title: Do anything with Script step
        inputs:
        - content: |-
            #!/bin/bash
            echo "slugs?  $ROUTER_STARTED_BUILD_SLUGS"
    - build-router-wait@0.9.1:
        inputs:
        - access_token: $BITRISE_ACCESS_TOKEN
        - buildslugs: $ROUTER_STARTED_BUILD_SLUGS

  ios:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@4.0.14: {}
    - script@1.1.5:
        title: Do anything with Script step
        inputs:
        - content: |-
            #!/bin/bash
            # build ios

  android:
    steps:
    - activate-ssh-key@4.0.3:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@4.0.14: {}
    - script@1.1.5:
        title: Do anything with Script step
        inputs:
        - content: |-
            #!/bin/bash
            # build android

I wish this kind of a set up was a bit more straightforward…