fluxcd / image-automation-controller

GitOps Toolkit controller that patches container image tags in Git
https://fluxcd.io
Apache License 2.0
171 stars 70 forks source link

cannot fetch remote branch: EOF #422

Closed PierreBart closed 2 years ago

PierreBart commented 2 years ago

Describe the bug

After upgrading Flux from v2.29.5 to v0.32.0, the Image Automation controller throws the following error:

{"error":"cannot fetch remote branch: EOF", "level":"error", "logger":"controller.imageupdateautomation", "msg":"Reconciler error", "name":"staging-image-update", "namespace":"flux2", "reconciler group":"image.toolkit.fluxcd.io", "reconciler kind":"ImageUpdateAutomation", "ts":"2022-08-24T12:42:28.576Z"}

This ImageUpdateAutomation object is deployed on the cluster:

apiVersion: image.toolkit.fluxcd.io/v1beta1
kind: ImageUpdateAutomation
metadata:
  name: staging-image-update
  namespace: flux2
spec:
  git:
    checkout:
      ref:
        branch: master
    commit:
 [...]
    push:
      branch: master
  interval: 1m0s
  sourceRef:
    kind: GitRepository
    name: flux2
  update:
    path: ./apps/staging
    strategy: Setters

I am facing the same issue in v0.31.5 but not in v0.30.2.

Expected behavior

The Image Automation controller throws no error.

Kubernetes version

GKE 1.23.8

Git provider

Gitlab private repository.

Additional context

In Slack, @pjbgf noticed I use the same branch for pushing and pulling the sources in the ImageUpdateAutomation definition. He recommended I remove the push.branch field from the spec and that did fix the error.

pjbgf commented 2 years ago

Thank you @PierreBart for reporting the issue.

I suggest we fix this by ignoring the push branch when:

For reference, that logic resides at: https://github.com/fluxcd/image-automation-controller/blob/65e004f1e885037c6a621cf7f55e46cf8a4eb3fd/controllers/imageupdateautomation_controller.go#L240