mirror of https://github.com/knative/func.git
Add guideline for private Go module usage (#2771)
Signed-off-by: Matej Vašek <mvasek@redhat.com>
This commit is contained in:
parent
a2469fe9da
commit
e720bbcc8c
File diff suppressed because it is too large
Load Diff
|
@ -19,5 +19,42 @@ curl -v -X POST -d '{"message": "hello"}' \
|
||||||
http://localhost:8080/
|
http://localhost:8080/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Import Private Go Modules
|
||||||
|
If you want to use a module that is in a private `git` repository,
|
||||||
|
you can do it by mounting credentials and by setting appropriate environment variable.
|
||||||
|
|
||||||
|
This is done by setting the `build.volumes` and `build.buildEnvs` properties in the `func.yaml` config file.
|
||||||
|
|
||||||
|
#### pack
|
||||||
|
For the `pack` builder have to use [paketo bindings](https://github.com/paketo-buildpacks/git?tab=readme-ov-file#bindings):
|
||||||
|
```yaml
|
||||||
|
# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
|
||||||
|
specVersion: 0.36.0
|
||||||
|
name: go-fn
|
||||||
|
runtime: go
|
||||||
|
created: 2025-03-17T02:02:34.196208671+01:00
|
||||||
|
build:
|
||||||
|
buildEnvs:
|
||||||
|
- name: SERVICE_BINDING_ROOT
|
||||||
|
value: /bindings
|
||||||
|
volumes:
|
||||||
|
- hostPath: /tmp/git-binding
|
||||||
|
path: /bindings/git-binding
|
||||||
|
```
|
||||||
|
|
||||||
|
#### s2i
|
||||||
|
For the `s2i` builder you have to mount credentials in `.netrc` format.
|
||||||
|
```yaml
|
||||||
|
# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
|
||||||
|
specVersion: 0.36.0
|
||||||
|
name: go-fn
|
||||||
|
runtime: go
|
||||||
|
created: 2025-03-17T02:02:34.196208671+01:00
|
||||||
|
build:
|
||||||
|
volumes:
|
||||||
|
- hostPath: /home/jdoe/.netrc
|
||||||
|
path: /opt/app-root/src/.netrc
|
||||||
|
```
|
||||||
|
|
||||||
For more, see [the complete documentation]('https://github.com/knative/func/tree/main/docs')
|
For more, see [the complete documentation]('https://github.com/knative/func/tree/main/docs')
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,43 @@ library, and it can be invoked from your browser or from the command line:
|
||||||
curl http://myfunction.example.com/
|
curl http://myfunction.example.com/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Import Private Go Modules
|
||||||
|
If you want to use a module that is in a private `git` repository,
|
||||||
|
you can do it by mounting credentials and by setting appropriate environment variable.
|
||||||
|
|
||||||
|
This is done by setting the `build.volumes` and `build.buildEnvs` properties in the `func.yaml` config file.
|
||||||
|
|
||||||
|
#### pack
|
||||||
|
For the `pack` builder have to use [paketo bindings](https://github.com/paketo-buildpacks/git?tab=readme-ov-file#bindings):
|
||||||
|
```yaml
|
||||||
|
# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
|
||||||
|
specVersion: 0.36.0
|
||||||
|
name: go-fn
|
||||||
|
runtime: go
|
||||||
|
created: 2025-03-17T02:02:34.196208671+01:00
|
||||||
|
build:
|
||||||
|
buildEnvs:
|
||||||
|
- name: SERVICE_BINDING_ROOT
|
||||||
|
value: /bindings
|
||||||
|
volumes:
|
||||||
|
- hostPath: /tmp/git-binding
|
||||||
|
path: /bindings/git-binding
|
||||||
|
```
|
||||||
|
|
||||||
|
#### s2i
|
||||||
|
For the `s2i` builder you have to mount credentials in `.netrc` format.
|
||||||
|
```yaml
|
||||||
|
# $schema: https://raw.githubusercontent.com/knative/func/refs/heads/main/schema/func_yaml-schema.json
|
||||||
|
specVersion: 0.36.0
|
||||||
|
name: go-fn
|
||||||
|
runtime: go
|
||||||
|
created: 2025-03-17T02:02:34.196208671+01:00
|
||||||
|
build:
|
||||||
|
volumes:
|
||||||
|
- hostPath: /home/jdoe/.netrc
|
||||||
|
path: /opt/app-root/src/.netrc
|
||||||
|
```
|
||||||
|
|
||||||
For more, see [the complete documentation]('https://github.com/knative/func/tree/main/docs')
|
For more, see [the complete documentation]('https://github.com/knative/func/tree/main/docs')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue