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

Error: job already exists and is not managed by nomad pack #561

Open
ruslan-y opened this issue Jun 27, 2024 · 11 comments
Open

Error: job already exists and is not managed by nomad pack #561

ruslan-y opened this issue Jun 27, 2024 · 11 comments

Comments

@ruslan-y
Copy link

Hi!

After updating a nomad-pack to version 0.1.2, sometimes an error occurs:

! Failed Job Conflict Validation
! Error: job with id "test-job" already exists and is not managed by nomad pack
!   Context:
!     Template Name: test/templates/test.nomad.tpl

If you remove a job from the cluster, it will be redeployed correctly, but after some time, this error occurs again.

@tgross
Copy link
Member

tgross commented Jun 27, 2024

Hi @ruslan-y! Just for clarity, was the job deployed by Nomad Pack before? Are you updating the job outside of Pack at all? (Ex are you also running Autoscaler or running nomad job scale)?

@ruslan-y
Copy link
Author

@tgross Yes, the job was deployed by Nomad Pack before.
And we're not updating the job outside of Pack, just use nomad-pack in our CICD.

@tgross
Copy link
Member

tgross commented Jun 27, 2024

Ok, thanks for the clarification. I'll mark this issue for roadmapping.

@tgross tgross moved this from Triaging to Needs Roadmapping in Nomad - Community Issues Triage Jun 27, 2024
@tgross tgross removed their assignment Jun 27, 2024
@ruslan-y
Copy link
Author

@tgross I also realized that if you stop the job in the Nomad UI and then run it again, the next attempt to deploy by nomad-pack will occur this error.

@josegonzalez
Copy link

josegonzalez commented Aug 21, 2024

@ruslan-y can confirm that is also happening to me with nomad-pack 0.1.2 and nomad 1.8.3.

@josegonzalez
Copy link

For the moment, this basically renders nomad-pack unusable for anyone that uses the nomad ui to manage jobs (as the job becomes unmanageable by nomad-pack once the UI interacts with it).

@shaharmendi1
Copy link

Is there any update on this issue?

@betterthanbreakfast
Copy link

Hello, is there any update on this?

@josegonzalez
Copy link

meta := existing.Meta
// if there is a job with this ID, that has no pack_deployment_name meta,
// it was created by something other than the package manager and this
// process should abort.
existingDeploymentName, ok := meta[PackDeploymentNameKey]
if !ok {
return ErrExistsNonPack{*existing.ID}
}

Looks like there is a key lookup in the meta properties for the job that indicates if nomad-pack is involved.... Does the job just lose this during UI interactions 🤔 ?

@albttx
Copy link

albttx commented Oct 18, 2024

I confirm, i have the same issue because i stop and restart the job from the ui,

At least a --force on nomad pack to enforce deploying

@shaharmendi1
Copy link

I solved it to cicd needs by generating the job spec in hcl format using nomad-pack render,
then converting it to JSON using nomad job run -output,
adding the pack metadata to the json file,
and finally publishing it using nomad job run -json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Roadmapping
Development

No branches or pull requests

6 participants