dependabot / dependabot/dependabot-core
Dependabot for K8s manifests doesn't work if value for image is put in quotes
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 5.8k
- Forks
- 1.5k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 151
Description
Is there an existing issue for this?
- I have searched the existing issues
Package ecosystem
Docker
Package manager version
No response
Language version
No response
Manifest location and content before the Dependabot update
Kubernetes manifests: any *.yaml or *.yml in the specified directory
dependabot.yml content
version: 2
registries:
my-aws-ecr:
type: docker-registry
url: 123456789.dkr.ecr.us-west-2.amazonaws.com
username: ${{secrets.AWS_ACCESS_KEY_ID}}
password: ${{secrets.AWS_SECRET_ACCESS_KEY}}
updates:
- package-ecosystem: docker
directory: /
registries:
- my-aws-ecr
schedule:
interval: daily
commit-message:
prefix: "chore(docker)"
- package-ecosystem: docker
directory: /my-k8s-manifest
registries:
- my-aws-ecr
schedule:
interval: daily
commit-message:
prefix: "chore(docker)"
Updated dependency
from 123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.6 to 123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.7
What you expected to see, versus what you actually saw
Expected: a Dependabot PR that suggests to update 123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.6 to 123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.7
Actual: No Dependabot PR created if the following is used (value is quoted) : image: "123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.6".
I have verified that when I changed the image value to string without double quotes, e.g image: 123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.6, Dependabot is able to create a PR with the proper suggestion for version update.
I suspect the regex used to extract image's value doesn't take care of quotes: https://github.com/dependabot/dependabot-core/blob/main/docker/lib/dependabot/docker/file_parser.rb#L35C23-L35C84
Native package manager behavior
No response
Images of the diff or a link to the PR, issue, or logs
No response
Smallest manifest that reproduces the issue
apiVersion: apps/v1
kind: Deployment
metadata:
name: cloudlogs-event-relogger
namespace: kube-system
labels:
app: event-relogger
spec:
selector:
matchLabels:
app: event-relogger
template:
metadata:
labels:
app: event-relogger
spec:
topologySpreadConstraints:
- labelSelector:
matchLabels:
app: event-relogger
maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
- labelSelector:
matchLabels:
app: event-relogger
maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
serviceAccountName: "cloudlogs-fluentd-logzio"
containers:
- name: event-relogger
image: "123456789.dkr.ecr.us-west-2.amazonaws.com/hpe-hcss/k8s-event-relogger:v1.2.6"
imagePullPolicy: "Always"
resources:
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 20m
memory: 64Mi
livenessProbe:
exec:
command:
- /usr/src/app/bin/liveness.py
initialDelaySeconds: 120
periodSeconds: 60
terminationGracePeriodSeconds: 30
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 with docker/lib/dependabot/docker/file_parser.rb at the regex referenced in the issue, then reproduce the behavior with the smallest Kubernetes manifest shown. Check the parser's handling of quoted and unquoted image values; done means both forms are recognized so Dependabot can propose the expected image update.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, kubernetes, ruby
- Domain
- devops, infrastructure, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100