Skip to content

Commit

Permalink
Merge pull request #56 from qa-guru/3.0.1
Browse files Browse the repository at this point in the history
Remove job key
Added projectName key
Update templates
  • Loading branch information
kadehar authored Jun 22, 2021
2 parents ea74034 + 84276e3 commit 82fa37e
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 25 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ All keys should be used with `-D`: <br/>

| key | description |
|:---:| :---------: |
| job | Jenkins Job Name |
| projectName | Name of project |
| env | Environment (Test, Prod, etc.) name |
| reportLink | Jenkins Build URL |
| config.file | Path to JSON-config file |

```
java \
"-Djob=${JOB_BASE_NAME}" \
"-DprojectName=${PROJECT_NAME}" \
"-Dconfig.file=${PATH_TO_FILE}" \
"-Denv=${ENVIRONMENT}" \
"-DreportLink=${BUILD_URL}" \
-jar allure-notifications-3.0.0.jar
-jar allure-notifications-3.0.1.jar
```

<h6>Config file structure</h6>
Expand Down Expand Up @@ -114,4 +114,4 @@ Example for Telegram messenger:
}
}
}
```
```
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group 'allure.notifications'
version '3.0.0'
version '3.0.1'

sourceCompatibility = 1.8

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void sendText() {

letter.from(Mail.from())
.to(Mail.recipient())
.subject(Build.job())
.subject(Build.projectName())
.text(MessageText.html())
.send();
}
Expand All @@ -28,7 +28,7 @@ public void sendPhoto() {

letter.from(Mail.from())
.to(Mail.recipient())
.subject(Build.job())
.subject(Build.projectName())
.text(message)
.image(String.format("./%s.png", Base.chartName()))
.send();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ public static String projectName() {
.of(ApplicationConfig.config
.getString("app.base.project"))
.filter(s -> !s.isEmpty())
.orElse(Build.job());
.orElse(Build.projectName());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@
import java.util.Optional;

public class Build {
/**
* <p>Получает значение по ключу <code>job</code></p>
* @return значение, если имеется
* @throws ArgumentNotProvidedException если параметр не указан или null
*/
public static String job() {
return Optional
.ofNullable(BuildConfig.config.getString("job"))
.orElseThrow(() ->
new ArgumentNotProvidedException("job"));
}

/**
* <p>Получает значение по ключу <code>env</code></p>
* @return значение, если имеется
Expand All @@ -43,4 +31,11 @@ public static String reportLink() {

return link + "allure";
}

public static String projectName() {
return Optional
.ofNullable(BuildConfig.config.getString("projectName"))
.orElseThrow(() ->
new ArgumentNotProvidedException("projectName"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public class ApplicationJournal {
public static void buildInfo() {
LOG.info(
"\n========BUILD INFO========"
+ "\nJOB: {}"
+ "\nPROJECT: {}"
+ "\nENV: {}"
+ "\nREPORT LINK: {}",
Build.job(), Build.env(), Build.reportLink());
Build.projectName(), Build.env(), Build.reportLink());
}

public static void botInfo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ private static Map<String, Object> summary() {
private static Map<String, Object> build() {
final Map<String, Object> buildInfo = new HashMap<>();
LOG.info("Applying build data...");
buildInfo.put("job", Build.job());
buildInfo.put("env", Build.env());
buildInfo.put("reportLink", Build.reportLink());
LOG.info("Done.");
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/templates/html.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<b>${results}:</b>
<b>Jenkins Job:</b> ${job}
<b>${environment}:</b> ${env}
<b>${duration}:</b> ${time}
<b>${totalScenarios}:</b> ${total}
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/templates/markdown.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
*${results}:*
*Jenkins Job:* ${job}
*${environment}:* ${env}
*${duration}:* ${time}
*${totalScenarios}:* ${total}
Expand Down

0 comments on commit 82fa37e

Please sign in to comment.