Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

refactor: Add error notify and change build version number. #41

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Tyberious
Copy link

@Tyberious Tyberious commented Dec 19, 2022

Add error notify and change build version number.

Tyberious and others added 4 commits December 18, 2022 22:59
Change getBuildID() to getBuildNumber() to better match project settings and build agents.
Copy link
Owner

@pascal-zarrad pascal-zarrad left a comment

Choose a reason for hiding this comment

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

Hi, thank you for your contribution.

There are a few changes that need to be done before we can get this merged. Please check the change requests.

Additionally: While sticking to develop as branch name is fine, please update the commit messages to match the conventional commit format. You can find more information under CONTRIBUTING.md

DiscordWebHookPayload discordWebHookPayload = new DiscordWebHookPayload();
discordWebHookPayload.setEmbeds(new DiscordEmbed[]{
new DiscordEmbed(
title,
description,
description.toString(),
Copy link
Owner

Choose a reason for hiding this comment

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

Please indent this one more level.

// Check the length of the description
if (description.length() > 1800) {
// Truncate the description if it is too long
description = new StringBuilder(description.substring(0, 1800));
Copy link
Owner

Choose a reason for hiding this comment

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

I'd suggest to suffixx the build log with ... if it is too long. This way, the user will know that this is not the entire log.

String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildId();
StringBuilder description = new StringBuilder("The build with the ID " + sRunningBuild.getBuildNumber() + " has failed!");

description.append("\n" + "The build has failed with the following reason: ");
Copy link
Owner

Choose a reason for hiding this comment

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

I'd maybe add another linebreak here to have a blank line between build id line and failure reasons.

Like:

The build with the ID 1 has failed!

The build has failed with the following reason:
[reason]

I leave this decision up to you. Current layout would be also fine for me.

String description = "A build with the ID " + sRunningBuild.getBuildId() + " has been started!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildId();
String description = "A build with the ID " + sRunningBuild.getBuildNumber() + " has been started!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

String description = "The build with the ID " + sRunningBuild.getBuildId() + " has succeeded!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildId();
String description = "The build with the ID " + sRunningBuild.getBuildNumber() + " has succeeded!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

description = new StringBuilder(description.substring(0, 1800));
}

String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

String description = "The build with the ID " + sRunningBuild.getBuildId() + " has failed to start!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildId();
String description = "The build with the ID " + sRunningBuild.getBuildNumber() + " has failed to start!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

String description = "Labeling of build with the ID " + build.getBuildId() + " has failed!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + build.getBuildId();
String description = "Labeling of build with the ID " + build.getBuildNumber() + " has failed!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + build.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

String description = "The build with the ID " + sRunningBuild.getBuildId() + " is failing!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildId();
String description = "The build with the ID " + sRunningBuild.getBuildNumber() + " is failing!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

String description = "The build with the ID " + sRunningBuild.getBuildId() + " is probably hanging!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildId();
String description = "The build with the ID " + sRunningBuild.getBuildNumber() + " is probably hanging!";
String url = this.sBuildServer.getRootUrl() + "/viewLog.html?buildId=" + sRunningBuild.getBuildNumber();
Copy link
Owner

Choose a reason for hiding this comment

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

Please continue to use sRunningBuild.getBuildId(); here.
The URL expects the build id. If the build number is customized in the settings, the URL won't work anymore.

@Tyberious Tyberious changed the title Add error notify and change build version number. refactor: Add error notify and change build version number. Jan 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants