diff --git a/step.sh b/step.sh index 6f2ac4a..a8ce617 100644 --- a/step.sh +++ b/step.sh @@ -172,6 +172,7 @@ echo "maestro_version: $maestro_version" echo "metadata: $metadata" echo "name: $name" echo "orientation: $orientation" +echo "priority: $priority" echo "report: $report" echo "retry: $retry" echo "runner_type: $runner_type" @@ -222,6 +223,7 @@ ${maestro_version:+--maestro-version \"$maestro_version\"} \ ${name:+--name \"$name\"} \ ${check_name:+-m \"gh_check_name=$check_name\"} \ ${orientation:+--orientation \"$orientation\"} \ +${priority:+--priority \"$priority\"} \ ${report:+--report \"$report\"} \ ${retry:+--retry \"$retry\"} \ ${runner_type:+--runner-type \"$runner_type\"} \ @@ -277,6 +279,7 @@ ${maestro_version:+--maestro-version "$maestro_version"} \ ${name:+--name "$name"} \ ${check_name:+-m "gh_check_name=$check_name"} \ ${orientation:+--orientation "$orientation"} \ +${priority:+--priority "$priority"} \ ${report:+--report "$report"} \ ${retry:+--retry "$retry"} \ ${runner_type:+--runner-type "$runner_type"} \ diff --git a/step.yml b/step.yml index cc209d6..3fdfa51 100644 --- a/step.yml +++ b/step.yml @@ -320,6 +320,22 @@ inputs: is_expand: true is_required: false + - priority: "" + opts: + title: "Priority" + summary: "Run priority within your organization (low, normal or high). Reorders only your own queued runs; never moves them ahead of other customers. Leave empty for normal." + description: |- + Decides which of your organization's own queued runs starts first, across + your whole concurrency pool, for every flow in this run. It never makes a + run start earlier relative to other customers: your organization keeps the + same place in the shared queue, and priority only picks which of your runs + uses it. Runs queued longer than 6 hours are promoted first, so `low` runs + are never starved, and retries keep the run's priority. + + Options: `low`, `normal`, `high`. Leave empty for the default, `normal`. + is_expand: true + is_required: false + - render_engine: "" opts: title: "Render Engine" diff --git a/test/test.bats b/test/test.bats index d3abade..e7a87d1 100644 --- a/test/test.bats +++ b/test/test.bats @@ -86,7 +86,7 @@ STUB # runner may have exported so each test specifies exactly what it wants. unset api_key app_file workspace android_device android_api_level ios_device \ name check_name async google_play debug disable_animations use_beta \ - env_list metadata download_artifacts json_file cancel_previous \ + env_list metadata download_artifacts json_file cancel_previous priority \ include_github_context DCD_STEP_VERSION \ STUB_STATUS STUB_CLOUD_EXIT STUB_STATUS_FIXTURE STUB_STATUS_RAW # ...and the Bitrise env vars the GitHub context is derived from, in case @@ -214,6 +214,21 @@ teardown() { [[ "$output" != *"--cancel-previous"* ]] } +@test "passes --priority only when priority is set" { + export api_key="k" + + export priority="high" + run bash "${TEST_DIR}/step.sh" + [ "$status" -eq 0 ] + [[ "$output" == *"STUB_CLOUD_CALLED_WITH:"*"--priority high"* ]] + [[ "$output" == *'--priority "high"'* ]] + + export priority="" + run bash "${TEST_DIR}/step.sh" + [ "$status" -eq 0 ] + [[ "$output" != *"--priority"* ]] +} + @test "boolean flags appear only when their inputs are true" { export api_key="k" export google_play="true"