jenkinsci / kubernetes-operator

Kubernetes native Jenkins Operator
https://jenkinsci.github.io/kubernetes-operator
Other
599 stars 236 forks source link

Git Error fetching remote repo 'origin' with seed job agent #830

Closed dashashutosh24 closed 1 year ago

dashashutosh24 commented 1 year ago

I am facing an issue with running seed jobs via jenkins operator. I have configured the git repo and ssh creds where jobs written in dsl are present. The seed agent is also properly spinning up and I can see the ssh key under credentials as well. But still I am facing this issue. I checked the logs as well, but I cannot find anything unusual.

Screenshot 2023-04-30 at 9 31 20 PM
syanpriyajot commented 1 year ago

Seems like you are missing knows_hosts file for ssh. You can manually add known_hosts file or choose one of the strategies under manage Jenkins -> configure global security and pick one of the strategies like ‘Accept first connection’ etc.

dashashutosh24 commented 1 year ago

I have added the proper keys in the form of secrets and configured the same as part of spec.seedJobs for jenkins master. Shouldn’t the operator take care of populating the known hosts file on the seed agent with the mentioned secret? I can see the secret was successfully added as credential in jenkins but operator didn’t add this secret to known hosts file on the seed agent.

brokenpip3 commented 1 year ago

This part of the configuration is done by Jenkins CASC, you can populate the know hosts via the webui and then save that part of the casc as part of the jekins configuration, more specifically:

security:
  [....]
  gitHostKeyVerificationConfiguration:
    sshHostKeyVerificationStrategy:
      manuallyProvidedKeyVerificationStrategy:
        approvedHostKeys: "<HERE>"
  [....]

to configure the casc you can check the chart values: https://github.com/jenkinsci/kubernetes-operator/blob/a690c7cc6c037bb1662ab7ef358ed320880916a7/chart/jenkins-operator/values.yaml#L273-L278 and the link to the operator site as example :)

dashashutosh24 commented 1 year ago

Thanks a lot! This worked. Closing this issue now.