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

Catch Runtime errors during open-pr and push-tag #143

Merged
merged 26 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
9c1cf4f
test
mathieu-benoit Jul 26, 2024
3e83cc5
test missing var
mathieu-benoit Jul 26, 2024
f979683
Fix missing environment resource
mathieu-benoit Jul 26, 2024
446ac6c
add failure with non existing container image
mathieu-benoit Jul 26, 2024
54263d9
Fix container image name across pipelines
mathieu-benoit Jul 26, 2024
d0b9a1c
disable score-k8s for now
mathieu-benoit Jul 26, 2024
934da33
RUNTIME_ERRORS
mathieu-benoit Jul 26, 2024
66a1d18
if RUNTIME_ERRORS
mathieu-benoit Jul 26, 2024
3a57ed6
if [ "$DEPLOYMENT_ERRORS" = "[]" && "$RUNTIME_ERRORS" = "" ]
mathieu-benoit Jul 26, 2024
f02e75f
RUNTIME_ERRORS
mathieu-benoit Jul 26, 2024
678eb0e
-A 1
mathieu-benoit Jul 26, 2024
dc0c693
Rollback tmp tests
mathieu-benoit Jul 26, 2024
db2648d
Rollback other changes not related to this PR
mathieu-benoit Jul 26, 2024
428f181
|| true
mathieu-benoit Jul 26, 2024
e2d71e4
|| true
mathieu-benoit Jul 26, 2024
a1e8ea2
-z "$RUNTIME_ERRORS"
mathieu-benoit Jul 27, 2024
22cf8bb
[[ && ]]
mathieu-benoit Jul 27, 2024
9584d9d
Graphviz link
mathieu-benoit Jul 27, 2024
f6a1082
Test exit 0
mathieu-benoit Jul 30, 2024
d9d0ad1
Skip score-k8s for now
mathieu-benoit Jul 30, 2024
d2b68f0
Fixing image error, now testing missing var
mathieu-benoit Jul 30, 2024
332b66e
MISSING_VAR
mathieu-benoit Jul 30, 2024
e926ee6
skip score-k8s
mathieu-benoit Jul 30, 2024
b812fe6
remove exit 0
mathieu-benoit Jul 30, 2024
654ef4f
Fix errors for tests
mathieu-benoit Jul 30, 2024
2da007f
Catch Runtime errors in push-tag too
mathieu-benoit Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 36 additions & 23 deletions .github/workflows/open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,38 +176,52 @@ jobs:
--org ${{ secrets.HUMANITEC_ORG }} \
--app ${{ vars.APP_NAME }} \
--env ${{ env.ENVIRONMENT_ID }} -o json)
if [ "$DEPLOYMENT_ERRORS" = "[]" ]; then
RUNTIME_ERRORS=$(humctl api get /orgs/${{ secrets.HUMANITEC_ORG }}/apps/${{ vars.APP_NAME }}/envs/${{ env.ENVIRONMENT_ID }}/runtime \
--token ${{ secrets.HUMANITEC_TOKEN }} \
| grep '"status": "Failure"' -B 10 -A 1) \
|| true
if [[ "$DEPLOYMENT_ERRORS" = "[]" && -z "$RUNTIME_ERRORS" ]]; then
echo "## Deployment successfully completed for ${{ env.ENVIRONMENT_NAME }}! :tada:" >> pr_message.txt
echo "" >> pr_message.txt
else
echo "## Deployment failed for ${{ env.ENVIRONMENT_NAME }}! :x:" >> pr_message.txt
echo "" >> pr_message.txt
echo "### Errors:" >> pr_message.txt
echo "" >> pr_message.txt
echo '```json' >> pr_message.txt
echo "" >> pr_message.txt
echo "$DEPLOYMENT_ERRORS" | jq .[0].status.message -r >> pr_message.txt
echo "" >> pr_message.txt
echo '```' >> pr_message.txt
echo "" >> pr_message.txt
echo "<details><summary>Errors details</summary>" >> pr_message.txt
echo "" >> pr_message.txt
echo "### Errors details:" >> pr_message.txt
echo '```json' >> pr_message.txt
echo "" >> pr_message.txt
echo "$DEPLOYMENT_ERRORS" >> pr_message.txt
echo "" >> pr_message.txt
echo '```' >> pr_message.txt
echo "" >> pr_message.txt
echo "</details>" >> pr_message.txt
echo "" >> pr_message.txt

if [ "$DEPLOYMENT_ERRORS" != "[]" ]; then
echo "### Deployment errors:" >> pr_message.txt
echo "" >> pr_message.txt
echo '```json' >> pr_message.txt
echo "" >> pr_message.txt
echo "$DEPLOYMENT_ERRORS" | jq .[0].status.message -r >> pr_message.txt
echo "" >> pr_message.txt
echo '```' >> pr_message.txt
echo "" >> pr_message.txt
echo "<details><summary>Deployment errors details</summary>" >> pr_message.txt
echo "" >> pr_message.txt
echo "### Deployment errors details:" >> pr_message.txt
echo '```json' >> pr_message.txt
echo "" >> pr_message.txt
echo "$DEPLOYMENT_ERRORS" >> pr_message.txt
echo "" >> pr_message.txt
echo '```' >> pr_message.txt
echo "" >> pr_message.txt
echo "</details>" >> pr_message.txt
echo "" >> pr_message.txt
fi

if [ -n "$RUNTIME_ERRORS" ]; then
echo "### Runtime errors:" >> pr_message.txt
echo "" >> pr_message.txt
echo "$RUNTIME_ERRORS" >> pr_message.txt
echo "" >> pr_message.txt
fi
fi

echo "### [View in Humanitec]($ENV_URL)" >> pr_message.txt
echo "Deployment ID: $DEPLOYMENT_ID" >> pr_message.txt

echo "" >> pr_message.txt
echo "### Domains:" >> pr_message.txt
echo "### URLs:" >> pr_message.txt
echo "" >> pr_message.txt
echo "$DOMAINS" >> pr_message.txt
echo "" >> pr_message.txt
Expand Down Expand Up @@ -247,6 +261,7 @@ jobs:
echo "<details><summary>Resources Graph</summary>" >> pr_message.txt
echo "" >> pr_message.txt
echo "### Resources Graph:" >> pr_message.txt
echo "Use a [Graphviz](https://graphviz.org) viewer for a visual representation." >> pr_message.txt
echo '```none' >> pr_message.txt
echo "" >> pr_message.txt
humctl resources graph \
Expand All @@ -259,8 +274,6 @@ jobs:
echo "" >> pr_message.txt
echo "</details>" >> pr_message.txt
fi

cat pr_message.txt
- name: comment pr
if: ${{ always() }}
run: |
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/push-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,37 @@ jobs:
--org ${{ secrets.HUMANITEC_ORG }} \
--app ${{ vars.APP_NAME }} \
--env ${{ env.ENVIRONMENT_ID }} -o json)
if [ "$DEPLOYMENT_ERRORS" = "[]" ]; then
RUNTIME_ERRORS=$(humctl api get /orgs/${{ secrets.HUMANITEC_ORG }}/apps/${{ vars.APP_NAME }}/envs/${{ env.ENVIRONMENT_ID }}/runtime \
--token ${{ secrets.HUMANITEC_TOKEN }} \
| grep '"status": "Failure"' -B 10 -A 1) \
|| true
if [[ "$DEPLOYMENT_ERRORS" = "[]" && -z "$RUNTIME_ERRORS" ]]; then
echo "## Deployment successfully completed for ${{ env.ENVIRONMENT_ID }}! :tada:"
echo ""
else
echo "## Deployment failed for ${{ env.ENVIRONMENT_ID }}! :x:"
echo ""
echo "### Errors:"
echo ""
echo "$DEPLOYMENT_ERRORS"
echo ""

if [ "$DEPLOYMENT_ERRORS" != "[]" ]; then
echo "### Deployment errors:"
echo ""
echo "$DEPLOYMENT_ERRORS"
echo ""
fi

if [ -n "$RUNTIME_ERRORS" ]; then
echo "### Runtime errors:"
echo ""
echo "$RUNTIME_ERRORS"
echo ""
fi
fi

echo "### View in Humanitec: $ENV_URL"
echo ""
echo "### Deployment ID: $DEPLOYMENT_ID"
echo ""
echo "### Domains:"
echo "### URLs:"
echo ""
echo "$DOMAINS"
echo ""
Expand Down
Loading