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

Image Automation not providing error message when git-repo has no write-access #102

Closed
nabadger opened this issue Jan 28, 2021 · 5 comments · Fixed by #115
Closed

Image Automation not providing error message when git-repo has no write-access #102

nabadger opened this issue Jan 28, 2021 · 5 comments · Fixed by #115
Labels
bug Something isn't working

Comments

@nabadger
Copy link

nabadger commented Jan 28, 2021

We use an ssh-deploy key to have flux talk to repos (we use gitlab.com)

When we don't enable write-access on the git-repo for the deploy-key, flux (correctly) fails to write the image updates, but does not provide a nice error message as to why.

We get the following: (this is also output when using flux get image update)

message: 'unknown error: remote: '
apiVersion: v1
items:
- apiVersion: image.toolkit.fluxcd.io/v1alpha1
  kind: ImageUpdateAutomation
  metadata:
    annotations:
    generation: 2
    labels:
      kustomize.toolkit.fluxcd.io/checksum: 0a827fca90af236d1cb0d0e2c757681441c6ccfa
      kustomize.toolkit.fluxcd.io/name: flux-system
      kustomize.toolkit.fluxcd.io/namespace: flux-system
    name: <redacted>
    namespace: flux-system
  spec:
    checkout:
      branch: test-flux2-image-updates
      gitRepositoryRef:
        name:<redacted>
    commit:
      authorEmail: [email protected]
      authorName: fluxcdbot
      messageTemplate: '[ci skip] update image'
    interval: 1m0s
    update:
      setters: {}
  status:
    conditions:
    - lastTransitionTime: "2021-01-28T14:01:47Z"
      message: 'unknown error: remote: '
      reason: ReconciliationFailed
      status: "False"
      type: Ready
    observedGeneration: 2
@stefanprodan stefanprodan added the bug Something isn't working label Jan 29, 2021
@jonaskello
Copy link

I had the same issue in discussion #876 (seems github does not link discussions to issues so just adding that here for reference :-)).

@squaremo
Copy link
Member

The response given by gitlab is:


========================================================================                                 

This deploy key does not have write access to this project.                                              

========================================================================

go-git takes just the first line, which is blank. libgit2 reports the whole text, so you get:

$ flux get image update 
NAME            READY   MESSAGE                                                                                 LAST RUN        SUSPENDED 
my-app-auto     False   remote:                                                                                                 False    
                        remote: ========================================================================                                 
                        remote:                                                                                                          
                        remote: This deploy key does not have write access to this project.                                              
                        remote:                                                                                                          
                        remote: ========================================================================                                 
                        remote:                                                                                                          

Which is much better in that it gets the message across, but upsets the table layout somewhat.

I can make a PR upstream in go-git, but either way I think the least brittle remedy is to anticipate that exact situation when using git operations, and replace it with a message that at least mentions what was being attempted.

@RogerSik
Copy link

RogerSik commented May 31, 2023

Are #115 active? Because having the same issue here with flux v2.0.0-rc.3

Events:
  Type     Reason  Age               From                         Message
  ----     ------  ----              ----                         -------
  Warning  error   2s (x5 over 15s)  image-automation-controller  unknown error: remote:
$ 

@ChrisJBurns
Copy link

ChrisJBurns commented Jun 8, 2023

I have same issue @RogerSik using v0.31.0. What's even weirder is that in other clusters with this version of the iac, the updates are working with no issue. We deploy Flux the same way across all clusters (using the Helm Chart).

@RogerSik
Copy link

@ChrisJBurns fyi because this issue is closed I created a new one #548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants