Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 12 additions & 3 deletions src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import ru.pulsar.jenkins.library.utils.Logger
class EdtValidate implements Serializable {

public static final String RESULT_STASH = 'edt-validate'
public static final String RESULT_FILE = 'build/out/edt-validate.out'
public static final String RESULT_FILE = 'build/out/edt-validate/edt-validate.out'

private final JobConfiguration config

Expand Down Expand Up @@ -55,8 +55,17 @@ class EdtValidate implements Serializable {

engine.edtValidate(steps, config, projectList)

steps.archiveArtifacts("$DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log")
steps.archiveArtifacts(RESULT_FILE)
steps.stash(RESULT_STASH, RESULT_FILE)

// Архивируем все результаты в отдельном архиве и отправляем в артефакты.
def resultDir = FileUtils.getFilePath("$RESULT_FILE").getParent()

String resultLogFrom = FileUtils.getFilePath("$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log")
String resultLogTo = FileUtils.getFilePath("$env.WORKSPACE/$resultDir/.log")
FileUtils.loadFile(resultLogFrom, env, resultLogTo) // копируем лог в папку, которая будет архивироваться
Comment on lines +63 to +65
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 25, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Копирование лога должно выполняться условно.

Код копирует лог из директории DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log, которая существует только для формата DESIGNER (строки 36-46). При использовании формата EDT (строки 46-50) этот путь не будет существовать, что приведёт к ошибке.

Оберните копирование лога в условие:

if (config.sourceFormat == SourceFormat.DESIGNER) {
    String resultLogFrom = FileUtils.getFilePath("$env.WORKSPACE/$DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log")
    String resultLogTo = FileUtils.getFilePath("$env.WORKSPACE/$resultDir/.log")
    FileUtils.loadFile(resultLogFrom, env, resultLogTo)
}
🤖 Prompt for AI Agents
In src/ru/pulsar/jenkins/library/steps/EdtValidate.groovy around lines 63 to 65,
the code always copies a log file from
DesignerToEdtFormatTransformation.WORKSPACE/.metadata/.log which only exists for
SourceFormat.DESIGNER and will fail for EDT; wrap the log-copy block in a
conditional that checks if config.sourceFormat == SourceFormat.DESIGNER and only
then compute resultLogFrom/resultLogTo and call FileUtils.loadFile so the copy
is skipped for non-DESIGNER formats.

Copy link
Member

Choose a reason for hiding this comment

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

@Kyrales посмотри на комментарий кролика, пожалуйста.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!


String archivePath = "edt-validate.zip"
Boolean archiveArtifacts = true
steps.zip("$resultDir", archivePath, '', archiveArtifacts)
}
}
9 changes: 7 additions & 2 deletions src/ru/pulsar/jenkins/library/steps/ResultsTransformer.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import java.nio.file.Paths
class ResultsTransformer implements Serializable {

public static final String RESULT_STASH = 'edt-issues'
public static final String RESULT_FILE = 'build/out/edt-issues.json'
public static final String RESULT_FILE = 'build/out/edt-validate/edt-issues.json'

private final JobConfiguration config

Expand Down Expand Up @@ -73,8 +73,13 @@ class ResultsTransformer implements Serializable {

}

steps.archiveArtifacts(RESULT_FILE)
steps.stash(RESULT_STASH, RESULT_FILE)

// Архивируем результат в отдельный архив и отправляем в артефакты.
def resultDir = FileUtils.getFilePath("$edtValidateFile").getParent()
String archivePath = "edt-validate-ResultsTransformer.zip"
Boolean archiveArtifacts = true
steps.zip("$resultDir", archivePath, '', archiveArtifacts)

}
}