Skip to content

Add support for bumping docker container versions referenced from within Helm files#5738

Merged
jeffwidman merged 1 commit intodependabot:mainfrom
brendandburns:helm
Oct 6, 2022
Merged

Add support for bumping docker container versions referenced from within Helm files#5738
jeffwidman merged 1 commit intodependabot:mainfrom
brendandburns:helm

Conversation

@brendandburns
Copy link
Copy Markdown
Contributor

This PR extends the recent Kubernetes support for Docker containers to common Helm chart formats:

foo:
  image:
    repository: sql/sql
    tag: 1.2.3
    registry: docker.io

or alternatively:

foo:
  image:
    repository: sql/sql
    version: 1.2.3

@honeyankit
Copy link
Copy Markdown
Contributor

@brendandburns : The docker CI / CI (docker, docker) (pull_request) build failed. There are few failures due to the naming convention of the method and variable names (Naming/MethodName:). Request you to fix that. Thank you.

@brendandburns
Copy link
Copy Markdown
Contributor Author

@honeyankit thanks I'll take a look. (is there a way that I can run these locally?)

@brendandburns
Copy link
Copy Markdown
Contributor Author

@honeyankit style issues addressed (I hope) ptal

@jeffwidman
Copy link
Copy Markdown
Member

is there a way that I can run these locally?

https://github.com/dependabot/dependabot-core#running-the-tests describes how to run the Rubocop style checks. I highly suggest running those commands within the docker container as described in the section just above that one.

Copy link
Copy Markdown
Contributor

@pavera pavera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Thanks for all the tests @brendandburns!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependabot detects dockerfiles with names like Dockerfile.ci or Dockerfile-test by selecting files that contain /dockerfile/i anywhere in the name.

From my experience it's common for Helm projects to do something similar with multiple values files, like values-staging.yaml, and then helm install -f values-staging.yaml .... Not sure if we'll land on a filename-matching approach that will accommodate the majority of scenarios, but I wanted to bring it up for consideration.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok to do this. Will add it in a later PR?

Copy link
Copy Markdown
Member

@jeffwidman jeffwidman Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later PR is fine, esp because it will fail "loudly" so we won't forget about it... ie users will complain it's not working 😄

@honeyankit honeyankit self-requested a review September 19, 2022 18:16
@brendandburns
Copy link
Copy Markdown
Contributor Author

Rebased.

@brendandburns
Copy link
Copy Markdown
Contributor Author

@honeyankit this seems to be failing because of a permission problem unrelated to this PR.

If it is something in this PR please let me know and I will try to fix it.

@mattt
Copy link
Copy Markdown
Contributor

mattt commented Sep 20, 2022

@honeyankit this seems to be failing because of a permission problem unrelated to this PR.

If it is something in this PR please let me know and I will try to fix it.

Sorry for the confusion there. That's not a required check, so it's not a blocker for merging.

The workflow in question pushes images built for PRs to GitHub Container Registry, so that we can easily deploy changes before merging. This step currently fails on PRs from forks, because forks won't have write access to GHCR (see #5668). This is a known issue and we're working on a solution.

(Also, thanks for your contribution! I'm really excited to add support in Dependabot for Helm charts)

Copy link
Copy Markdown
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 in general, had a few trivial questions/suggestions...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does helm generate these files without a final newline for some reason? I see this is true of several other files as well.

If not auto generated by Helm this way, can you please fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I filed #5814 to add a linter for this to speed up the feedback loop.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, you mention fixed, but I still see missing newlines on this file and the other json file? Did you forget to git add them perhaps?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the newlines were there, but I think that because the JSON wasn't fully formatted the newline detector was confused.

I think I have fixed this now.

@jeffwidman
Copy link
Copy Markdown
Member

Also, can you please squash the lint change commit into the original commit?

We currently can't merge via squash due to a limitation in our release script so whatever the commit history is on this branch is what makes it into main...

@brendandburns
Copy link
Copy Markdown
Contributor Author

Comments addressed, commits squashed and rebased.

Please take another look.

Thanks!

@brendandburns brendandburns force-pushed the helm branch 3 times, most recently from 70e9e0c to a5152a6 Compare September 28, 2022 22:33
@brendandburns
Copy link
Copy Markdown
Contributor Author

Comment addressed. Please take another look.

Copy link
Copy Markdown
Contributor

@bdragon bdragon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the thorough test coverage!

Copy link
Copy Markdown
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than the missing newline...

Once you fix that, then we are probably ready to 🚢 given all the other ✅ on this PR. 😄

@brendandburns brendandburns force-pushed the helm branch 2 times, most recently from 65a8ef3 to 6f6a533 Compare October 4, 2022 22:44
@brendandburns
Copy link
Copy Markdown
Contributor Author

@jeffwidman

newlines added. fwiw, the JSON formatter for VS Code/Codespaces removes the newline at the end of JSON files, so I'm not sure that newlines for JSON is standard, but nonetheless they should be there now.

Please take another look.

Thanks!

Copy link
Copy Markdown
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I have a few other PR's I need to deploy/merge first, but hopefully can push this one in the next day or two.

@jeffwidman
Copy link
Copy Markdown
Member

fwiw, the JSON formatter for VS Code/Codespaces removes the newline at the end of JSON files, so I'm not sure that newlines for JSON is standard, but nonetheless they should be there now.

Oh interesting. I'm surprised by that, I'll have to research that a bit more.

@jeffwidman
Copy link
Copy Markdown
Member

That looks better, @brendandburns see ☝️ I have no idea what went wrong, something in GitHub's Update with Rebase command... Anyway, I wasn't sure what email you preferred to use, and there was no history due to the force push so I used your @microsoft.com email, as that's what it looks like you used elsewhere on other commits on your profile.

I'll deploy this once CI goes green, and assuming everything looks good in production will merge this later tonight.

@jeffwidman jeffwidman merged commit 96cbb6c into dependabot:main Oct 6, 2022
@brendandburns
Copy link
Copy Markdown
Contributor Author

@jeffwidman Thanks and yes, the @microsoft.com address is generally what I use.

Great to see this merge!

@nilekhc
Copy link
Copy Markdown

nilekhc commented Oct 11, 2022

That looks better, @brendandburns see ☝️ I have no idea what went wrong, something in GitHub's Update with Rebase command... Anyway, I wasn't sure what email you preferred to use, and there was no history due to the force push so I used your @microsoft.com email, as that's what it looks like you used elsewhere on other commits on your profile.

I'll deploy this once CI goes green, and assuming everything looks good in production will merge this later tonight.

Hi @jeffwidman, Do we need to cut a new tag to use this feature?

@jeffwidman
Copy link
Copy Markdown
Member

It is already deployed to GitHub prod, but requires a feature flag. If you are using it somewhere other than GitHub than you'll need to use mainas not yet on a tagged release.

@nilekhc
Copy link
Copy Markdown

nilekhc commented Oct 12, 2022

It is already deployed to GitHub prod, but requires a feature flag. If you are using it somewhere other than GitHub than you'll need to use mainas not yet on a tagged release.

I am using it outside of GH. When it'll be available on tagged release?

@nilekhc
Copy link
Copy Markdown

nilekhc commented Oct 17, 2022

@jeffwidman Any timeline on when the tag release will cut?

@jurre
Copy link
Copy Markdown
Member

jurre commented Oct 25, 2022

I am using it outside of GH. When it'll be available on tagged release?

We don't really do tagged releases anymore as our deployment model has changed a bit and we don't need them anymore, you can just pull the changes in from a sha

@nilekhc
Copy link
Copy Markdown

nilekhc commented Oct 25, 2022

cc @mburumaxwell

@jeffwidman
Copy link
Copy Markdown
Member

jeffwidman commented Oct 26, 2022 via email

@jeffwidman
Copy link
Copy Markdown
Member

Currently this is buried behind a feature flag for folks on GitHub.com...

We'd like to start slowly rolling it out for everyone, but before I do that, I'd like to test on a few repos to ensure no unexpected issues. I can / will setup a fake test repo, but there's nothing like live data to confirm things.

Anyone watching this PR care to volunteer to have their repo(s) be part of the beta test?

Repos must match the following criteria:

  • on GitHub.com
  • public, because for security reasons we can't access private repos w/o jumping through some hoops
  • have helm files... ideally with a combination of up-to-date and outdated docker image tags

If interested, please comment on this thread with the URLs of any repos you own/maintain.

@jeffwidman
Copy link
Copy Markdown
Member

@nilekhc This is now live on RubyGems: https://rubygems.org/gems/dependabot-omnibus/versions/0.213.0

@nilekhc
Copy link
Copy Markdown

nilekhc commented Oct 31, 2022

Currently this is buried behind a feature flag for folks on GitHub.com...

We'd like to start slowly rolling it out for everyone, but before I do that, I'd like to test on a few repos to ensure no unexpected issues. I can / will setup a fake test repo, but there's nothing like live data to confirm things.

Anyone watching this PR care to volunteer to have their repo(s) be part of the beta test?

Repos must match the following criteria:

  • on GitHub.com
  • public, because for security reasons we can't access private repos w/o jumping through some hoops
  • have helm files... ideally with a combination of up-to-date and outdated docker image tags

If interested, please comment on this thread with the URLs of any repos you own/maintain.

Hey @jeffwidman, we can test with our repo if you are still looking for volunteers.
https://github.com/Azure/secrets-store-csi-driver-provider-azure

Let me know what I need to do.

cc @aramase

@jeffwidman
Copy link
Copy Markdown
Member

Awesome thanks @nilekhc

I will enable the feature flag on your repo tomorrow, and then since it's a public repo I think I can internally trigger a dry-run to test it. I'll post a follow-up once the flag is enabled.

@jeffwidman
Copy link
Copy Markdown
Member

Also @nilekhc you'll need to enable a "docker" ecosystem check in https://github.com/Azure/secrets-store-csi-driver-provider-azure/blob/master/.github/dependabot.yml for the whatever folder holds these files. IIRC, the check will recursively search for files, so if you've got nested subdirs of charts, targeting the "docker" check at the parent dir should be fine.

@nilekhc
Copy link
Copy Markdown

nilekhc commented Nov 4, 2022

Also @nilekhc you'll need to enable a "docker" ecosystem check in https://github.com/Azure/secrets-store-csi-driver-provider-azure/blob/master/.github/dependabot.yml for the whatever folder holds these files. IIRC, the check will recursively search for files, so if you've got nested subdirs of charts, targeting the "docker" check at the parent dir should be fine.

PR - Azure/secrets-store-csi-driver-provider-azure#1014

@nilekhc
Copy link
Copy Markdown

nilekhc commented Nov 11, 2022

@jeffwidman It's working on our repo -
https://github.com/Azure/secrets-store-csi-driver-provider-azure/pulls

@jeffwidman
Copy link
Copy Markdown
Member

Awesome news thanks for circling back!

@jeffwidman
Copy link
Copy Markdown
Member

I've enabled the feature flag on 100% of GitHub.com cloud repos, so anyone is now welcome to try this on their repos. If you run into any bugs, please file an issue.

@jeffwidman jeffwidman changed the title Add support for helm files. Add support for bumping docker container versions referenced from within Helm files Nov 29, 2022
@nilekhc
Copy link
Copy Markdown

nilekhc commented Dec 1, 2022

I've enabled the feature flag on 100% of GitHub.com cloud repos, so anyone is now welcome to try this on their repos. If you run into any bugs, please file an issue.

@jeffwidman Did you do any special setup while enabling this feature? I am trying to run it manually by building dependabot docker image and running dependabot/dependabot-core bundle exec ruby ./generic-update-script.rb but got error Found neither Kubernetes YAML nor Dockerfiles in <directory_name> (Dependabot::DependabotError). <directory_name> here is pointing to the directory where I have values.yaml file.

@jeffwidman
Copy link
Copy Markdown
Member

☝️ is resolved, right @nilekhc ? Catching up on old notifications... 😀

@nilekhc
Copy link
Copy Markdown

nilekhc commented Jan 12, 2023

☝️ is resolved, right @nilekhc ? Catching up on old notifications... 😀

It is!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants