Skip to content

Commit

Permalink
Merge pull request #15 from rainforestapp/RF-24889/pp/execution-method
Browse files Browse the repository at this point in the history
[RF-24889] Add `execution_method`, deprecate `crowd`
  • Loading branch information
magni- committed Sep 22, 2022
2 parents b5c2f60 + f72c466 commit 52fda24
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 22 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ jobs:
description: foo bar
environment_id: 117
conflict: cancel-all
crowd: automation
execution_method: automation
release: '1.0'
background: true
dry_run: true
- name: All parameters test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_all_parameters.outputs.command }}
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --conflict cancel-all --environment-id 117 --crowd automation --description "foo bar" --release "1.0" --background
expected: run --skip-update --token "test_token" --run-group 42 --junit-file results/rainforest/junit.xml --save-run-id .rainforest_run_id --conflict cancel-all --environment-id 117 --execution-method automation --description "foo bar" --release "1.0" --background
- name: Custom URL command
id: test_custom_url
uses: ./
Expand Down Expand Up @@ -128,6 +128,20 @@ jobs:
with:
actual: ${{ steps.test_invalid_conflict.outputs.error }}
expected: WWIII not in (cancel cancel-all)
- name: Invalid execution_method command
id: test_invalid_execution_method
uses: ./
with:
token: test_token
run_group_id: 42
execution_method: sarlacc_pit
dry_run: true
continue-on-error: true
- name: Invalid execution_method test
uses: ./.github/actions/test
with:
actual: ${{ steps.test_invalid_execution_method.outputs.error }}
expected: sarlacc_pit not in (automation crowd automation_and_crowd on_premise)
- name: Invalid crowd command
id: test_invalid_crowd
uses: ./
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ Value | Behavior
#### Default behavior
If no `conflict` parameter is passed in, then no active runs will be canceled.

### `crowd`
The crowd to use for this run.
### `execution_method`
The execution method to use for this run.
#### Allowed values
Value | Behavior | Requirements
--- | --- | ---
`default` | Run against our global crowd of testers.
`automation` | Run against our automation agent. | - All tests in the run group are written with the Visual Editor.<br />- No tests use a Tester Instruction/Confirmation action.
`crowd` | Run against our global crowd of testers.
`automation_and_crowd` | Run against our automation agent where possible, fall back to the crowd of testers.
`on_premise_crowd` | Run against your internal testers. | - On-premise is enabled for your account.
`on_premise` | Run against your internal testers. | - On-premise is enabled for your account.
#### Default behavior
If no `crowd` parameter is passed in, the created run will run against the run group's default crowd.
If no `execution_parameter` parameter is passed in, the created run will run against the run group's default execution method.

### `release`
A string used to link a run to a release (for example, a `git` SHA or tag, a version number, a code name)
Expand Down
56 changes: 41 additions & 15 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ inputs:
required: false
default: ''

execution_method:
description: The execution method to use for this run
required: false
default: ''

crowd:
description: The crowd to use for this run
description: "DEPRECATED: Use `execution_method` instead"
required: false
default: ''

Expand Down Expand Up @@ -62,7 +67,7 @@ runs:
- name: Set Action Version
shell: bash
run: |
echo "version=2.0.0" >> $GITHUB_ENV
echo "version=2.1.0" >> $GITHUB_ENV
- name: Check for reruns
uses: pat-s/always-upload-cache@v2
if: (! inputs.dry_run)
Expand Down Expand Up @@ -138,19 +143,40 @@ runs:
fi
fi
# Validate crowd
if [ -z "${RAINFOREST_RUN_ID}" ] && [ -n "${{ inputs.crowd }}" ] ; then
case "${{ inputs.crowd }}" in
default) ;&
automation) ;&
automation_and_crowd) ;&
on_premise_crowd)
RUN_COMMAND="${RUN_COMMAND} --crowd ${{ inputs.crowd }}"
;;
*)
error "${{ inputs.crowd }} not in (default automation automation_and_crowd on_premise_crowd)"
;;
esac
# Validate execution_method / crowd
if [ -z "${RAINFOREST_RUN_ID}" ] ; then
if [ -n "${{ inputs.execution_method }}" ] ; then
case "${{ inputs.execution_method }}" in
automation) ;&
crowd) ;&
automation_and_crowd) ;&
on_premise)
RUN_COMMAND="${RUN_COMMAND} --execution-method ${{ inputs.execution_method }}"
;;
*)
error "${{ inputs.execution_method }} not in (automation crowd automation_and_crowd on_premise)"
;;
esac
fi
if [ -n "${{ inputs.crowd }}" ] ; then
echo "::warning The 'crowd' parameter is deprecated, use 'execution_method' instead."
if [ -n "${{ inputs.execution_method }}" ] ; then
error "Error: execution_method and crowd are mutually exclusive"
fi
case "${{ inputs.crowd }}" in
default) ;&
automation) ;&
automation_and_crowd) ;&
on_premise_crowd)
RUN_COMMAND="${RUN_COMMAND} --crowd ${{ inputs.crowd }}"
;;
*)
error "${{ inputs.crowd }} not in (default automation automation_and_crowd on_premise_crowd)"
;;
esac
fi
fi
# Set description
Expand Down

0 comments on commit 52fda24

Please sign in to comment.