woodpecker-ci / plugin-git

Woodpecker plugin for cloning Git repositories
https://woodpecker-ci.org/docs/usage/workflow-syntax#clone
Apache License 2.0
15 stars 25 forks source link

[Feature] Use custom SSL certificate from the direct value #163

Open lo48576 opened 2 months ago

lo48576 commented 2 months ago

Summary

Add a setting custom-ssl-cert (or similar name such as -body?) to give Git the custom certificate to verify the HTTPS connection.

The setting will be empty (in that case the entry should be ignored), or will contain the whole certificate in plain text. (It may be possible to have base64-encoded string instead of direct plain text to avoid special chars and/or newline character, but I'm not sure it is necessary.)

This will be useful to write "portable" CI workflow definitions. The workflow can be run in multiple (ideally, any) Woodpecker CI services at the different network configuration, served by different admins.

Context

I'd like my CI workflow definitions to be host-agnostic as possible. This is because I'll move my projects around, for example I'll host it simultaneously to Forgejo in my LAN, GitLab, and GitHub, in order to accept contributions and/or to keep the project less locked in. If things that really depend on the CI systems' configuration are needed, it should be configured on the CI system side, not the workflow definition side.

So, I'd like to avoid the things below:

And additionally, HTTP servers in my network are using custom CA certificates (generated by Step CA) so apps should know them to verify SSL connection (possibly from Docker container, which won't know the certificate without the volume mount).

However, currenty custom-ssl-path and custom-ssl-url requires some kind of "host- or network-dependent" setup written in the workflow.

A new property to give CA cert directly, such as custom-ssl-cert, will solve the problem.

In this way, the workflow can truly be "portable" among woodpecker hosts managed by different admins.