Skip to content

Commit

Permalink
Update entrypoint.sh
Browse files Browse the repository at this point in the history
added error checking
  • Loading branch information
fawadasaurus authored Oct 30, 2023
1 parent 1b04c23 commit b3cd682
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,20 @@ do
done

# Store the output in a variable
output=$(wick registry push "$(basename "$manifest_path")" $tag_flags 2>&1 | grep 'reference' | grep -E '"(\S*)"' | cut -d '"' -f2 | head -1)
echo $output
# Store the output in a variable and capture both stdout and stderr
output=$(wick registry push "$(basename "$manifest_path")" $tag_flags 2>&1)

# Check the exit status of the wick command
if [[ $? -ne 0 ]]; then
# The wick command failed. Print the error output and exit.
echo "Error: wick command failed with output:"
echo "$output"
exit 1
fi

# Process the output with your sequence of commands
processed_output=$(echo "$output" | grep 'reference' | grep -E '"(\S*)"' | cut -d '"' -f2 | head -1)
echo $processed_output

# Write the output to the GITHUB_OUTPUT environment file
echo "reference=$output" >> "$GITHUB_OUTPUT"
# Write the processed output to the GITHUB_OUTPUT environment file
echo "reference=$processed_output" >> "$GITHUB_OUTPUT"

0 comments on commit b3cd682

Please sign in to comment.