-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(control-instance): Check task state before running command
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,6 +114,39 @@ jobs: | |
`${{ steps.command.outputs.command_name }}` command failed because **${{ steps.define.outputs.instance_name }}** instance does not exist. | ||
- name: Check if server action already in progress | ||
id: check_task_state | ||
run: | | ||
export OS_CLOUD=BIO180006_IU # Select openstack auth settings defined in ".config/openstack/clouds.yaml" | ||
source ~/venv/bin/activate | ||
task_state=$(openstack server show instance-30 -f json | \ | ||
jq -r '.["OS-EXT-STS:task_state"]') | ||
echo "task_state [$task_state]" | ||
echo "task_state=$task_state" >> $GITHUB_OUTPUT | ||
if [[ "$task_state" != "null" ]]; then | ||
echo "::error ::Server action already in progress. Task state is '$task_state'." | ||
exit 1 | ||
fi | ||
env: | ||
INSTANCE_NAME: ${{ steps.define.outputs.instance_name }} | ||
|
||
- name: comment (server action already in progress) | ||
if: ${{ steps.check_task_state.outcome == 'failure' && failure() }} | ||
uses: peter-evans/[email protected] | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: | | ||
### Command Results ❌ | ||
`${{ steps.command.outputs.command_name }}` command failed to be applied to **${{ steps.define.outputs.instance_name }}** instance. | ||
A server action is already in progress. Task state is `${{ steps.check_task_state.outputs.task_state }}`. | ||
See details at https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- name: Execute command | ||
id: execute_command | ||
if: | ||
|