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

Support for helm #366

Closed
nilekhc opened this issue Oct 11, 2022 · 29 comments
Closed

Support for helm #366

nilekhc opened this issue Oct 11, 2022 · 29 comments
Labels
enhancement New feature or request

Comments

@nilekhc
Copy link

nilekhc commented Oct 11, 2022

Hey @mburumaxwell,
Recently, we have added support for helm in dependabot core. dependabot/dependabot-core#5738

Do we need a new release of the docker image here?

@mburumaxwell
Copy link
Contributor

Hi @nilekhc , yes a new release of the docker image is required but after there's a new release of the depenedabot-core package. The last one was over a month ago, but I see you are already ahead of game: dependabot/dependabot-core#5738 (comment).

@nilekhc
Copy link
Author

nilekhc commented Oct 13, 2022

@mburumaxwell, does the latest tag of tingle/dependabot-azure-devops pull main branch of dependabot-core?

@mburumaxwell
Copy link
Contributor

@nilekhc no it doesn't because this repository uses the gem packages that have been released. I am unsure of the stability in supporting "nightly" versions of dependabot-core

@nilekhc
Copy link
Author

nilekhc commented Oct 25, 2022

@mburumaxwell Looks like dependabot core has changed its release model. Could you make changes to your release pipeline?

dependabot/dependabot-core#5738 (comment)

@nilekhc
Copy link
Author

nilekhc commented Oct 31, 2022

@mburumaxwell Looks like they have released a new version - dependabot/dependabot-core#5738 (comment)

@nilekhc
Copy link
Author

nilekhc commented Nov 4, 2022

@mburumaxwell Any luck with new release of the extension?

@mburumaxwell
Copy link
Contributor

@nilekhc quite a number of changes I needed to go through to see if there is anything that's an issue. A new version should be available later in a few hours.

@mburumaxwell mburumaxwell added the enhancement New feature or request label Nov 7, 2022
@nilekhc
Copy link
Author

nilekhc commented Nov 15, 2022

@mburumaxwell any luck?

@mburumaxwell
Copy link
Contributor

@nilekhc , the release on 7th November has the updated dependabot libraries. Does this fail on your setup?

@mburumaxwell
Copy link
Contributor

@nilekhc , experiments and other updater options can now be specified in an ENV or in the task e.g. goprivate=true,kubernetes_updates=true as per #391.

Does this and the updated base packages (Nov 7) resolve the issue, now?

@nilekhc
Copy link
Author

nilekhc commented Nov 30, 2022

Hi @mburumaxwell,
It work's for Dcokerfile and Kubernetes YAML files. But it's not working for Helm chart values.yaml file.

I am now pulling tingle/dependabot-azure-devops:0.10 in my pipeline and using the config file as follows:

jobs:
  - job:
    steps:
    - task: dependabot@1
      inputs:
        useConfigFile: true

The config file looks like this:

version: 2
updates:
  - package-ecosystem: "docker"
    directory: "/"
    assignees:
      - "dependabot"

Test helm chart has values.yaml file which contains:

image:
  repository: nginx
  pullPolicy: IfNotPresent
  # Overrides the image tag whose default is the chart appVersion.
  tag: "1.17.7"

I am expecting it to create PR for tag with the latest version. Is there anything I am missing here?

@mburumaxwell
Copy link
Contributor

I'm not sure about the functionality specific for Helm vs Docker/Kubernetes. Could it be that a second nesting level is required, similar to the examples in dependabot/dependabot-core#5738

Say

controller:
  image:
    repository: nginx
    pullPolicy: IfNotPresent
    # Overrides the image tag whose default is the chart appVersion.
    tag: "1.17.7"

@nilekhc
Copy link
Author

nilekhc commented Nov 30, 2022

I don't think that's the issue. It's working correctly on the github - https://github.com/Azure/secrets-store-csi-driver-provider-azure/pull/1021/files#diff-466a916b0bbb09a9284539477d45df8196d11009e1ab0a1c90bac23227f8037fL117

And you also said that the extension has picked up the latest bits from dependabot-core which supports this feature right?

@mburumaxwell
Copy link
Contributor

mburumaxwell commented Nov 30, 2022

Latest tag released. The latest bits are still not released/tagged.

@nilekhc
Copy link
Author

nilekhc commented Nov 30, 2022

What do you mean? Sorry I did not follow.

@mburumaxwell
Copy link
Contributor

The updates are managed by the hosted version of dependabot. It has been the case since the beginning.

The logic for reaching to Docker/Kubernetes is the same from this extension's POV except of registration of experiments is required.

Current version is also latest release (0.213.0). I am certain there are improvements that have been made since such as no longer requiring the experiment to be registered. Those would likely have been deployed to the hosted version but haven't been released/tagged hence not available here.

That said, you can toy around with the Gemfile to use a git SHA in place of a tag. build the container image and test out the latest bits of the core logic.

@mburumaxwell
Copy link
Contributor

@nilekhc seems we have a new version 0.214.0 released Nov-30, re: #407
It is likely that much would be resolved in this particular release although dependabot/dependabot-core#6144 appears to not have made it for the release.

If this persists, could you offer a public repo on Azure DevOps to repro?

@nilekhc
Copy link
Author

nilekhc commented Dec 8, 2022

Looks like it correctly picks up the version to upgrade from values.yaml but failing to update the content.

Status: Downloaded newer image for tingle/dependabot-azure-devops:0.11
warning: parser/current is loading parser/ruby31, which recognizes3.1.3-compliant syntax, but you are running 3.1.2.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
/home/dependabot/dependabot-script/vendor/ruby/3.1.0/gems/dependabot-docker-0.214.0/lib/dependabot/docker/file_updater.rb:158:in `updated_yaml_content': Expected content to change! (RuntimeError)
	from /home/dependabot/dependabot-script/vendor/ruby/3.1.0/gems/dependabot-docker-0.214.0/lib/dependabot/docker/file_updater.rb:28:in `block in updated_dependency_files'
	from /home/dependabot/dependabot-script/vendor/ruby/3.1.0/gems/dependabot-docker-0.214.0/lib/dependabot/docker/file_updater.rb:22:in `each'
	from /home/dependabot/dependabot-script/vendor/ruby/3.1.0/gems/dependabot-docker-0.214.0/lib/dependabot/docker/file_updater.rb:22:in `updated_dependency_files'
	from ./update-script.rb:379:in `block in <main>'
	from ./update-script.rb:317:in `each'
	from ./update-script.rb:317:in `<main>'
Using hostname = '<hostname>', protocol = 'https', port = '443'.
Registering exepriment 'kubernetes_updates=true'
Using 'https://<hostname>:443/' as API endpoint
Fetching docker dependency files for RenovateBotTest/DependencyManagement/_git/dependabot-test
Targeting 'default' branch under '/helm-test' directory
Parsing dependencies information
Checking if nginx 1.17.7 needs updating
Requirements to unlock own
Updating nginx from 1.17.7 to 1.23.2

@nilekhc
Copy link
Author

nilekhc commented Dec 8, 2022

@mburumaxwell Looks like Ruby version mismatch. The extension doesn't manage Ruby version, does it?

@mburumaxwell
Copy link
Contributor

Which versions don't match?

@nilekhc
Copy link
Author

nilekhc commented Dec 9, 2022

Ruby version

warning: parser/current is loading parser/ruby31, which recognizes3.1.3-compliant syntax, but you are running 3.1.2

@mburumaxwell
Copy link
Contributor

mburumaxwell commented Dec 11, 2022

This is aligned with the main repo at https://github.com/dependabot/dependabot-core/blob/main/.ruby-version. My attempts at using 3.1.3 didn't work. Further, it's a warning and we've had many of those in the past.

The bigger question is what is making updated_yaml_content fail. Please provide a public ADO repo for reproduction.

@mburumaxwell
Copy link
Contributor

@nilekhc I cloned the https://github.com/Azure/secrets-store-csi-driver-provider-azure reference repo and did some changes to allow me to use this extension and the pipeline seems to have run just fine. Here's the pipeline run:
https://dev.azure.com/tingle/dependabot/_build/results?buildId=53033&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=1f93c1a3-255b-505a-53c9-c382114aabf5

Seems to be producing the same PR as Azure/secrets-store-csi-driver-provider-azure#1021
Am I missing something?

I also run this in an organization using the currently available version and it worked to the point of PR creation:

2022-12-12T16:52:01.3200644Z ##[section]Starting: Dependabot
2022-12-12T16:52:01.3210172Z ==============================================================================
2022-12-12T16:52:01.3210448Z Task         : Dependabot
2022-12-12T16:52:01.3210686Z Description  : Automatically update dependencies and vulnerabilities in your code
2022-12-12T16:52:01.3210904Z Version      : 1.11.314
2022-12-12T16:52:01.3211139Z Author       : Tingle Software
2022-12-12T16:52:01.3211396Z Help         : For help please visit https://github.com/tinglesoftware/dependabot-azure-devops
2022-12-12T16:52:01.3211706Z ==============================================================================
2022-12-12T16:52:01.6427028Z [command]/usr/bin/docker run --rm -i -e DEPENDABOT_PACKAGE_MANAGER=docker -e DEPENDABOT_DIRECTORY=/manifest_staging/charts/csi-secrets-store-provider-azure -e DEPENDABOT_OPEN_PULL_REQUESTS_LIMIT=5 -e DEPENDABOT_FAIL_ON_EXCEPTION=true -e AZURE_ORGANIZATION=*** -e AZURE_PROJECT=*** -e AZURE_REPOSITORY=repro-366 -e AZURE_ACCESS_TOKEN=*** -e AZURE_MERGE_STRATEGY=2 tingle/dependabot-azure-devops:0.11
2022-12-12T16:52:01.7409074Z Unable to find image 'tingle/dependabot-azure-devops:0.11' locally
2022-12-12T16:52:02.7711573Z 0.11: Pulling from tingle/dependabot-azure-devops
2022-12-12T16:53:18.9872017Z Status: Downloaded newer image for tingle/dependabot-azure-devops:0.11
2022-12-12T16:53:20.9769332Z warning: parser/current is loading parser/ruby31, which recognizes3.1.3-compliant syntax, but you are running 3.1.2.
2022-12-12T16:53:20.9770303Z Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
2022-12-12T16:53:25.9749786Z Using hostname = 'dev.azure.com', protocol = 'https', port = '443'.
2022-12-12T16:53:25.9750690Z Using 'https://dev.azure.com:443/' as API endpoint
2022-12-12T16:53:25.9751152Z Fetching docker dependency files for ***/***/_git/repro-366
2022-12-12T16:53:25.9751626Z Targeting 'default' branch under '/manifest_staging/charts/csi-secrets-store-provider-azure' directory
2022-12-12T16:53:25.9751996Z Parsing dependencies information
2022-12-12T16:53:25.9752370Z Checking if oss/azure/secrets-store/provider-azure v1.3.0 needs updating
2022-12-12T16:53:25.9752811Z No update needed for oss/azure/secrets-store/provider-azure v1.3.0
2022-12-12T16:53:25.9753232Z Checking if oss/kubernetes-csi/secrets-store/driver v1.2.3 needs updating
2022-12-12T16:53:25.9753519Z Requirements to unlock own
2022-12-12T16:53:25.9753885Z Updating oss/kubernetes-csi/secrets-store/driver from v1.2.3 to v1.2.4.2
2022-12-12T16:53:25.9754354Z Submitting oss/kubernetes-csi/secrets-store/driver pull request for creation. Done (PR #21934).
2022-12-12T16:53:25.9754836Z Checking if oss/kubernetes-csi/secrets-store/driver-crds v1.2.3 needs updating
2022-12-12T16:53:25.9755129Z Requirements to unlock own
2022-12-12T16:53:25.9755499Z Updating oss/kubernetes-csi/secrets-store/driver-crds from v1.2.3 to v1.2.4
2022-12-12T16:53:25.9755982Z Submitting oss/kubernetes-csi/secrets-store/driver-crds pull request for creation. Done (PR #21935).
2022-12-12T16:53:25.9756276Z Done
2022-12-12T16:53:26.1266256Z ##[section]Finishing: Dependabot

Screenshot 2022-12-12 at 7 59 22 PM

@nilekhc
Copy link
Author

nilekhc commented Dec 14, 2022

@mburumaxwell It appears to be working with this exact values.yaml. I am still unsure what's wrong with the sample chart I created with helm create. I'll dig more.

Nonetheless, thanks for your help.

@nilekhc nilekhc closed this as completed Dec 14, 2022
@nilekhc
Copy link
Author

nilekhc commented Dec 14, 2022

@mburumaxwell fyi, I think I have found the bug - dependabot/dependabot-core#6313

@mburumaxwell
Copy link
Contributor

This having been fixed by dependabot/dependabot-core#6344, the next tagged release of dependabot-core would include the fix, and hopefully soon.

@mburumaxwell
Copy link
Contributor

@nilekhc there's still no new release for dependabot since 0.215.0 but the new bits are now available here. Could you test using the specific input dockerImageTag: 0.14.2-ci.7?

@nilekhc
Copy link
Author

nilekhc commented Feb 9, 2023

@mburumaxwe, I tested this, and works as expected.

@mburumaxwell
Copy link
Contributor

Awesome. Thanks for reporting back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants