Repository navigation
system deployments: cancel older deployments even if inactive - #28545
Merged
Merged
Conversation
tgross
force-pushed
the
nmd1735-system-deploy-cancel
branch
from
September 11, 2026 00:20
0ff9ee9 to
ca581af
Compare
In Nomad 1.11.0 we added deployments for system jobs. As part of that work we added the logic to "cancel" deployments that belong to older versions of the job (in #26953). This involves two operations: move the reconciler state tracking that deployment to an "old" field, and optionally recording that we'll want to update the state store as part of the plan. This logic was copied from the cluster reconciler used for service/batch jobs, but the clause that updates the reconciler state was placed inside the clause that updated the state store. This prevents us from creating new deployments for updated versions of the job unless the prior version is still active. Move this logic outside the `Active()` check, and add test coverage we were missing of this code path. Fixes: #28538 Ref: https://hashicorp.atlassian.net/browse/NMD-1735 Ref: #26953
tgross
force-pushed
the
nmd1735-system-deploy-cancel
branch
from
September 11, 2026 00:22
ca581af to
9a6b61f
Compare
tgross
marked this pull request as ready for review
September 11, 2026 00:30
tgross
requested review from
Juanadelacuesta,
chrisroberts,
gulducat,
mismithhisler and
tehut
and removed request for
gulducat and
mismithhisler
September 11, 2026 00:30
tehut
approved these changes
Sep 11, 2026
Merged
5 of 8 tasks
schmichael
pushed a commit
to vercel/nomad
that referenced
this pull request
Sep 25, 2026
…orp#28545) In Nomad 1.11.0 we added deployments for system jobs. As part of that work we added the logic to "cancel" deployments that belong to older versions of the job (in hashicorp#26953). This involves two operations: move the reconciler state tracking that deployment to an "old" field, and optionally recording that we'll want to update the state store as part of the plan. This logic was copied from the cluster reconciler used for service/batch jobs, but the clause that updates the reconciler state was placed inside the clause that updated the state store. This prevents us from creating new deployments for updated versions of the job unless the prior version is still active. Move this logic outside the `Active()` check, and add test coverage we were missing of this code path. Fixes: hashicorp#28538 Ref: https://hashicorp.atlassian.net/browse/NMD-1735 Ref: hashicorp#26953
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In Nomad 1.11.0 we added deployments for system jobs. As part of that work we added the logic to "cancel" deployments that belong to older versions of the job (in #26953). This involves two operations: move the reconciler state tracking that deployment to an "old" field, and optionally recording that we'll want to update the state store as part of the plan.
This logic was copied from the cluster reconciler used for service/batch jobs, but the clause that updates the reconciler state was placed inside the clause that updated the state store. This prevents us from creating new deployments for updated versions of the job unless the prior version is successful or still active.
Move this logic outside the
Active()check, and add test coverage we were missing of this code path.Fixes: #28538
Ref: https://hashicorp.atlassian.net/browse/NMD-1735
Ref: #26953
Testing & Reproduction steps
Using the following jobspec derived from the ones posted by @daniel1302
in #28538 (comment)
jobspec
Run the following and wait for the deployment to be successful.
Run it again with a broken path, and wait for the deployment to fail.
Run it a third time and you'll see there's no deployment created. With this patch we do see a deployment as expected.
Contributor Checklist
changelog entry using the
make clcommand.ensure regressions will be caught.
and followed the AI usage guide.
Reviewer Checklist
backporting document.
in the majority of situations. The main exceptions are long-lived feature branches or merges where
history should be preserved.
within the public repository.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.