New Policyfile.lock.json generated during `chef push`
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 18
- Forks
- 23
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 1
Description
Version:
ChefDK 0.13.21
Environment:
This happens on both my local Mac computer and remote Windows CI server.
Scenario:
I wasn't sure if this was the desired behavior so I wanted to create an issue for clarification. Basically, I'm trying to have my CI server run Chef tests and then push the policy after everything has passed. Unfortunately, the current behavior of regenerating a Policyfile.lock.json when running chef push means that the latest lock file in the remote repo will not be the one that is on the Chef server.
Steps to Reproduce:
- Using a cookbook with a Policyfile, run
chef updateto update the Policy revision. - Commit files (make note of the revision in the Policyfile.lock.json) and push to remote repository
- Run
chef push <policy_group>to push policy to the group
Expected Result:
I expect the policy revision that was created with the chef update command to be the one that is on the Chef server in the policy group and in the remote repository.
Actual Result:
- A new policy revision is generated during the
chef pushcommand. - The Git repo is dirty because the Policyfile.lock.json has been modified and not committed
- The policy revision on the Chef server is the new one from the uncommitted Policyfile.lock.json
I think this has to do with the call to write_updated_lockfile in the Push class. It seems to me that the lockfile should be validated and then pushed without writing another one.
Corresponding line in code: https://github.com/chef/chef-dk/blob/75ecb686077ba901896f0b77194da94c2830cf2e/lib/chef-dk/policyfile_services/push.rb#L78
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/chef-dk/policyfile_services/push.rb at the write_updated_lockfile call mentioned in the issue. Reproduce the chef update and chef push sequence, then verify that the existing committed Policyfile.lock.json is validated and pushed without making the Git repository dirty. Done means the Chef server uses the committed policy revision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100