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

Fix image not shown in document chapters #789

Merged
merged 2 commits into from
Nov 25, 2021
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
- verbosity of standard shared libary stages ([#196](https://github.com/opendevstack/ods-jenkins-shared-library/issues/196))
- Allow easy configuration of compute resources ([#173](https://github.com/opendevstack/ods-jenkins-shared-library/issues/173))
- Fix rollout race condition and display events in Jenkins log ([#385](https://github.com/opendevstack/ods-jenkins-shared-library/pull/385))
- Fix image not shown in documents like TIR and DTR from Document Chapters ([#789](https://github.com/opendevstack/ods-jenkins-shared-library/pull/789))

### Changed
- Lazily set OpenShift app domain ([#396](https://github.com/opendevstack/ods-jenkins-shared-library/pull/396))
Expand Down
7 changes: 6 additions & 1 deletion src/org/ods/orchestration/usecase/LeVADocumentUseCase.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,7 @@ class LeVADocumentUseCase extends DocGenUseCase {

protected Map getDocumentSections(String documentType) {
def sections = this.project.getDocumentChaptersForDocument(documentType)

if (!sections) {
throw new RuntimeException("Error: unable to create ${documentType}. " +
'Could not obtain document chapter data from Jira.')
Expand All @@ -1680,15 +1681,19 @@ class LeVADocumentUseCase extends DocGenUseCase {
protected Map getDocumentSectionsFileOptional(String documentType) {
def sections = this.project.getDocumentChaptersForDocument(documentType)
sections = sections?.collectEntries { sec ->
[(sec.section): sec]
[(sec.section): sec + [content: this.convertImages(sec.content)]]
}
if (!sections || sections.isEmpty() ) {
sections = this.levaFiles.getDocumentChapterData(documentType)
if (!this.project.data.jira.undoneDocChapters) {
this.project.data.jira.undoneDocChapters = [:]
}
this.project.data.jira.undoneDocChapters[documentType] = this.computeSectionsNotDone(sections)
sections = sections?.collectEntries { key, sec ->
[(key): sec + [content: this.convertImages(sec.content)]]
}
}

if (!sections) {
throw new RuntimeException("Error: unable to create ${documentType}. " +
'Could not obtain document chapter data from Jira nor files.')
Expand Down