Changing severity and intentionally failing builds #3922
-
I would like to fail a build when a severe problem occurs. Severe is in my case, if content is missing, e.g. an image or a topic. The DITA-OT project file based publishing creates PDFs without complaining too much. This leads to the risk, that incomplete assets are passed to our factories for mass production. For example, when the input map is missing, the build fails. This is expected.
This error indicates a missing image, this is critical for us. The severity is
This leads to a missing chapter. This is critical for us. The severity is
What's the recommended solution? Should I try to implement a custom log parser searching for strings in a |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 9 replies
-
I think @jelovirt made some recent changes for DITA OT 3.7.1 to handle missing references to images: #3858
I'm not sure if this gives the publishing engine enough flexibility to fail in such cases. |
Beta Was this translation helpful? Give feedback.
-
@xephon2, one of my colleagues at Nokia created #3858 that was fixed in 3.7.1 and we now default to strict mode. We're glad that it was addressed quickly in a fix release. We want our Jenkins doc pipeline to appropriately set the status of a Jenkins build to FAIL or UNSTABLE (Jenkins options) on certain OT messages. Missing content is very problematic, especially when generating 1000s of pages/topics in a product's doc set. We may decide to turn off strict mode and let a custom log analyzer set the Jenkins job's status according to our own rules, because if you fail a build, no other documents in a docset will be generated and you'll be in a loop of fix one problem, rerun the build, fix the next error, ad nauseum. If we're lucky, we might even be able to turn some file references into links in a tabular HTML report to the writer's local repo for the specific product. The writer might need to enter the path to the local repo on their workstation however, since we don't prescribe where local repos on each writers workstation should be stored. An HTML form field and some Javascript would take care of the link generation. At a prior company, the DocTools team created a post-processor that would create additional log files that just included messages for each severity level. If a writer just wanted to see errors, they could focus just on that log file. They would also reword the messages' text if the default OT message was not as clear or actionable as it could be. We have an open ticket for our pipeline to make the logs more actionable, particularly for writers who may be new to DITA. We support writers building docs both locally on their workstation as well as our DevOps server cluster, so we want whatever we do in this regard to be portable between Windows and Linux. We're also packaging our rendering pipeline into Docker images that can be reused at different layers. So we want to include such log filtering to be portable as well so it's part of these images. Hopefully, it can just be regex based. We might also want to scan for Jenkins errors or others in addition to OT messages. For example, if our Jenkins server can't reach our Git server, the error message doesn't make it obvious what might be the problem. We did build a custom Log Viewer using the Oxygen SDK in Java that supports regex searches, but we're not going to continue down that route since it wouldn't be usable in our DevOps pipeline. Another fairly recent consideration is that we co-author with R&D who uses Markdown for their internal documentation, which can also use our DITA pipeline. The R&D developers know nothing of DITA, so if Markdown content results in a DITA-OT error, it could make even less sense to them. They may need to see a different set of error text that describes things for a Markdown writing audience. |
Beta Was this translation helpful? Give feedback.
-
I see that @xephon2 filed the following issue to somehow increase the severity of missing keys: #3950: Fix broken key issue by raising severity of DOTJ047I I would find this ability very useful. I agree with @xephon2 and @kirkilj about the severity of missing content. To us, unresolved references of any kind - images, keys, or anything else - are a sign that something is incomplete or wrong and the result should not go to production. |
Beta Was this translation helpful? Give feedback.
-
We discussed this at length in one of the Monthly Contributor calls.
In general, however, I feel that ANY missing content or links to nowhere should fail in strict mode. Searching through OT logs for writers is like looking for needles in haystacks. Failing builds gets their attention however. Has there been any further discussion as to whether the first option is a feature candidate for OT? |
Beta Was this translation helpful? Give feedback.
-
If we create a plugin to use the extension, can we override the severity of an existing std OT message there in some fashion or is it a possibility that OT could somehow use this to allow an organization to override the severity. The last character of the message number, indicates the severity, but there's also a separate type attribute that indicates the same. Ideally, we'd like to have a mechanism where we could specify the name of log file to which any standard OT message could be appended to in addition to the standard log. For example, writing a log called something like "missing-assets.log" in which all messages with certain ids are written to. I'm just spit-balling here. |
Beta Was this translation helpful? Give feedback.
-
Just FYI: I also encountered this issue and discussed in the OxygenXML DITA forum: Our issue being: If a ditaval file reference is invalid, due to some mistake, we expect the build process to abort (especially if processing-mode strict is set, instead of simply continuing and producing content with wrong audience content). |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, Thanks for getting some discussion going on this topic! It is also important to us. In our company, we want the following conditions to stop publishing:
Some users implement custom message severity using log file parsing. This requires each user to build machinery specific to their environment. The machinery must either parse the transformation STDOUT/STDERR in real-time (complexity cost) or wait for the transformation to complete (time cost). Work might be required to synchronize the behavior of map-based transformations and DITA-OT project file publishing. Work might be required to synchronize the behavior of the authoring and publishing environments (for example, having transformations in Oxygen behave consistently with CI/CD runs as @kirkilj mentioned). I like the idea of a plugin-based method of specifying message severity overrides, similar to how we can specify text variable overrides today. I tried an experiment where I used the
DITA-OT plugin integration included my message definition along with the default definition:
Transformation failed with:
because the message lookup in |
Beta Was this translation helpful? Give feedback.
-
@chrispy-snps maybe when we want to override a message ID we could suffix it with an "-override" in the plugin's messages.xml
so in the XSLT we could first look for "idvalue-override" and if not found, look for "idvalue" and thus allow plugins to override a certain ID. |
Beta Was this translation helpful? Give feedback.
-
@raducoravu - that's an interesting idea but it might not be needed after all. In
This means a I think the |
Beta Was this translation helpful? Give feedback.
-
Here is a testcase: 3922-message-override.zip It contains a DITA map and topic file, plus a DITA plugin that attempts to apply the following message overrides:
|
Beta Was this translation helpful? Give feedback.
-
The DITA-OT development team is discussing whether unresolved
And indeed, per the DITA 1.3 specification (2.3.4.6 Processing key references), an unresolved
This behavior enables
But for some users—especially those that " The DITA-OT developers would like to hear from the DITA community about how you want unresolved |
Beta Was this translation helpful? Give feedback.
-
Practically, an unresolved keyref is likely to result in a content error in your output. It is easy to define keys as null if it's your intent that they not resolve to a topic. For those reasons, my team treats unresolved keyrefs as warnings. |
Beta Was this translation helpful? Give feedback.
-
I definitely vote for having the option to report unresolved keyrefs as at least warnings if not errors. I’m also very much in the “do not ever use @href as a fallback for a keyref” camp—you want fast and early failure for references. I wouldn’t normally want an unresolved keyref to fail a build (except when I do, like for a final production build) but I would like to have it reported clearly as a warning or error in the log. However…Oxygen’s map validation also clearly (and quickly) reports unresolved keys so, if you’re fastidious about your map validation, you shouldn’t have unresolved keys when you go to publish. Or at least, it is realistically possible to have clean maps with all keys resolved, even in a context like ours at ServiceNow, with 10s of 1000s of keys and key references across scores of publications. Not that we often achieve that ideal, but it is possible. |
Beta Was this translation helpful? Give feedback.
-
@ekimbernow - so you would want the severity of unresolved keys to be configurable, failing a final build but not a test build? Maybe a I agree that For us, Oxygen's validation falls in the "necessary but not sufficient" category. With the content reuse we have, it still sometimes happens that one writer commits something to Git that breaks another writer's content. If the publishing pipeline reliably detects issues, then these situations are detected before the content goes public. (Starting in Oxygen v25.1, Validate and Check for Completeness considers branch filtering, which significantly improved the validation of our reused conditional content!) |
Beta Was this translation helpful? Give feedback.
-
Yes, I would like key resolution failure severity to be configurable. For non-production builds (i.e., the prevew builds we run three times a day for the entire ServiceNow Platform content), we would never want unresolved keys to fail a build, even if we were using "strict" processing (which we currently do not and probably couldn't because strict also fails on unresolved topicrefs, which we currently don't consider to be a build breaker). For production builds we should be treating unresolved keys as build breakers, although we currently do not. So having the option to use strict error handling but have unresolved keys not be errors would be useful. In the production case, we might have a need to publish a time-sensitive update where we can't tolerate an unresolved topicref but can tolerate an unresolved key reference, so would want the option to make unresolved keys warnings rather than errors. |
Beta Was this translation helpful? Give feedback.
-
I support the idea of severity of unresolved keys to be configurable. |
Beta Was this translation helpful? Give feedback.
-
In the next DITA-OT monthly contributor's call, I will make a request for #4068 to be fixed in the Java code, which will then subsequently allow #3950 to be fixed in the XSLT code. |
Beta Was this translation helpful? Give feedback.
I think @jelovirt made some recent changes for DITA OT 3.7.1 to handle missing references to images: #3858
but probably your specific requests are not handle by strict mode processing. Not sure how best to approach this, maybe you could add a new issue with a sample project.
About missing key definitions, I think the DITA 1.3 specification states something like:
https://www.oxygenxml.com/dita/1.3/specs/archSpec/base/processing-key-references-general.html#processing_key_references__error-conditions