* fix: move registry port to unregistered range
Moves the integration testing port into the unregistered range (above
49151) to minimized potential conflicts.
* update e2e and podman with named registry
* src: in cluster dialer
Added code that will proxy TCP connections via in cluster pod.
This is useful for accessing k8s services that are not exposed.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fixup: increase timeouts
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fixup: decrease test iterations
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* Use official image
Signed-off-by: Matej Vasek <mvasek@redhat.com>
These flags are used by multiple commands, and explicitly setting them for
each command risks errors that may not be easily detected (see the deleted
flag text for `namespace` in deploy.go). The downside to this is that wording
is not sligtly tweaked for the command - see again some of the removed text
for `namespace` that was slightly different for each command, but usefully so.
I'm not 100% convinced this change is needed, since it does reduce the flexibility
of the user facing text. But if it had existed before we wouldn't have had
incorrect text for `deploy`.
Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/221
Signed-off-by: Lance Ball <lball@redhat.com>
* feat: config and repository path creation
Removes need to use a client to trigger creation of paths
Adds back static path accessors
Enables creation of paths when configured repos is outside config
Cleans up instantiation logic, including removal of some setters
* fix spelling mistakes per review
* 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
* 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>
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>
- 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
* 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>
* 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>
* 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
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>
* 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
🎁 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>
* 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
* 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>
* 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
* 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>
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.
`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
```