Commit Graph

588 Commits

Author SHA1 Message Date
Fabian Lopez 2f241824ff
feat: add flag to push image at the end of a successful build (#681)
* add flag to push image at the end of a successful build

* ensure that push flag is binded to viper

* add unit test to build command

* change build test name

* add registry to build test

* fix e2e test problem

* fix compile error

* add push fail test case

* avoid pusher instanciation in absence of push flag
2021-12-03 07:07:37 -08:00
Matej Vasek addd865452
docs: `podman`: known issue + macOS doc (#698)
* docs: `podman`: known issue + macOS doc

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

* fixup: doc

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

* Update docs/guides/podman.md

Co-authored-by: Lance Ball <lball@redhat.com>

* fixup: style

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

Co-authored-by: Lance Ball <lball@redhat.com>
2021-12-02 08:14:46 -08:00
knative-automation 3f07ca1310
Update community files (#697)
Signed-off-by: Knative Automation <automation@knative.team>
2021-12-02 05:40:45 -08:00
Lance Ball 10f2cf44c7
fix: make registry validation work again (#690)
* fix: make registry validation work again

In ccf00152be
the behavior of `NewFunction()` changed slightly, such that it no longer actually
works without a provided and valid path. This was not caught in any of the
tests, because it's the CLI code that was making this call, and the end to end
tests that exercise the build command, use the `--repository` flag, causing
the repository validation code path to be slightly different.

This commit just adds the path so that `func build` without a `--repository` flag will work again.

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

* fixup: add validation for registry flag and a test

Signed-off-by: Lance Ball <lball@redhat.com>
2021-12-01 18:11:45 -08:00
Lance Ball 91ad41034b
chore: remove release-please from ci (#689)
Since we are moving towards using the Knative tooling for releases, and
because release-please-action will not work in the repository due to knative
branch protection rules, I'm removing this from CI entirely as we work towards
an alternative solution.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-12-01 02:36:57 -08:00
Lance Ball 4b3a5c32df
chore: revert using a fork of boson-project/test-templates (#687)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-29 21:51:08 -08:00
Luke Kingland db9ad07c70
feat: ensure config and repos path exists (#683) 2021-11-29 13:53:08 -08:00
Zbynek Roubalik c7d18c89ed
fix: schema-generate should point to `function.go` (#677)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-11-29 05:36:04 -08:00
Evan Anderson a7f0374c04
Clean up tests: (#679)
- switch reflect.DeepEqual to cmp.Diff for better readability
- some cmp.Diff arguments were reversed(!)
- coverted one test into a table test
- cleaned up some misleading error messages
- preferred testing.Error to testing.Fatal to enable collecting more errors at once
2021-11-28 21:29:03 -08:00
knative-automation 978f3be443
Update actions (#680)
Signed-off-by: Knative Automation <automation@knative.team>
2021-11-28 21:23:03 -08:00
Luke Kingland ccf00152be
feat: function version migrations (#664)
* feat: function version migrations

* unmarshall functin now part of initialization

* regenerate schema

* spelling errors
2021-11-24 04:50:27 -08:00
knative-automation 0eb3fef080
Format go code (#666)
Signed-off-by: Knative Automation <automation@knative.team>
2021-11-23 19:08:26 -08:00
knative-automation 7ec357e1be
Update actions (#588)
Signed-off-by: Knative Automation <automation@knative.team>
2021-11-23 19:07:26 -08:00
Shashank Sharma a0bfc3e3ef
making language runtime a required flag (#647)
* making language as required flag

* create tests fixed

* gofmt

* more tests fixed

* more tests added for invalid runtime and template

* changes removed from client library

Co-authored-by: Luke Kingland <58986931+lkingland@users.noreply.github.com>
2021-11-23 18:43:27 -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
Sameer Vohra 1d0a001c99
Update getting_started_localhost.md (#672)
nit: simplify wording
2021-11-22 03:59:14 -08:00
Matej Vasek ee96bef9ae
fix: use default socket path for TCP connections (#669)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-19 12:16:23 -08:00
Matej Vasek 834e8ae46c
fix: use specific version of paketo builder (#670)
For some reason latest version is not working with node.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-18 14:40:22 -08:00
knative-automation 836d47e54c
Update community files (#665)
Signed-off-by: Knative Automation <automation@knative.team>
2021-11-17 09:15:33 -08:00
Luke Kingland c2e1b769cc
src: direct serialization of Function metadata as func.yaml (#641)
* src: directly serialize Function metadata as func.yaml

Functions now save directly to func.yaml using .Write().
Fixes a serialization error where defaults were not respected on load.
Moves runtime and template defaults into function constructor.
Extracts Function validation (was config validation) into separate functions.
Extracts associated test files (validation) into separate unit test files.
Updates schema generator to use Function

* comment spelling and re-enabling tests
2021-11-17 06:18:35 -08:00
Lance Ball 3935747b91
chore: use buildEnvs instead of custom buildpack (#663)
The TypeScript templates have been using a small buildpack from the boson
project. The sole purpose of the buildpack was to run the `npm run build`
command so that a TypeScript project would be transpiled before deployment.

The Paketo buildpack for Node.js supports using environment variables at
build time to enable additional scripts to be run, such as `build`. Prior
to the addition of `buildEnvs` by @salaboy in
https://github.com/knative-sandbox/kn-plugin-func/pull/646 it was not
possible to set this value for TypeScript projects. That new feature allows
us to stop using the small buildpack from boson.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-16 17:37:33 -08:00
salaboy c70a21e9a4
feat: make SpringBoot template SpringNative by default (#649)
* move springboot template to use springnative

* improving templates to use spring-cloud-deps and ce-type routing

* updating readmes

* removing trailing spaces and adding newline at EOF
2021-11-16 10:31:53 -08:00
Lance Ball 292fc1af09
Revert "feat: add POD_NAME as an environment variable (#660)" (#661)
This reverts commit 64473b7197.
2021-11-15 13:03:55 -08:00
Lance Ball 64473b7197
feat: add POD_NAME as an environment variable (#660)
🎁 This change adds POD_NAME as an environment variable for a deployed
function using the Kubernetes downward API. An alternative means of exposing
this information would be through the filesystem. For example, a file at
`/etc/func/pod_name` would contain the pod's name. I chose to use the env
as the place to surface this because it was easier to implement, and likely
easier to consume for a function developer.

The motivation for this change is that the Node.js and TypeScript invocation
runtime will be exposing telemetry/metrics through Prometheus at a `/metrics`
endpoint (see: https://github.com/boson-project/faas-js-runtime/pull/109).
The OpenTelemetry specification has some experimental labels for function
runtime environments which don't specifically mention pod name (the spec
is not unique to Kubernetes), but do imply the need for a unique identifier
such as this.

Ref: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/faas.md

Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-15 12:08:55 -08:00
salaboy 597195bab8
Initial support for buildEnvs in manifest.yaml (#646)
* initial support for buildEnvs for review

* fix codestyle

* more codestyle

* goimports now working

* adding repo and template level buildEnv checks

* fixing repository test

* updating Envs to []env

* missing Envs

* updating Using

* EOF in yaml file

* go fmt

* go fmt in repository test
2021-11-15 05:35:55 -08:00
Matej Vasek 852626a975
Docker SSH test (#659)
* src: refactor tests

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

* src: add comments

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

* src: fix style

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

* test: add test for ssh docker client

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

* src: refactore rename struct

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

* src: more reliable connection disposal

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

* src: avoid unnecessary wrapping

When using dial-stdio the DialContext is not associated
with an SSH connection so wrapper with clean up is not needed.

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

* src: add doc comment

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-14 17:18:54 -08:00
Matej Vasek 3ae08b01af
Refactor tests (#658)
* src: refactor tests

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

* src: add comments

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

* src: fix style

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2021-11-14 17:15:54 -08:00
Luke Kingland e1fa1ad3c7
chore: test helpers relocation (#653)
* chore: test helpers relocation

The knative automations run test with all tags set simultaneously.  This
causes collisions when using tags to separate sets.  This commit moves
all helper functions in the function_test package into a file with no
build tags such that any combination of tags will work.

* src: move test helpers into their own package

* src: spelling and language tweaks
2021-11-12 05:39:37 -08:00
Luke Kingland 4d29384958
chore: prefer slices over plural types (#655)
* chore: prefer slices over plural types

* chore: update formatting to reflect slice types
2021-11-12 03:36:36 -08:00
Luke Kingland db2c3e246e
ci: remove redundant combined workflow (#650) 2021-11-12 02:45:36 -08:00
Luke Kingland c4168a762d
chore: extract config validate (#656) 2021-11-12 02:09:36 -08:00
Luke Kingland aabc40a1cd
ci: func-local workflow golangci-lint to v1.43.0 (#652) 2021-11-12 01:56:36 -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
Luke Kingland e20ac4c6b7
chore: build tag consistency (#654)
The integration tests and unit tests are currently expected to be
disjunct sets.  While we may change to being additive in the future,
this change makes us consistent by adding the integration exclusion tag
to a few non-integration test files where it was currently missing.
2021-11-11 08:45:38 -08:00
Luke Kingland 1bf17ec976
feat: function creation timestamp (#651) 2021-11-11 08:25:38 -08:00
David Simansky fc1e874a5d
Update Knative dependencies to 0.26 (#642) 2021-11-10 08:47:46 -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
Shashank Sharma dc0f0c1289
MethodNotAllowed for rust cloudevents template (#639) 2021-11-08 11:32:42 -08:00
Lance Ball c810efc7a4
fix: remove stray manifest.yaml files (#628)
Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/626

Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-05 12:07:12 -07:00
Kenjiro Nakayama 5553998b9c
Do not print header when func list does not find any functions (#632)
`func list` prints the header when it gets `No functions found`.
This patch stops displaying the header.

ASIS
```
$ func list
No functions found
NAME  NAMESPACE  RUNTIME  URL  READY
```

The header `NAME  NAMESPACE  RUNTIME  URL  READY` should not be print.

TOBE (by this patch)
```
$ func list
No functions found
```
2021-11-05 09:00:12 -07:00
knative-automation 2cb5d6f1a9
Update community files (#629)
Signed-off-by: Knative Automation <automation@knative.team>
2021-11-04 11:24:01 -07:00
github-actions[bot] f6a4ef21ac
chore: release 0.19.0 (#624)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-11-03 19:49:14 +01:00
Lance Ball 2d6123118f
chore: bump go version to 1.16 in ci build (#625)
Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-03 11:22:47 -07:00
Zbynek Roubalik 0ed1e81692
fix: ConfigMap/Secret key validation (#623)
* fix: ConfigMap/Secret key validation

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>

* add more tests

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-11-03 10:20:48 -07:00
Zbynek Roubalik ac9de9dfc6
fix: Environment values -> Environment variables (#622)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2021-11-03 08:24:49 -07:00
Lance Ball eddd991c1c
Revert "chore: use release-please fork for release branches (#609)" (#621)
This reverts commit b9d6d07b98.
2021-11-03 06:52:47 -07:00
jrangelramos d1b322fe82
test: add e2e test for config volumes (#612) 2021-11-03 05:40:47 -07: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
David Simansky d7dbebb747
Update Knative to 0.25 + cherry-pick E2E refactor (#617)
* ci: split pull_requests workflow

* ci: make binary for e2e tests

* Update Knative to 0.25 release

* Update pkged file

* Update pkged file

* ci: Install Bash 4 to MacOS unit tests

* ci: Fixup java version

Co-authored-by: Luke Kingland <lkingland2038@gmail.com>
2021-11-02 09:38:41 -07:00
Lance Ball 953d4ac9a4
chore: bump go to 1.16 in ci workflow (#618)
The CI workflow is failing because we now depend on at least 1.16.

Signed-off-by: Lance Ball <lball@redhat.com>
2021-11-02 07:35:40 -07:00