sous-chefs / jenkins

Development repository for the jenkins cookbook
https://supermarket.chef.io/cookbooks/jenkins
Apache License 2.0
424 stars 635 forks source link

Views created with jenkins_vew resource sometimes not recognized as up to date #721

Closed vorezal closed 4 years ago

vorezal commented 5 years ago

Cookbook version

7.0.0

Chef-client version

14.13.11

Platform Details

CentOS Linux release 7.4.1708 (Core) - Azure

Scenario:

I create a view with the jenkins_view resource and subsequent converges register it as up to date correctly.

Steps to Reproduce:

This is a tough one. I haven't found an error message, my testing hasn't shown the problem is with any specific job, and some views work just fine. Removing a job from one view and putting it in another sometimes resolves the problem. I have issues with views containing very different numbers of jobs, from many to just a few. I'll continue testing and provide more details if I can discover any. If there is any way to debug what is going on I'd be happy to do so and post logs.

Expected Result:

All views created are only updated if the list of jobs within them change.

Actual Result:

Subsequent converges after initial creation register the resource as not up to date and rebuild it every time.

welcomebot commented 5 years ago

Hey There It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you. Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.

If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.

vorezal commented 5 years ago

I think I nailed this down. Seems I initially stuck to specifying the list of jobs in the views alphabetically, but recently added a new one and didn't think to care about that. Jenkins then stores the jobs in config.xml alphabetically and the cookbook perceives the view as different every time. Here are steps to reproduce.

  1. Define two jobs with any steps/content named test_job_1 and test_job_2
  2. Create a view resource like so:
    jenkins_view 'Test View' do
    jobs %w(
    test_job_2
    test_job_1
    )
    end
  3. Converge multiple times

Maybe it would be easiest to just a note in the documentation that the list of jobs should be provided in alphabetical order or match what ends up in config.xml rather than refactoring the code? Also, this actually means that the create example in the documentation is not idempotent since it is not alphabetical. I tested it and it seems to recreate this every time:

jenkins_view 'ham' do
  jobs [ "pig", "giraffe" ]
end

While this is recognized as up to date correctly:

jenkins_view 'ham' do
  jobs [ "giraffe", "pig" ]
end

edit: realized my 'fixed, recognized as up to date' idempotent example hadn't had the jobs rearranged in the correct order.

github-actions[bot] commented 4 years ago

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] commented 4 years ago

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.