Fix Cloud Manager Pipeline Failures and Quality Gates
A failed Cloud Manager pipeline is information, not a verdict on your work. The run is telling you which rule your code broke, how far the build got and whether a person has to decide what happens next. Developers who read the run carefully fix the cause in one commit. Developers who skip to the override button ship the same problem to stage and production.
This lesson shows how to read a failed run step by step, how the code quality ratings and coverage are calculated, what the quality gates do with each severity, and when an override is appropriate. The worked example uses mysite in program 12345, with a ResourceResolver that is never closed, an HTTP call without a timeout and a helper class whose branches are not tested.

Table of contents
- Why this matters
- Who should read this
- Prerequisites
- Reading a failed pipeline step
- Code quality ratings and coverage
- Quality gates and severity
- Override rules and when to use them
- Re-running after a quality failure
- Hands-on: fix a failing run
- Pre-push checklist and fix-it cheat sheet
- Common failures and troubleshooting
- Hands-on challenge
- Key takeaways
- Knowledge check
- Frequently asked questions
- Continue your learning
Why this matters
Quality gates are the team’s shared agreement on what good code means. When a gate fails, the question to ask is what rule the code broke and why the rule exists. The answer is almost always a bug you would rather find now than during a Black Friday load test.
✅ Read the first failing step, not the last error in the log.
✅ Understand what the rating and coverage numbers measure, so you can predict the result before you push.
✅ Fix the cause with a real change, and add tests that exercise every branch.
✅ Know when an override is a business decision and when it is a shortcut you should not take.
Who should read this
This lesson is for developers who see a red Cloud Manager run and need to fix it, and for reviewers who approve or reject an override. It assumes you have already run a pipeline, as covered in the Cloud Manager for AEM developers lesson.
Prerequisites
- A Cloud Manager user with the Developer role, and access to the program’s repository.
- Java 21 and Maven installed locally, so you can reproduce the build before you push. Cloud Manager’s build image uses Apache Maven 3.9.4, and Java 21 is the current default AEM runtime.
- Familiarity with JUnit 5. The unit test example below uses it.
- Read Sling Models and HTL for the
@Injectrule discussed later.
Reading a failed pipeline step
Open the failed run from the Pipelines card. Choose the ellipsis menu on the pipeline and then View last execution. The run shows its steps in order. Read down the list until you find the first step with a failure. Later steps may show failures only because the first one stopped the run, so do not start with the last red step.
- Find the first failed step and open its details. Note whether it is a build, a code quality, a stage testing or a deployment step.
- For a build failure, download the build log and search for
ERRORandBUILD FAILURE. The first Maven error is the one to fix. Ignore the summary at the bottom. - For a code quality failure, open the quality details. Each finding names the rule, the severity and the file location in the project. Download the details report to sort the findings by file.
- For a stage testing failure, open the test output. Custom functional tests report the test class and the assertion that failed.
- For a deployment failure, check whether the run failed in the production deployment step. That step is the only one you can re-execute.

The download report names each finding with its rule key, the file path inside the project and the line. Use the rule key to look up the rule description, which tells you what the rule considers wrong and the usual fix.
Code quality ratings and coverage
The code quality step gives three areas a letter grade from A to E, where A is the best: security, reliability and maintainability. Coverage is measured as a percentage, not a grade. A single leaked resource can move a grade.
| Rating area | What it measures | What moves it |
|---|---|---|
| Security rating (A to E) | Vulnerabilities by severity. Fails as Critical below B, so one major vulnerability fails the run. | Hardcoded credentials, unsafe inputs and other rules flagged as security issues |
| Reliability rating (A to E) | Bugs by severity. Fails as Critical below D, so one blocker bug fails the run. | Resource leaks, missing timeouts, incorrect logic |
| Maintainability rating (A to E) | Remediation cost of code smells as a percentage of the time spent on the application. Important below A (more than 5%). | Duplicated code, overly complex methods, log-and-throw patterns |
| Coverage (percentage) | Line and condition coverage from unit tests. Important below 50%. | Lines and conditions that no test runs |
| Skipped unit tests, open issues, duplicated lines, Cloud Service compatibility | Info only. Thresholds: more than 1 skipped test, more than 0 open issues, more than 1% duplicated lines, more than 0 compatibility issues. | Reported in the run, but they do not stop it |
Note:- Cloud Service Compatibility is listed as Info, but that is changing for deprecated APIs. The rule Do not use Experience Manager deprecated APIs gets stricter as the removal date gets closer: pipelines pause in December 2026 and fail from January 2027. Read Fix Deprecated APIs Before Cloud Manager Pipelines Fail before you reach for an override.
Coverage is a blend of line coverage and condition coverage. Adobe’s formula is Coverage = (CT + CF + LC) / (2*B + EL), where CT and CF are conditions evaluated as true and as false at least once, LC is covered lines, B is the total number of conditions and EL is the number of executable lines. A line is covered if a test runs it. A condition is covered when the tests exercise its outcomes. In practice, an untested if costs you twice: the line is not covered, and the condition is not proven on both sides. A test that calls the method once with a happy-path input does not move the number much. Write one test for each branch you care about.
Quality gates and severity
Each finding has a severity that decides what the pipeline does next. Cloud Manager groups them into three behaviours, and check the rules reference in Adobe’s documentation for the tier of each rule.
| Tier | Pipeline behaviour | What you do |
|---|---|---|
| Critical | The run fails immediately. The pipeline does not continue to deployment. | Fix the code in a new commit. Overrides are not offered for critical findings. |
| Important | The run pauses. A Deployment Manager, project manager or business lead can override the finding and continue, or accept it and fail the run. | Fix the code, or ask an approver to decide with a documented reason. |
| Info | The finding is reported and does not block the run. | Fix it when it is cheap to do so, and track recurring patterns. |
Which of these happens to an Important finding is decided by the pipeline’s Important Metric Failures Behavior setting, which you choose when you create the production pipeline (see Cloud Manager for AEM developers). Ask every time pauses the run for a person, Fail Immediately stops it and Continue Immediately lets it carry on. In a code-quality-only pipeline, Important findings cannot be overridden, because nothing is deployed from that run.
Note:- Continue Immediately lets every Important finding pass without a human decision. Use it only for a documented, temporary reason, and remove it when the reason ends.
Override rules and when to use them
An override is a decision to proceed despite a finding. It does not change the code, and it does not change the rating. The run goes on and the finding stays in the report. Treat every override as a release risk with a name attached.
- Override only for an Important finding, never for a Critical one.
- Override only with a written reason in the ticket that tracks the fix, with a date.
- Do not override to get a release out on time when the finding is a real bug. Ask for a delay or a hotfix instead.
- A false positive is different from a risk. Fix or suppress the false positive in code, so the next run is clean without an override.
Suppression is the right tool for a real false positive. Put the annotation on the narrowest element that the rule reports, and name the rule key so the next reader knows what was suppressed. The example below suppresses a rule that flags any field name containing the word “password”. It is not a password, so the suppression is honest. A hardcoded password is a different case and must be removed.
public final class CredentialFields {
@SuppressWarnings("squid:S2068")
public static final String PASSWORD_PROPERTY = "password";
private CredentialFields() {
}
}
Re-running after a quality failure
A failed Code Quality step cannot be re-executed. Re-execution only exists for the production deployment step, so the fix for a quality failure is always a new commit and a new run. How re-execution and build reuse work is covered in Cloud Manager for AEM developers. Here, if a run shows an old result, compare the commit hash on the run with your latest commit before you debug anything else.
Hands-on: fix a failing run
The steps below reproduce a realistic failure on the mysite feature branch. The starting code is shown in the steps. Your own failure may differ, but the method is the same.
Step 1: Open the failed run and list the findings
Open the run and find the first failed step, which is the Code Quality step. Open its details and list every finding with its rule, severity and file. For this example, the findings are an unclosed resource resolver in ProductPriceServiceImpl, an HTTP client call without timeouts in CatalogClient, and a coverage drop in PriceFormatter.

Step 2: Fix the resource resolver leak
A ResourceResolver must be closed. The code below opens one and never closes it. Under load, each call leaves a resolver open until it is garbage collected, which is not a reliable release of resources.
// Before: the resolver is never closed
public String getPrice(String sku) throws LoginException {
ResourceResolver resolver = factory.getServiceResourceResolver(
Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, "catalog-reader"));
return resolver.getResource("/content/mysite/products/" + sku)
.getValueMap().get("price", String.class);
}
The fixed version uses try-with-resources, so the resolver closes on every path, and it handles a missing product instead of throwing a NullPointerException. The subservice name must match a service user mapping in your project. The service user tutorial shows how to create one with repoinit.
private static final String PRODUCT_ROOT = "/content/mysite/products/";
public String getPrice(String sku) throws LoginException {
try (ResourceResolver resolver = factory.getServiceResourceResolver(
Collections.singletonMap(ResourceResolverFactory.SUBSERVICE, "catalog-reader"))) {
Resource product = resolver.getResource(PRODUCT_ROOT + sku);
if (product == null) {
return null;
}
return product.getValueMap().get("price", String.class);
}
}
Step 3: Add timeouts to the outbound HTTP call
An HTTP call without timeouts can wait forever. The rule flags it as a reliability bug. Set explicit connect and socket timeouts on the request configuration, and reuse one client rather than building a new one per call. The values below are a starting point, so pick numbers that match your service’s SLA.
RequestConfig requestConfig = RequestConfig.custom()
.setConnectTimeout(5000)
.setSocketTimeout(5000)
.build();
CloseableHttpClient client = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.build();
Step 4: Add tests so every branch is covered
The PriceFormatter class below has three decisions: a null price, a missing currency and a present currency. The test class covers each branch, including the null currency, which is the one most often missed.
public final class PriceFormatter {
private PriceFormatter() {
}
public static String format(Double price, String currency) {
if (price == null) {
return "N/A";
}
if (currency == null || currency.isEmpty()) {
return String.format(Locale.ROOT, "%.2f", price);
}
return currency + " " + String.format(Locale.ROOT, "%.2f", price);
}
}
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
class PriceFormatterTest {
@Test
void returnsPlaceholderWhenPriceIsMissing() {
assertEquals("N/A", PriceFormatter.format(null, "USD"));
}
@Test
void omitsCurrencyWhenNull() {
assertEquals("19.90", PriceFormatter.format(19.9, null));
}
@Test
void prefixesCurrencyWhenPresent() {
assertEquals("USD 19.90", PriceFormatter.format(19.9, "USD"));
}
}
Step 5: Reproduce the build locally and check coverage
Run the same Maven build locally before you push. The report shows which lines and conditions the tests skip. Open the JaCoCo report in the core module and look for red and yellow lines in the classes you changed.
java -version
mvn --batch-mode clean verify
open core/target/site/jacoco/index.html
The JaCoCo report only exists if the core module binds the report goal. If core/target/site/jacoco is missing, check the plugin configuration in the module’s pom.xml before you assume the tests ran.

Step 6: Push the fix, re-run and read the gates
Commit the fixes in one commit, push, and run the code quality pipeline again. A green Code Quality step means the run no longer reports blocking findings. If a finding remains, read it as a new failure, not as a retry of the old one.
git add core/src
git commit -m "Close resource resolver, add HTTP timeouts, cover PriceFormatter branches"
git push

Pre-push checklist and fix-it cheat sheet
Keep this next to your editor. Most failed runs come from the same few causes, and every one of them is cheaper to catch on your laptop than in the pipeline.
| What the run says | What it usually means | Fix |
|---|---|---|
| Reliability rating drops | A resource leak or missing timeout | Close the ResourceResolver with try-with-resources and set connect and socket timeouts |
| Coverage below 50% | Branches that no test takes | Add one test per branch, then check the JaCoCo report |
| Security rating below B | A vulnerability such as a hardcoded credential | Remove the secret from code and read it from configuration |
| Maintainability rating below A | Duplicated or overly complex code | Extract and simplify, in small commits |
| Green run, but Open Issues is above 0 | An Info finding, reported but not blocking | Fix it when it is cheap, and track patterns that repeat |
Before every push, tick these off:
- ✅
mvn clean verifypasses locally on the same Java version as the pipeline. - ✅ The JaCoCo report shows no red or yellow lines in the classes you changed.
- ✅ No new region-deprecated-api warnings in the build log.
- ✅ Every suppression names its rule key and has a reason in the review note.
Note:- Pick one thing from the cheat sheet that your own project gets wrong most often and fix it this week. One recurring finding removed is worth more than ten overrides.
Common failures and troubleshooting
Build and dependency errors, Java version problems and stale results are covered in the troubleshooting table of Cloud Manager for AEM developers. The table below is about quality failures.
| Symptom | Likely cause | Fix |
|---|---|---|
| Coverage rating drops after a refactor | New branches are not covered by any test | Open the JaCoCo report, find the red and yellow lines, and add a test that takes each branch. |
| Run paused at an Important finding | The pipeline is set to Ask every time | Ask a Deployment Manager, project manager or business lead to decide. Provide the ticket and the fix date. |
Hands-on challenge
Start from a branch where ProductPriceServiceImpl does not close its resolver and CatalogClient has no timeouts. Fix both, add the four PriceFormatterTest cases, and run mvn clean verify locally until the JaCoCo report shows full coverage of PriceFormatter. Push the branch, run the code quality pipeline, and confirm the Code Quality step passes.
Key takeaways
- Read the first failed step. Later failures may be caused by an earlier one.
- Security, reliability and maintainability are graded A to E. Coverage is a percentage, and below 50% it is an Important failure. Each one traces to findings you can fix.
- Coverage counts both lines and conditions, so test every branch, not just the happy path.
- Critical findings fail the run and cannot be overridden. Important findings pause the run and need a documented decision.
- A fix needs a new commit. Suppress only real false positives, on the narrowest element, with the rule key named.
Knowledge check
What should you open first when a run has several failed steps?
The first failed step in the run’s step list. Later failures can be a consequence of an earlier stop.
Why does an untested if lower coverage more than a single missing line?
Coverage is a blend of lines and conditions. An untested branch leaves its line uncovered and also leaves its condition without proof that both sides run.
Which severity can a Deployment Manager override?
Important. Critical findings fail the run and are not offered for override. Info findings do not block the run.
Can you override an Important finding in a code-quality-only pipeline?
No. In that pipeline the Code Quality step is the last step, so there is nothing to continue to. Fix the code and run it again.
What is the right response to a false positive from a code quality rule?
Suppress it on the narrowest element with the rule key named, and explain why in a comment or the review note. Do not suppress a real finding to pass the gate.
Frequently asked questions
Can I skip the code quality step for a hotfix?
Do not plan on skipping it. A hotfix still goes through the pipeline. Keep the fix small and add the tests it needs.
Why does the same commit pass locally and fail in the pipeline?
Usually the Java version or a file that was not committed. Compare .cloudmanager/java-version with the Java you built with locally.
Is a coverage threshold the same across all programs?
Yes. Adobe documents one set of thresholds for every program: coverage below 50% is an Important failure. Teams often set a higher target for their own code reviews, but the Cloud Manager gate is 50%. Check Adobe’s Code Quality Testing page when a release changes the rules.
Should I fix every Info finding?
Fix Info findings when they are cheap, and track any pattern that repeats across the codebase.
Continue your learning
- Previous lesson: Lesson 13, Cloud Manager for AEM developers.
- Next lesson: see the AEM as a Cloud Service roadmap for the next Module 3 topic.
- Practice: the Cloud Manager practice test.
- Related: the scheduled Sling jobs tutorial for code that often triggers quality findings.
Leave a Reply