Commit Graph

52 Commits

Author SHA1 Message Date
Lance Ball 5adec03c7b
chore: update all references to kn-plugin-func (#1311)
* chore: update all references to kn-plugin-func

I did not change references in CHANGELOG.md but otherwise, I believe
this should cover all configuration settings, image names, package
names, etc.

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: fix instances_test.go

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: still some stray kn-plugin-func

Signed-off-by: Lance Ball <lball@redhat.com>

Signed-off-by: Lance Ball <lball@redhat.com>
2022-10-13 16:31:53 +00:00
salaboy fe0368a793
[feat] refactoring func.yaml struct to match cmd lifecycle (#1254)
* rebased and updated func struct

* fixing migration to 1.0.0 struct

* fixing on cluster tests

* updaating migration version to 0.34.0

* adding tests for marshalling and migration errors

* adding EOF new line

* updating migrations

* fixing wrong name

* fixing marshalling test

* adding EOF line

* fixing assertion
2022-09-22 20:22:12 +00:00
Matej Vasek b9e3d243bc
fix: pack build outpout on Windows (#1231)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-09-12 04:51:32 +00:00
Luke Kingland e6ec11b0e5
builder short name constants etc throughout (#1180)
* chore: shared builder constants etc

* pretty-print the shared unknown builder error

* update builder impls to use shared defs and validators

* error and docs text formatting

* include static default short names

* comment updates and typos

* docs paths

* use the constants for the in-package builder defaults

* use builders.All but with caviat
2022-08-24 19:34:18 +00:00
Zbynek Roubalik 71b0dddc55
chore: add validation for `builder` (#1136)
* chore: add validation for `builder`

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>

* address feedback

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-07-25 16:09:24 +00:00
Matej Vasek 51b99c0e67
fix: premature Close() of docker client (#1066)
* Fix docker client lifecycle

Avoid premature Close() of docker client.

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Guard for usage of docker client after close

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-06-16 17:14:17 +00:00
Luke Kingland 17dc507c25
feat: pack builder images individually configurable (#1028) 2022-06-03 20:31:52 +00:00
Luke Kingland dc8abf179c
feat: expose default builder image logic for in-cluster builds (#1021)
Tekton pipeline runs now use the same logic for determining default builder image as a local buildpack build.

In order to implement varying build strategies (s2i vs buildpacks), we were unable to rely on hard-coded builder images. These defaults were moved in-code, with builders defined in func.yaml being an optional manual overrdide. This PR updates the Tekton deployment process to rely on this defaulting logic, rather than require the func.yaml override (which would preclude a Function from being able to be built using other strategies).
2022-05-26 23:56:59 +09:00
Lance Ball 31c1d66eb3
chore: use paketo builders for all runtimes (#1001)
All runtimes were actually using paketo builders already, but the
builders were still being explicitly set in manifest.yaml instead of
existing as a default in builder.go like all of the others.

Signed-off-by: Lance Ball <lball@redhat.com>
2022-05-06 01:23:28 +00:00
Luke Kingland 397ce65598
feat: s2i builder quarkus support (#993)
* feat: s2i builder quarkus support

* use manifest for quarkus s2i build envs
2022-04-27 00:40:56 +00:00
Luke Kingland 14248311b1
feat: s2i builder env var interpolation (#991)
* feat: s2i builder env var interpolation

* nil env values disinclude from interpolate map
2022-04-25 19:18:54 +00:00
Lance Ball 5af934be8d
feat: enable Paketo builders for Python functions (#979)
This commit changes the Python functions to use the open source Paketo
builders. The Paketo builders allow the use of a Procfile to indicate
the desired default start process for the container, so this has been
added to invoke Parliament at startup.

Also, there were no README.md files for Python, so I added them too.

Signed-off-by: Lance Ball <lball@redhat.com>
2022-04-20 00:09:28 +00:00
Luke Kingland 3be1a77388
feat: s2i builder typescript support (#957) 2022-04-14 10:48:10 +00:00
Luke Kingland a91bcc5fcf
feat: s2i builder with preliminary node support (#923)
* fix: stuck build ticker

* feat: s2i builder prototype

* default builders

* use s2i fork with updated docker

* in-code builder defaults

* s2i builder verbosity constructor arg

* typed errors

* typed error tests

* remove unneeded env code

* s2i build e2e test

* e2e tests

* update licenses

* cleanup

* codegen debug

* update licenses

* Revert "Update actions (#921)"

This reverts commit 8312b5c560.

* update licenses

* e2e test updates

* use GetDefaultDockerConfig for s2i config

* docker.NewClient docs
2022-04-05 13:08:44 +00:00
Matej Vasek 669329f02f
Improve error handling (#916)
* replaced plain `==` by `error.Is()`
* wrapping some more errors using `fmt.Errorf()`

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-03-22 17:18:17 -07:00
Luke Kingland 5a122c31e6
src: promote verbosity to constructor arg (#869)
* update root and version structure and help text

* fix: limit openshift int test with tag

* src: verbosity to constructor param

* fix misspelling

* fix merge error
2022-03-04 11:19:36 -08:00
Lance Ball 2d37be5536
chore: bump lifecycle version to 0.13.2 (#764)
* chore: bump lifecycle version to 0.13.0

And add docker.io/paketobuildpacks as another trusted builder prefix.

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: bump to 0.13.2

Signed-off-by: Lance Ball <lball@redhat.com>
2022-01-17 14:52:31 -08:00
Lance Ball e4831da4d4
chore: remove dead code (#561)
* chore: remove dead code

The default builders configured in builder.go were not only wrong, but
also not even used anymore. Removing them...

Signed-off-by: Lance Ball <lball@redhat.com>

* fixup: fix failing e2e tests

Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-23 11:29:50 -08:00
Matej Vasek bfdfb760cf
feat: automatically start podman service (#648)
* feat: automatically start podman service

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* src: refactor rename function

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* src: add commnets to tests

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* src: refactor rename function

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-11 09:38:38 -08:00
Shashank Sharma 1bbef7a0e6
Removing workaround to disable selinux label - updated (#645)
* pack 0.22, related refactoring

* blank line removed

* custom docker client added in pack client

* gofmt, golint, goimports
2021-11-09 07:47:43 -08:00
Matej Vasek e1f164d2ca
feat: ssh connection to remote docker daemon (#594)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-02 09:39:41 -07:00
Preetham 114a5faee3
feat: allow developers to provide Build Envs to buildpacks in `func.yaml` (#571)
* Enhance func.yaml to provide build envs to buildpacks

* Add schema file deleted by make clean

* Add function ValidateBuildEnvs to config.go

* Addressed review comments

* Revert makefile changes to pkged.go

* Fixed buildpack env update lost in rebase

* Add support for local env in buildEnvs
2021-10-16 00:54:23 -07:00
Matej Vasek ef7b986900
feat: Improve build performance (#569)
* Update buildpack deps

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Update licences

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Enable trust for paketo buildpack builder

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* Enable trust-builder for newer versions of podman

Signed-off-by: Matej Vasek <mvasek@redhat.com>

* fix style

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-10-11 06:17:16 -07:00
Lance Ball a4b15ad992
feat: move go, typescript and nodejs to paketo builders (#485)
This commit removes the Red Hat builders from the built in templates
for Go, TypeScript and Node.js, replacing them with paketo builders.
For Go, the builder is augmented with a simple buildpack that installs
the Go wrapper code and its dependencies. For TypeScript, the paketo
buildpacks oddly don't support an `npm build` step, so these templates
are also dependent on a small Boson buildpack. These buildpacks are
currently at https://github.com/lance/boson-buildpacks but should find
a home either in the boson-project organization, or the knative-sandbox
organization.

This change also slightly modifies how the Node.js and TypeScript
templates are structured, reducing the coupling between the buildpack
and a function project.

This commit includes the code in https://github.com/knative-sandbox/kn-plugin-func/pull/465
and is dependent on it in the use of manifest.yaml.

Provide sane defaults for health endpoints

Note that this will need to be documented as a requirement for
language packs that do not wish to provide explicit endpoints for
these kube health checks. In that case, the language pack should
specify these both as the root path, with a query parameter. For
example, `/?health=readiness` and `/?health=liveness`, or some other
similar construct.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-24 08:46:24 -07:00
Lance Ball 48f40c35e3
feat: allow language packs to set function metadata (#465)
This commit introduces the concept of a `manifest.yaml` file which
can be added to each template directory to specify things such as health
endpoints, builders and buildpacks for the function.

It problematic that, because we don't yet have the concept
of a global configuration file, the only place to store this metadata is
in a project's `func.yaml` file. There is no reason a function dev
should be exposed to things like health endpoints. This information is
determined by the language pack and integrated by the builder. The only
reason we need it is that it's necessary to determine these endpoints when
deploying. Otherwise, we would have to insist that all language packs
provide endpoints at `/health/readiness` and `/health/liveness`.

This commit also adds support for a `buildpacks` property in `manifest.yaml`
which will be used to set the buildpacks when a function is being built.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-08-22 09:00:34 -07:00
Matej Vasek 0bc2266ac8
chore: use mirror for lifecycle image (#470)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-08-09 09:27:12 -07:00
Markus Thömmes 892558bf2a
Rename module to knative.dev/kn-plugin-func (#423)
Co-authored-by: Lance Ball <lball@redhat.com>
2021-07-15 11:33:32 -07:00
Matej Vasek 771a2307a1
fix: update builders version (#421)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-07-15 11:29:32 -07:00
Matej Vasek 894f4febda
fix: do not trust builder when using podman (#420)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-07-14 15:47:28 -04:00
Matej Vasek 6f40b29d3e
fix: closing stdout
pack client was closing stdout
this commit prevents that

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-06-24 14:30:01 +02:00
Lance Ball bfa5746442
chore: bump to buildpacks v0.8.3 for all versions (#402)
* chore: bump to buildpacks v0.8.2 for all versions

This is causing me to rethink using versions in these templates, and our
overall buildpack version/release strategy. But for now, we should land
this before 0.16.0

* adds trust for any quay.io/boson builder

Signed-off-by: Lance Ball <lball@redhat.com>
2021-06-23 12:44:42 -04:00
Luke Kingland 5ded87368b
src: rename bosonFunc fn 2021-06-22 23:08:11 +09:00
Jim Crossley 4711638495
feat: Rust templates (#376)
* Rust templates for http/event triggers

Each template is a fully-formed actix-web application that includes a
main.rs providing the server configuration and a handler.rs showing an
example function and a few simple unit tests. A README.md provides a
bit more detail to get the user started. The events handler is similar
to the example in the old faas-rust-runtime project.

* With developer guide for Rust
2021-06-18 13:08:50 -04:00
Matej Vasek 6e8517c023
fix: disable selinux labeling
disable selinux labeling

prevents permission denied on docker socket mount

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-06-16 23:54:28 +02:00
Lance Ball d3eafe2a84
feat: add typescript templates (#355)
* feat: add typescript templates

Bumps the faas-js-runtime dependency to 0.7.1 and Node.js buildpack dependency to v0.8.1

fix file globbing on windows

adjust eslint/prettier for windows

improve READMEs

add usage guide

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-26 11:23:42 -04:00
Lance Ball 2b025df199
src!: revert bump to go 1.16 and template changes (#340)
* Revert "src: rename boson import 'fn'"

This reverts commit c0a6f561c0.

* Revert "src: all test dirs set to 0700"

This reverts commit 99f01220c2.

* Revert "src: better error when custom template not found"

This reverts commit 6673395834.

* Revert "src: better errors when custom runtime not found"

This reverts commit a31a6f67a1.

* Revert "build: create separate target for templates.tgz"

This reverts commit 11164bf8d9.

* Revert "src: use consistent separators for fs.FS instances"

This reverts commit 4db07b412f.

* Revert "src: update go event template dependencies"

This reverts commit 3bfc13380f.

* Revert "src: tarfs assumes forward slashes internally"

This reverts commit 6cc0e67b1c.

* Revert "feat: support windows paths in embedded templates FS"

This reverts commit c2b216857b.

* Revert "feat: positive error when runtimme or template unrecognized"

This reverts commit acc56b0900.

* Revert "fix: lint issues"

This reverts commit 895872aee7.

* Revert "ci: go 1.16 compatiblity updates"

This reverts commit 1e3959c045.

* Revert "feat: preserve file modes using in-memory tar FS"

This reverts commit 7dc772ec62.

* Revert "feat: create templates archive on go generate"

This reverts commit 63b7f11471.

* Revert "ci: remove pkger from ci"

This reverts commit 876b0dd0f7.

* Revert "src: remove pkger dependency and tidy"

This reverts commit f006ab1e32.

* Revert "src: remove packaging artifact"

This reverts commit 4d9d0a7b4e.

* Revert "src: remove pkger from make targets"

This reverts commit e44c1ad74c.

* Revert "src: replace pkger with embed.FS"

This reverts commit 38874a4afd.

* Revert "src: update references to deprecated ioutil"

This reverts commit 4025460f73.

* Revert "src: require go 1.16"

This reverts commit 512d4c2580.

* chore: update pkged.go

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-12 14:37:21 -04:00
Luke Kingland c0a6f561c0
src: rename boson import 'fn' 2021-05-07 14:17:14 +09:00
Lance Ball 857b0fd19d
feat: add/improve spinner for build and deploy (#322)
This commit modifies the progress meter so that, by default there is no
step counter. It also modifies the responsibility for calling `Done()`,
making it the job of the command rather than the client. This is because
the client does not know how many commands will be executed and therefore
cannot know when the progress bar is done.

This commit also adds String() to the progress bar, and moves logging
responsibility out of the deployer itself and fully into the client.
Deployer#Deploy() now returns a DeploymentResult.

Fixes: https://github.com/boson-project/func/issues/296

Signed-off-by: Lance Ball <lball@redhat.com>
2021-05-03 14:25:19 -04:00
Lance Ball 08f4fc7bd9
feat: add python templates (#286)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-03-30 17:08:42 -04:00
Matej Vasek 923c788f4a
src: better ctx propagation (#283)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-24 11:05:52 -04:00
Matej Vasek 6d2d8c63b0
feat: using custom docker daemon (e.g podman)
The `func` binary is now aware of DOCKER_HOST environment variable.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-03-02 04:04:01 +01:00
Zbynek Roubalik a5cbe3061b
src: rename from faas to func (#253)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-01-21 17:10:39 +01:00
Kamesh Sampath 557361a374
feat: add spring cloud function runtime and templates (#231)
* feat: add spring cloud function runtime and templates

* docs: review updates

* squash: apply suggestions from code review

Co-authored-by: Lance Ball <lball@redhat.com>
2020-11-25 12:15:48 -05:00
Matej Vasek c2b4a304bd
feat: ability for users to specify custom builders (#147)
* refactor: functionWithOverrides
* feat: custom Buildpacks builder
* fix: namespaces
2020-10-05 10:29:51 -04:00
Lance Ball d6e131f915
feat: set builder images in templates and .faas.yaml (#136)
This commit adds a .builder.yaml file to each template directory. In the file
there is at the moment a single key/value pair, "default: <image>", where the
actual builder image name is <image>. Using a mapping allows the future
possibility that a user may specify a builder image by name via a flag on the
command line. For example,

```console
faas build --builder native
```

When a project is initialized, the .builder.yaml file is read, and the default
builder is saved in the project's .faas.yaml file. The .faas.yaml file is then
consulted when building an image with `faas build`. If the builder image is
specified, then the builder will use it. Otherwise, it will fallback to the
defaults. This allows developers to create custom builders, and specify them
in the configuration file.

After extracting the builder image from .builder.yaml in the project directory,
this file is deleted.

This commit also adds Verbose to the init command.
2020-09-24 11:41:34 -04:00
Luke K ce48083a10
fix: remove references to unused binaries appsody, kn, kubectl 2020-09-04 23:08:03 +09:00
Luke K 4918cc7eef
feat: cli usability enhancements and API simplification 2020-08-29 01:54:13 +09:00
Lance Ball 5b4d97a443
feat: add init/build/deploy commands and customizable namespace (#65)
* feat: add init/build/deploy commands and customizable namespace

This commit comprises some fairly large changes in the codebase.
The 'create' command has been extracted into 'init', 'bulid' and
'deploy' commands. The 'create' command remains, but now delegates
most of its work to these other three. This also has resulted in
some rework of the various flags. 

In addition, it is now possible to specify the cluster namespace to
which the function will be deployed.
2020-08-12 10:52:50 -04:00
Luke K 560a269039
update language references to associated runtime 2020-07-02 13:18:19 +00:00
Luke K f23e81538f
rename language to runtime 2020-07-02 13:06:54 +00:00