Commit Graph

211 Commits

Author SHA1 Message Date
Matej Vasek 4e743684e1
Pipeline as Code integration for GitLab (#1769)
* feat: PaC for Gitlab

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

* fixup: different approach to hostname resolution

Resolve '[*.]127.0.0.1.sslip.io' to cluster node IP.

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

* fixup: error handling

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

* fixup: added TODO

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

* fixup: small refactor

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-06-05 19:48:26 +00:00
Luke Kingland d3e33738b9
src: add missing 'omitempty' annotations (#1773) 2023-06-05 18:29:26 +00:00
Luke Kingland 7175a554ff
feat: source-defined buildpacks (#1774)
Allows buildpacks to be updated by updating to a newer version of
func.  Previously, buildpacs were fixed at time of function creation
without a manual edit of func.yaml.  Currently using Go as the reference
implementation in this commit.
2023-06-05 09:49:41 +00:00
Luke Kingland bb599f00f9
fix: PVCSize resets to default (#1771)
Refactors PVCSize to treat the Function member as a custom setting,
and the in-code constant as the default.

- Fixes a bug where the PVCSize would reset to the default on deploy
- Allows the default to be changed by future func version, only pinning
  the value if explicitly requested by the user.
2023-06-05 09:43:41 +00:00
Luke Kingland 4dad8aaf7a
reduce default build platforms (#1765) 2023-05-30 17:04:35 +00:00
Lance Ball dd7c8bdc4e
deps: update tekton to latest versions (#1753)
* deps: update tekton to latest versions

Fixes: https://github.com/knative/func/issues/1716

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

* fixup: rebase

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

* fixup: replace kube-openapi with older version and add shell scripts

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

* fixup: handle deprecations

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

* fixup: revert make check timeout value

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

---------

Signed-off-by: Lance Ball <lball@redhat.com>
2023-05-26 20:04:26 +00:00
Matej Vasek f8e976cb05
Pass image with digest to the deploy task (#1756)
* fix: deploy task explicitly sets --image flag

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

* fix: PaC with `pack` sets image param for deploy task

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

* fixup: unify output of s2i and pack build task

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

* fixup: unify passing of produced image by build tasks

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

* fixup: style

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-05-25 15:18:27 +00:00
Luke Kingland b82a5a4eac
feat: host-based scaffolded function runner (#1733)
* feat: host runner

* improve error message wording
2023-05-24 21:26:25 +00:00
Jefferson Ramos f155c9c7ae
chore: preparing pipelines as code template for midstream customization (#1735) 2023-05-24 20:31:23 +00:00
Luke Kingland bf01e6426a
feat: oci directory pusher (#1702)
* feat: write instanced and static scaffolding

* feat: add oci pusher
2023-05-18 23:19:13 +00:00
Luke Kingland 530ea4fe53
feat: write instanced and static scaffolding (#1732) 2023-05-18 20:03:14 +00:00
Lance Ball f070ea8c00
chore: improve error messages for most commands (#1745)
This commit adds a new error type `UninitializedError` to minimize
redundancy across commands, and applies it in all of the commands which
need an initialized function to operate.

Fixes: https://github.com/knative/func/issues/1744

Signed-off-by: Lance Ball <lball@redhat.com>
2023-05-17 15:52:12 +00:00
Zbynek Roubalik 702da8a665
chore: improve error msg when PAC is not installed (#1742)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-05-17 15:06:12 +00:00
Luke Kingland 9a790f005f
feat: host oci builder (#1730)
* feat: oci builder for host builds

* do not expose host builder until fully baked
2023-05-17 10:53:11 +00:00
Luke Kingland 94c81d4046
fix: .gitignore stamp interference (#1728)
- The .gitignore file was always relative to process' current working
  directory.  Now correctly uses the function root
- The .gitignore file was always being updated, causing its modification
  timestamp to be updated multiple times throughout the executaion of
  any client commands.
- Adds the ability to override this behavior by commenting out the line
  in the .gitignore.
- Adds the ability to request that stamping create an ongoing journal
  via a build log file with timestamp prefix (for debugging)
2023-05-16 19:41:11 +00:00
Matej Vasek ca0c251bb9
fix: use full builder for Rust (#1737)
Some Rust libraries using system libraries need pkg-config installed and
it is not present in the base builder, only in the full one.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-05-10 20:55:01 +00:00
Luke Kingland f58770d997
feat: function signature detection (#1699)
* feat: function signatures and detector

Adds an enumeration of base accepted method signatures, and implements a
detector for go functions.

* fix lint errors

* Capitalize error text

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

* Capitalize error text

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

* Capitalize error text

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

* Capitalize error text

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

* Add error text punctuation

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

---------

Co-authored-by: Lance Ball <lball@redhat.com>
2023-05-10 16:02:02 +00:00
Luke Kingland 89b599df24
feat: job scaffolding (#1697)
* feat: job scaffolding

- Local jobs use a directory rather than filename
  This sets up for upcoming scaffolding to use as a space for job
  scaffolding code.
- Places all jobs within a 'runs' directory in ./func rather than
  'instances' to further differentiate between an instance and a local
  run task invoked via .Run
- Updates Jobs' stop handler to have an error return.
- Adds tests which ensure creating and stopping a job are reflected in
  the client's .Instances().Local() accessor.
- Adds verbose logging support to the Job implementation.
- Adds a cleanup task which will remove orphaned jobs by, in addition to
  previous logic, checking that there is no longer a process listening
  on the port indicated by the job.

* fix spelling errors

* fix lint errors

* log job stop errors

* use temp dir for tests

* add back docker build tags and wait
2023-05-04 20:53:57 +00:00
Luke Kingland 3c371f79f2
feat: func domain route (#1690)
* feat: func domain route

Adds the --domain flag which, when provided sets the value of the
func.domain label on the deployed knative service.  The cluster can then
use this to choose which route to create for multi-route clusters.
Optional.

* fix whitespace
2023-05-04 19:48:57 +00:00
Luke Kingland 1285176f60
feat: write a build stamp log to .func (#1695)
* feat: build stamp and log

- Adds an explicit "Stamp" step to client builds
- Building always "Stamps" the function, allowing builds to cache
- Commands which alter function in inconsequential ways update the stamp
  as-needed.
- Tests updated to use the API rather than hard-coding func.yaml

* fix misspellings

* temporarily disable Quarkus tests

* stamping also creates necessary run directory

* reenable Quarkus tests

* comments
2023-05-03 21:43:56 +00:00
Zuhair AlSader 6558f9652d
add pvc and emptyDir to function_volumes (#1666)
* add pvc and emptyDir to function_volumes

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* add pvc and emptydir to deployer

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* add config functions

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* update tests

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* use random string for emptydir

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* include func yaml schema

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* fix make schema-generate

it needs to be regenrated every time.

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* make function volumes dependency-free

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* add prompt for extension flags

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

* add dependency in func_yaml-schema

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>

---------

Signed-off-by: Zuhair AlSader <zuhair@koor.tech>
2023-05-03 13:57:56 +00:00
Luke Kingland 92d20b07d5
feat: func run support all build options (#1693)
* feat: func run build options and host runs

- Refactors the run command to include all options from build, in the same
  manner as deploy.
- Adds the --container flag (currently defaults to true) which will, when
  disabled, invoke the localhost-based runner which, in this commit, is not
  yet active.
- Updates help text to match the other command format, and lays the verbal
  groundwork for the difference between containerized (currently default)
  and non-containerized runs.

* fix e2e

* Update cmd/deploy.go

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

* Update pkg/functions/client.go

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

* Update cmd/run.go

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

---------

Co-authored-by: Lance Ball <lball@redhat.com>
2023-05-02 12:11:55 +00:00
Matej Vasek f2eb853073
fix: PaC not working with dot git suffixed url (#1713)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-04-28 19:13:51 +00:00
Luke Kingland bcadf234d6
src: Envs type (#1701)
* feat: Envs type

Creates a type for []Env with a String and Slice method for presenting
a set of environment variables in common formats.

* fix: Envs tests
2023-04-28 16:45:51 +00:00
Will Li cd0dbfd300
feat: specify create time for image built with buildpacks (#1685)
* specify the image created time

* add build-timestamp config

* fix trailing white space
2023-04-28 07:14:51 +00:00
Luke Kingland 5dc18a1cd6
extract splitTemplateName from Templates.Get (#1700) 2023-04-25 14:01:45 +00:00
Luke Kingland 55a6e2846f
move template struct to templates.go (#1698) 2023-04-25 14:00:45 +00:00
Luke Kingland 135dba049d
rename Instance to InstanceRefs (#1694)
In order to not conflict with (and be confused with) the actual Instance
struct name which is introduced in the scaffolding func runtimes
middleware, the Instance struct herein is renamed InstanceRefs to more
accurately reflect its usage as a manager of references to instances.
2023-04-25 13:58:45 +00:00
Matej Vasek 506cb71e76
test: extend filesystem tests (#1684)
* refactor: extract functions

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

* test: extend filesystem tests

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-04-24 14:02:43 +00:00
Matej Vasek fd82412701
fix: increase connection timeouts (#1679)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-04-17 01:05:53 +00:00
Lumír 'Frenzy' Balhar 36d7b23b66
Add Python templates for gunicorn and uwsgi + Flask (#1655)
* Add Python templates for gunicorn and uwsgi + Flask

These templates represents the most common and simple ways
how to implement FAAS in Python either directly via gunicorn
or using Flask and uwsgi.

* feat: runtime envvar definition in templates

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

* fixup: use APP_MODULE not app.sh

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

* fixup: update docs

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

* test: better diffing in tests

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

* fixup: update tests

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

* fixup: style

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Matej Vasek <mvasek@redhat.com>
2023-04-10 19:03:48 +00:00
Gunjan Vyas 8f2f290aab
Replace knative.dev/client references to knative.dev/client-pkg (#1671) 2023-04-10 15:59:39 +00:00
Adam Boczek 2502819b61
feat: add pvc-size flag to deploy command (#851) (#1598)
* feat: add pvc-size flag to deploy command (#851)

* feat: move pvc-size from deploy to build func configuration section (#851)

* feat: add setting default value for pvc-size in func.yaml (#851)

* feat: change pvc-size to camel case (#851)

* feat: add omitempty to pvcSize (#851)

* feat: regenerate func yaml schema (#851)

* feat: update docs for deploy command (#851)

* feat: update usage help for the pvc-size flag (#851)
2023-04-05 11:54:39 +00:00
Manoel Marques 1ce5d2b7c3
Replace path with function struct in client api (#1640) 2023-03-31 00:45:00 +00:00
Matej Vasek f877aebdd5
chore: update lifecycle image to v0.16.1 (#1653)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-28 17:35:59 +00:00
Manoel Marques c8f22e735b
Minimal initial func.yaml (#1630) 2023-03-27 06:55:57 +00:00
Matej Vasek 73f8773b7d
style: fix lint error (#1648)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-23 18:43:54 +00:00
Matej Vasek 0645af7a41
fix: pre-compile mock binaries instead of 'go run' (#1645)
The 'go run' does internally compile and it prolongs perceived run-time.
This may lead to timeout in some tests.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-22 18:21:55 +00:00
Zbynek Roubalik 8d4db7546d
feat: PAC - add possibility to specify a Git provider (#1638)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-22 13:30:53 +00:00
Zbynek Roubalik c793fd4c88
feat: PAC - dynamically generate Pipeline target branch (#1636)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-22 13:15:53 +00:00
Matej Vasek 8eeff81580
fix: s2i build on Windows (#1641)
Make all files executable on Windows s2i build.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-21 21:27:52 +00:00
Zbynek Roubalik 3dc61c8979
feat: implement `func config git remove` (#1626)
* feat: implement `func config git remove`

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

* add test

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

---------

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-17 12:09:36 +00:00
Matej Vasek db1b624988
fix: TCP+TLS docker daemon connection (#1629)
* fix: TCP+TLS docker daemon connection

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

* fixup: skip tls verify if DOCKER_TLS_VERIFY is falsy

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-16 16:01:59 +00:00
Zbynek Roubalik b793f8739a
feat: PAC - add support for S2I (#1610)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-10 12:14:23 +00:00
Matej Vasek 7b85fa5f84
fix: node s2i build when node_modules present (#1612)
* fix: node s2i build when node_modules present

This is workaround for two bug in another components:
* The s2i CLI/library is not honoring the `--exclude` flag when used with
  the `--as-dockerfile` flag.
* The node s2i image is not working if project contains `node_modules`
  directory with NodeJS modules.

If only one of the bugs above were fixed this commit wouldn't be
necessary.

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

* fix: project root escape link detection

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

* fix: ignore node_modules for s2i on cluster build

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

* fixup: style

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-10 12:09:24 +00:00
Matej Vasek 9aac5eba68
fix: build stamp computation (#1608)
About the same time that buildStamp was computed .gitignore was modified.
This caused non-deterministic results, because sometimes the
modification was taken into account and sometimed it was not.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-03-08 23:06:20 +00:00
Zbynek Roubalik c552aa2e4e
chore: better output for PaC (#1606)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-08 17:34:22 +00:00
Zbynek Roubalik e3b318adff
feat: Pipelines as Code - initial support (pack) (#1594)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-07 15:41:20 +00:00
Matej Vasek 0a9ed1bc46
refactor: clean up filesystem test (#1584)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-02-27 02:21:32 +00:00
Luke Kingland 91c95a711e
fix: repo add skips root (#1577) 2023-02-21 20:40:27 +00:00
Zbynek Roubalik 726b566f83
fix: deploy annotations & labels correctly (#1574)
* fix: deploy annotations & labels correctly

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

* increase timeout

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

---------

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-21 15:24:26 +00:00
Luke Kingland 03c5df4337
fix: missing map initializations (#1575)
The helper Function constructor which uses a passed function as defaults
was missing map initializations.  This could lead to nil pointer
exceptions as it is used by client.Init.
2023-02-21 10:11:26 +00:00
Luke Kingland 9961c43b35
rm testData (#1576) 2023-02-21 09:15:26 +00:00
David Hadas e6e27d6e66
fix initialization of service.Spec.Template.ObjectMeta.Annotations (#1569)
Signed-off-by: David Hadas <david.hadas@gmail.com>
2023-02-20 18:31:25 +00:00
Matej Vasek 138d1e46c5
fix: ban podman 4.3 for pack build (#1563)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-02-20 17:16:25 +00:00
Matej Vasek 6d4565158b
feat: enabled s2i for python (#1562)
* feat: enable s2i for python

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

* fixup: update zz_filesystem_generated.go

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

* fixup: test

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

* fixup: test

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

* fixup: test

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

* fixup: script

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-02-20 16:45:26 +00:00
Luke Kingland 902eaecd57
global config member accessors (#1559) 2023-02-16 20:07:52 +00:00
Zbynek Roubalik b26a1c29b3
chore: `testData` -> `testdata` (#1560)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-16 11:05:51 +00:00
Lance Ball ab194d421d
feat(templates): remove liveness and readiness from defaults (#1555)
* feat(templates): remove liveness and readiness from defaults

The liveness and readiness URLs are defined in code as defaulting to
`/health/liveness` and `/health/readiness` respectively. The deploy
command handles these defaults without requiring them to exist in the
`func.yaml` file. Existing tests for defaults and overrides already
exist, so this change does not require additional tests to be included.

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

* fixup: remove default endpoints from repository.go

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

---------

Signed-off-by: Lance Ball <lball@redhat.com>
2023-02-16 08:23:51 +00:00
Lance Ball 44bb13f803
feat: adds refspec support for `func repo add` (#1558)
* add option 'branch' to command 'repository add'

* Format go code (#1407)

Signed-off-by: Knative Automation <automation@knative.team>

* chore: refactor repository layout (#1554)

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

* fixup: removes --branch tag from repo commands

Removes the currently in-flight work on the `--branch` tag, simply
supporting a `refspec` on the repository URI. For example,
https://github.com/knative-sandbox/func-tastic#metacontroller will pull
the `func-tastic` repo, and set the currently active HEAD to the
`metacontroller` branch. Adds support for displaying this with the
command `func repo list -v`.

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

* fixup: add example to `func repo add` documentation

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

* fixup: adjust test output expectations

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

---------

Signed-off-by: Knative Automation <automation@knative.team>
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
Signed-off-by: Lance Ball <lball@redhat.com>
Co-authored-by: Yingchun Guo <yingchun.guo@intel.com>
Co-authored-by: knative-automation <automation@knative.team>
Co-authored-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-16 04:05:51 +00:00
Zbynek Roubalik 5a4803bf95
chore: refactor repository layout (#1554)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-15 08:46:52 +00:00