Skip to content

Commit

Permalink
feat: new bug report script
Browse files Browse the repository at this point in the history
Signed-off-by: Gabor Boros <[email protected]>
  • Loading branch information
gabor-boros committed Apr 23, 2024
1 parent 186d4df commit ec72bd4
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 11 deletions.
24 changes: 13 additions & 11 deletions .github/ISSUE_TEMPLATE/BUG-REPORT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ body:
id: screenshot
attributes:
label: "Screenshots"
description: If applicable, add screenshots to help explain your problem. Do not include any sensitive information.
description: |
If applicable, add screenshots to help explain your problem. Do not
include any sensitive information.
value: |
![DESCRIPTION](LINK.png)
render: bash
Expand All @@ -39,7 +41,9 @@ body:
id: logs
attributes:
label: "Logs"
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
description: |
Please copy and paste any relevant log output. This will be
automatically formatted into code, so no need for backticks.
render: bash
validations:
required: false
Expand All @@ -59,16 +63,14 @@ body:
validations:
required: false
- type: textarea
id: version
id: bug-report
attributes:
label: "Version"
description: What is the affected Elemo and Go versions?
label: "Automated bug report"
description: |
Run `scripts/bug-report.sh` locally and paste its output. If the script
fails, paste that output. If it is not applicable to share the output,
paste "N/A". Do not include any sensitive information.
placeholder: |
{
"Version": "0.1.0",
"Commit": "5a21d5a",
"Date": "2024-01-01T07:48:34Z",
"GoVersion": "go1.22.2"
}
<OUTPUT>
validations:
required: true
56 changes: 56 additions & 0 deletions scripts/bug-report.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

set -euo pipefail

ROOT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]:-$0}")/..")"
source "${ROOT_DIR}/scripts/common.sh";

function formatOutput() {
echo -e "**${1}**\n\n\`\`\`${2}\n${3}\n\`\`\`\n"
}

function promptInformation() {
read -p "This script provides some automation to help with bug reports.
During the execution, the script will run Docker and several other tools
as necessary to start the service and get the necessary information. Please
sure that Docker is running before executing this script!
The script may collect information you are not comfortable to share, such as
your OS username. Please ALWAYS check the output and remove any sensitive
information before filing the bug report.
To continue, press ENTER."
clear;
}

function getOSInfo() {
formatOutput "OS information" "text" "$(uname -a)"
}

function getLocalGoVersion() {
formatOutput "Local Go version" "text" "$(go version)"
}

function getElemoVersion() {
formatOutput "Elemo version" "json" $(
docker compose -f "${DOCKER_DEPLOY_DIR}/docker-compose.yml" run \
-T \
--rm \
--entrypoint 'bin/elemo version' elemo-server 2>&1 | grep -i version
)
}

# Prompt some warning
promptInformation

# Run preflight
checkInstalled "docker"
checkInstalled "go"

# Generate dev config if missing
generateConfigIfMissing

# Get bug report details
getOSInfo
getLocalGoVersion
getElemoVersion

0 comments on commit ec72bd4

Please sign in to comment.