Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support searching for multiple error messages when retriggering a job #161

Merged
merged 17 commits into from
Feb 29, 2024

Conversation

andromaqui
Copy link
Contributor

@andromaqui andromaqui commented Feb 22, 2024

Description

This pr adds changes which enable specifying multiple error messages to search for when attempting to retrigger a github run.

Related

https://github.com/camunda/team-infrastructure/issues/572

Tests

Test 1: The workflow wont get retriggered if none of the error messages have been encountered
Commit
Test workflow invoking the composite action
Workflow run

Test 2: One of the error messages is encountered in the logs
Commit
Test workflow invoking the composite action
Workflow runs 1 and 2
Screenshot 2024-02-27 at 16 46 17

Test 3: Single line error messages are still working
Commit
Test workflow invoking the composite action
Workflow runs 1 and 2
Screenshot 2024-02-27 at 17 02 34

Test 4: Triggering the workflow through the webmodeler repo with multiple error messages retriggers the action if it fails
PR https://github.com/camunda/web-modeler/pull/8087
Commit https://github.com/camunda/web-modeler/pull/8087/commits/ad8e1be1c12f0f98a70c71f1bf01c7c0225cad68
Test workflow invoking the composite action
Workflow run attempt 1 and attempt 2

IFS=$'\n'
for line in $multiline_variable
do
json_array+="\"error$counter\": \"$line\", "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see why produce a map here ({"error1": "...", "error2": ...}) if it's much easier to make a flat list of strings (["...", "..."]), like this:

multiline_variable=$(cat << EOF
Process completed with exit code 88
Process completed, with exit code 99
EOF
)
result="["

for line in $multiline_variable
do
  result+="\"$line\","
done

result=$(echo $result | sed '$ s/,$//g')
result+="]"

echo $result

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this actually makes much more sense, will address this

@andromaqui andromaqui force-pushed the gh-672 branch 2 times, most recently from 51c9d6a to 23e92d2 Compare February 27, 2024 14:57
@andromaqui andromaqui changed the title test that the loop works Support searching for multiple error messages when retriggering a job Feb 27, 2024
Copy link
Contributor

@clementnero clementnero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for all the detailed explanations and tests 🙇
I have added some comments directly in the code.

.github/workflows/README.md Outdated Show resolved Hide resolved
rerun-failed-run/action.yml Outdated Show resolved Hide resolved
rerun-failed-run/action.yml Outdated Show resolved Hide resolved
rerun-failed-run/action.yml Outdated Show resolved Hide resolved
.github/workflows/rerun-failed-run.yml Outdated Show resolved Hide resolved
.github/workflows/README.md Outdated Show resolved Hide resolved
.github/workflows/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@clementnero clementnero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx for taking my suggestions into account.
It's all good for me 🚀

@andromaqui andromaqui merged commit 329a2fa into main Feb 29, 2024
2 checks passed
@andromaqui andromaqui deleted the gh-672 branch February 29, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants