hashgraph / solo

An opinionated CLI tool to deploy and manage standalone test networks.
Apache License 2.0
7 stars 4 forks source link

Restrict the number of E2E jobs that can run in parallel #606

Open jeromy-cannon opened 2 weeks ago

jeromy-cannon commented 2 weeks ago

potential solution is using matrix strategy. See examples:

example solution from chatgpt:

To restructure this workflow so that all jobs starting with "e2e-" run in a matrix strategy with a max-parallel value of 5, follow these steps:

  1. Consolidate the "e2e-" jobs into a matrix We will create a job matrix that dynamically runs the e2e- jobs while preserving the custom configuration for each job.

  2. Define the matrix with max-parallel Use the max-parallel feature to control the maximum number of jobs running concurrently.

  3. Update each e2e- job to work with matrix variables Here’s how you can restructure the workflow:

    
    name: "Build Application"
    on:
    workflow_dispatch:
    inputs:
      enable-unit-tests:
        description: "Unit Testing Enabled"
        type: boolean
        required: false
        default: true
      enable-e2e-tests:
        description: "E2E Testing Enabled"
        type: boolean
        required: false
        default: false
      enable-snyk-scan:
        description: "Snyk Scan Enabled"
        type: boolean
        required: false
        default: false
    push:
    branches:
      - main
      - 'release/*'

defaults: run: shell: bash

jobs: env-vars: name: Set Environment Variables uses: ./.github/workflows/zxc-env-vars.yaml with: custom-job-label: Set Environment Variables

code-style: name: Code Style uses: ./.github/workflows/zxc-code-style.yaml with: custom-job-label: Standard

unit-tests: name: Unit Tests uses: ./.github/workflows/zxc-unit-test.yaml if: ${{ github.event_name == 'push' || github.event.inputs.enable-unit-tests == 'true' }} needs:

example solution pulling data from JSON

https://github.com/nbusseneau/cilium/blob/7178a98ef9f11bea0e32c68f0bc941d7063ee854/.github/workflows/conformance-ginkgo.yaml#L225-L236

more...

https://github.com/search?q=path%3A.github%2F**%2F*.yaml%20strategy%20matrix%20max-parallel&type=code