Jobs that must wait and jobs that can overlap

A municipal water-billing team cuts its pipeline runtime almost in half, then discovers that two test suites fail only when they run simultaneously. One suite clears records while the other expects those same records to remain available. This episode uses the constructed failure…

A team that processes municipal water bills has made its continuous integration pipeline faster. What used to take almost twenty minutes now finishes in eleven. The team celebrated until two unrelated changes began failing the same integration test. Each change passes when run alone. The failure appears only when the pipeline runs the tests at the same time. The first guess is that the application contains an intermittent defect. The more useful question is whether the tests are independent enough to overlap.

In this illustrative service, two groups of tests share a database used to represent customer accounts. One group creates a customer with a predictable account number. The other group clears the same test data before checking bill calculation. Running them sequentially concealed the interaction. Running them concurrently exposed it. Speed did not create the underlying weakness, but the new execution plan changed when the weakness became visible. A pipeline's job relationships determine more than its completion time. They determine which assumptions are valid when work starts.

Start with the distinction between an individual step and a job. A step is an operation performed within an execution context, such as restoring dependencies or running a test suite. A job groups steps into a unit that typically receives its own execution environment. A pipeline can include several jobs, often executed by different runners. Those runners do not automatically share one working directory, set of temporary files, or current process state. If a later job needs the result of an earlier one, the pipeline must provide a deliberate way to transfer that result.

As an optional follow-up, use the AutoOps+ Study Guide from Bare Metal Cyber to trace the water-billing pipeline as a network of promises. Identify what each job needs before it starts and what evidence it must leave behind. The goal is to distinguish genuine dependencies from habits inherited from an older pipeline. Two jobs can be adjacent in the release process without needing to run one after the other, while a seemingly unrelated shared database can make simultaneous execution unsafe.

A dependency tells the orchestration system that one unit of work cannot safely begin until another has reached an acceptable outcome. For example, integration tests may require a built application package. That requirement is stronger than a preference for a neat visual order. Without it, a test job may begin before the package exists, or it may retrieve an older package left behind by a previous run. With an explicit dependency and artifact transfer, the test can use the package that the current build actually produced.

Consider a straightforward build. It produces one application package. Three test groups are available: a unit test suite, a database compatibility suite, and a browser-level customer journey test. The unit tests may not require a running service, while the browser test may need the application installed in a controlled environment. The database test may need a particular schema and data set. It would be wasteful to insist that every test waits for every other test when only some share prerequisites. But it would be incorrect to run everything simultaneously just because the platform permits parallel jobs.

This is the practical purpose of a dependency graph. Imagine the build job as the common starting point. Two independent tests branch away from it after the package is ready. A later release-candidate job waits until both results are available. The graph is described in ordinary terms as a split followed by a join. Some platforms represent relationships through broad stages, while others allow more precise job dependencies. The words may change; the logic does not. An early start is justified when a job's actual prerequisites are satisfied, not merely when a runner is free.

GitHub Actions allows a job to declare that it needs particular other jobs. Jobs without a dependency can run concurrently, subject to runner capacity and other controls. A failed or skipped prerequisite ordinarily affects jobs that depend on it unless an explicit condition changes that behavior. GitLab also supports stage-based ordering and more specific needs relationships that allow a job to start when its prerequisites finish. Jenkins can organize work into stages and parallel branches. None of these constructs knows whether a shared test database is safe for overlapping writers. The team must encode that constraint.

At the water-billing company, the engineers first add a dependency so the second test suite waits for the first. The failures disappear. That is useful evidence, but it does not establish that the underlying test design is sound. They have converted a race into a longer queue. If the tests must share an environment because of cost or licensing limits, deliberate serialization may be appropriate. If each suite can receive an isolated database instance or unique test identities, isolation can recover safe parallelism. The correct tradeoff includes time, cost, maintenance, and the confidence the results provide.

A race condition occurs when a result depends on the timing of overlapping actions. In the example, one test deletes data while another relies on it. The order of execution changes the result even though each test behaves predictably when alone. Retrying a failed job may produce a green report on the next attempt, but it can also hide the race. A pipeline that repeatedly retries until the tests pass has not proved that the application is stable. It has learned that one execution order occasionally avoids a shared-state problem.

There is another problem with treating parallelism only as a speed control. A build can depend on an artifact, but that artifact needs an identity. If job A builds version one and job B retrieves a package under a mutable name, B might test the wrong material. When jobs run in parallel, the risk of mixing files from competing runs becomes more noticeable. Each run should have a reliable relationship between source revision, build output, test input, and published result. Job dependencies govern ordering; artifact handling preserves identity. Neither can substitute for the other.

Bare Metal Cyber Cyber Challenge AutoOps+ practice offers an optional way to rehearse the same decision after listening. Imagine that three compatibility tests finish at different times and a packaging job starts as soon as the fastest one passes. Decide what evidence is missing before the package can be called eligible for release. It is a more valuable exercise than merely identifying which configuration keyword creates parallel jobs.

Now picture a different improvement request. The billing team wants to test on two operating systems and two supported language versions. A matrix can generate several related job executions with different combinations. This is an efficient way to reveal compatibility problems, but each variant needs reliable inputs and isolated output names. If all variants publish a report under the same file name to a shared location, the last writer may overwrite earlier evidence. A dashboard might then show one passing report where four distinct results were expected.

The packaging job should wait for the complete set of required evidence, not the first favorable result. That sounds simple, but optional paths complicate the graph. Some projects do not run a full integration suite for documentation-only changes. Others have platform-specific tests that are not applicable to every source revision. A job skipped because a condition was false is different from a job that ran and passed. A dependent release gate must understand which omissions were authorized. Otherwise, a pipeline may treat missing evidence as a success or block a valid candidate because an inapplicable test was skipped.

Engineers sometimes use an always-run condition to preserve logs and summaries even after other jobs fail. That is reasonable for diagnostic work. It requires caution when applied to downstream release jobs. A summary that collects failed test output is not equivalent to a release candidate that should proceed regardless of failed prerequisites. The question is what side effect the downstream job performs. You can preserve failure evidence and still refuse promotion. Separating those outcomes keeps the pipeline informative without weakening the gate.

The water-billing example exposes a second form of overlap: two complete pipeline runs start against the same staging environment. Each run is internally ordered. Both restore the environment to a baseline, deploy a candidate, and test customer billing. But their activities interleave. The first run deploys candidate A; the second deploys candidate B before the first run performs its final check. Candidate A is reported as failing because the test saw B. The jobs inside each run obey their dependencies, yet the shared environment is not protected from competing runs.

Concurrency control addresses this broader conflict. Teams may serialize access to a scarce staging environment, use independent temporary environments for each candidate, or cancel older runs when only the newest result is useful. These are different policies. Canceling an older test is reasonable when newer work supersedes it and no stateful side effects need completion. Canceling a database migration midway through a shared deployment is much more dangerous. The pipeline needs to know which work can be interrupted and how to establish a reliable state afterward.

A lock or resource group can coordinate access to a shared destination. It can prevent two authorized jobs from changing the same environment simultaneously. But a lock is not an approval mechanism. If an untrusted branch reaches a production job, exclusive access does not make that job legitimate. Likewise, limiting a pipeline to one run at a time does not guarantee that the right artifact is being tested. Ordering, authorization, and identity are separate properties. They need separate controls, even when one configuration file expresses them together.

Dependencies also affect what happens after a failure. Suppose the build fails before producing a package. A browser test cannot meaningfully validate that package. The useful response is to keep the build log and report why the downstream test did not run. If a documentation check fails while an independent unit test is still running, that unit test may finish and contribute useful evidence. Some organizations choose fail-fast behavior to conserve compute resources. Others prefer collecting complete diagnostic information. The tradeoff should be intentional rather than an accidental consequence of stage organization.

Pipeline performance is often discussed as the sum of each job's duration, but the critical path is more useful. The critical path is the longest chain of required work from the start to the final result. Speeding up a job that is already running alongside a slower independent job may not shorten the overall completion time. The team should identify real bottlenecks before spending effort on more runners or elaborate job splits. If environment setup dominates every test, sharing safe build outputs and reducing unnecessary initialization may help more than changing dependency names.

Parallel work has financial and operational costs. Additional runners consume resources. More environments create cleanup responsibilities and may expose more credentials or network paths. Test data isolation may require a database copy per run, with implications for storage and privacy. The goal is not maximum parallelism. It is the fastest trustworthy evidence the team can maintain. That principle often favors modest concurrency with predictable artifacts, bounded resource use, and clearly reported failures over an impressive but unreliable graph of overlapping jobs.

After finding the data race, the billing team gives each test suite a distinct account range and temporary database context. It keeps the build as a shared prerequisite, transfers a versioned package to the test jobs, and waits for all mandatory suites before creating a release candidate. Runs against a shared acceptance environment are serialized. Failure reports are preserved without allowing a failed test to authorize publication. The pipeline becomes slightly more complex to describe, but the relationships now match actual technical constraints.

The team validates the change by deliberately attempting an overlapping pair of test runs, an intentionally failed build, a skipped optional test, and competing requests to the shared acceptance environment. For each case, it asks what should start, what should wait, what should stop, and what result should be visible. The tests produce a clear explanation rather than an unpredictable mixture of green and red. The successful optimization is not the shorter time displayed on a dashboard. It is the ability to run independent work together without letting that overlap undermine what a passing pipeline can prove.

Jobs that must wait and jobs that can overlap
Broadcast by