Skip to content

Commit

Permalink
BUGFIX: Use all job IDs from the e2e step
Browse files Browse the repository at this point in the history
  • Loading branch information
markusguenther committed Jan 25, 2024
1 parent 721e508 commit ff94c49
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 2 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,16 +136,11 @@ jobs:
&& sudo apt update \
&& sudo apt install gh -y
- run:
name: Extract Job ID
name: Run Script
command: |
# Extract job ID from the output file
JOB_IDS=$(cat /home/circleci/app/AcceptanceTesting.log | grep -o 'https://app.saucelabs.com/tests/[a-zA-Z0-9]\+' | sed 's/.*\///')
echo "Job IDs: $JOB_IDS"
- run:
name: Run Script
command: |
cd /home/circleci/app
./Build/comment-acceptance-tests.sh "$JOB_IDS" "$(basename "$CIRCLE_PULL_REQUEST")"
/home/circleci/app/Build/comment-acceptance-tests.sh "$JOB_IDS" "$(basename "$CIRCLE_PULL_REQUEST")"
php-unittests:
environment:
Expand Down
12 changes: 9 additions & 3 deletions Build/comment-acceptance-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ fi

function generateCommentBody() {
# Split the JobID string into an array
IFS=' ' read -ra jobIdArray <<< "$jobIds"
IFS=$'\n' read -r -d '' -a jobIdArray <<< "$jobIds"
echo "JobID: $jobIds"
echo "JobID Array: ${jobIdArray[@]}"

# Iterate over each JobID in the array
for i in ${!jobIdArray[@]}; do
iterator=$(($i+1))
jobId="${jobIdArray[$i]}"
echo "JobID: $jobId"
link="[Recording $iterator](https://app.saucelabs.com/rest/v1/jobs/$jobId/video.mp4)"
videoRecordingsLinks+="\n* $link"
echo "Video Recording Link: $link"
done

# Construct the comment with the latest acceptance test recordings
Expand Down Expand Up @@ -49,8 +53,11 @@ function updateComment() {
echo "Updating existing comment..."
commentUri=$(echo "$existingComment" | jq -r ".url")
commentId=$(echo "$commentUri" | awk -F'#issuecomment-' '{print $2}')
jsonBody=$(jq -n --arg str "$(printf "$commentBody")" '{"body": $str}')
echo "Comment JSON: $jsonBody"
echo "Comment ID: $commentId"
curl -s -H "Authorization: token $GH_TOKEN" \
-X PATCH -d "{\"body\":\"$(printf "$commentBody")\"}" \
-X PATCH -d "$jsonBody" \
"https://api.github.com/repos/neos/neos-ui/issues/comments/$commentId"
}

Expand All @@ -61,7 +68,6 @@ getExistingComment

echo "Existing comment: $existingComment"
if [ -n "$existingComment" ]; then
echo "Updating existing comment..."
updateComment
else
createComment
Expand Down

0 comments on commit ff94c49

Please sign in to comment.