Commit Graph

113 Commits

Author SHA1 Message Date
Nitish Chauhan f93b23290c
adding service account support (#1812)
* adding service account support

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

* correcting formatting

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>

---------

Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Matej Vasek <mvasek@redhat.com>
2023-06-21 07:44:35 +00:00
Luke Kingland 51cb15b78a
feat: enable host builder via cli (#1748) 2023-06-20 17:33:34 +00:00
Luke Kingland 25ec89d52c
feat: platform build options (#1780)
Plumbs through the platform CLI flag to the individual builders by
creating a client-level BuildOption functional option, and modifying the
builder interface to accept an optional set of requested target
platforms.
2023-06-12 14:04:03 +00:00
Nitish Chauhan 890d440037
added shorthand -R for --remote flag (#1797)
Signed-off-by: ntishchauhan0022 <nitishchauhan0022@gmail.com>
2023-06-09 18:54:59 +00:00
Luke Kingland 9632748f19
src: errors cleanup (#1783) 2023-06-06 20:15:26 +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
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
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
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
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 fd3aca35a3
fix: building resets image digest (#1691)
Fixes a bug where the image digest was being cleared on a subsequent
deploy, resulting in incorrect metadata and a build stamp which was
always out-of-date (effectively disabling cached builds).
2023-04-25 13:59:46 +00:00
Luke Kingland 3ac1ef9229
docs: standardize env flag help suffix (#1689)
* remove 'Env:' prefix from command help text environment variables

* regen docs
2023-04-25 13:56:45 +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
Zbynek Roubalik ed1d963c85
feat: PaC support flags (#1604)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-13 20:44:56 +00:00
Zbynek Roubalik 616feb15b1
chore: move prompts to a separate package (#1592)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-03-06 15:08:33 +00:00
Luke Kingland aa582dad21
cli help text updates and flags cleanup (#1564)
* cli help text and flags cleanup

- verbose flag uses global setting throughout
- confirm flag added using shared visitor throughout
- path flag added using shared visitor throughout
- removes --version flag on root as redundant with subcommand
- splits main help's 'Main Commands' into 'Primary Commands' and 'Development
  Commands' groups
- Moves RunE definition into flag struct literals

* remove commented code
2023-03-01 09:35:54 +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
Jefferson Ramos 8e62148538
fix: func deploy with explicity `--build=false` bypass isBuilt check (#1539) 2023-02-09 16:24:48 +00:00
Luke Kingland 958429c2f3
feat: deploy command global config with function context (#1434)
* feat: deploy command global config function context

* fix static check errors

* fix test

* fix remote persists test

* env opaque box test

* use keyed fields (govet)

* mock deployer expansion

* ClearEnvs now in shared testing pkg

* effectivePath now uses plfags

* list directly uses config for default namespace

* Improved Namespace calculation and Caching

- Built() now a client package function
- Namespace evaluation delegeate to implementations
  This enables the func.yaml to avert dirtiness checks on rebuilds
  (caching)
- Build and Deploy update build stamp on completion
  Enables dirtiness checks to be unaffects, leading to better caching.
- CLI Namespace checks no longer require k8s env evaluation for default
- Fixed missing condition check in TestDeploy_Namespace
- Fixes some minor linter and spelling errors
- Global config does not directly set namespace - it is corrected to be
  deferred evaluation used by implementations.
- Skips writing func.yaml on f.Write if there were no modifications,
  which leads to better caching (no timestamp update means Built ==
  true)
- HasImage removed in favor of a corrected fn.Built

* linting, misspellings and docs rebuild

* warn user if git settings exist on a non-remote build

* lint error fix

* test flag unsetting persists

* allow unknown flags in preparsing of flags

* pre-submit cleanup

* update cmd to use client.Init
2023-02-06 08:43:35 +00:00
Adam Boczek 2f021f118b
chore: refactor commands help to use templates (#1485)
* chore: extend help template engine and docs generator to get root use

* chore: refactor deploy cmd

* chore: refactor build cmd

* chore: refactor all relevant commands and remove defaultTemplatedHelp func

* chore: update docs

* chore: remove unused functions

* chore: add template func for rendering sub-templates

* chore: fix for typos
2023-01-16 20:40:53 +00:00
Gunjan Vyas 3f49718bc6
feat: Persist remote value in func.yaml (#1402)
* feat: persist remote value in func.yaml

* Added unit test for remote flag persistence

* Formatting fix

* addressed comments
2022-11-14 21:01:37 +00:00
Luke Kingland 52cf033348
src: cleanup build prompts (#1413) 2022-11-10 20:05:16 +00:00
Luke Kingland 5b032bed66
fix: interrupt suppression (#1418)
* remove interrupt error suppression

* Update cmd/func/main.go

Co-authored-by: Matej Vasek <matejvasek@gmail.com>

Co-authored-by: Matej Vasek <matejvasek@gmail.com>
2022-11-10 09:48:15 +00:00
Luke Kingland 218fa9d8c3
rename config local variable cfg (#1412) 2022-11-08 14:35:21 +00:00
knative-automation 5d67de768b
Format go code (#1407)
Signed-off-by: Knative Automation <automation@knative.team>

Signed-off-by: Knative Automation <automation@knative.team>
2022-11-04 11:11:04 +00:00
Luke Kingland 2edb25998a
chore: deploy cmd namespace (#1390)
* chore: deploy namespace simplification

Separates namespace redeploy warnings from namespace value derivation
logic.  Simplifies derivation by integration more closely with flag init
flow.

* cleanup
2022-10-31 19:48:15 +00:00
Luke Kingland 796e02984d
feat: registry globally configurable (#1392)
Deferred evaluation of cluster type is preserved by making registry a
helper in cmd and a calculated field of the global config struct.
2022-10-31 18:59:12 +00:00
Luke Kingland 0fa9359750
feat: namespace globally configurable (#1352)
* namespace global config

* integrate namespace config into commands

* comment updates

* combine config write tests

* updates per code review

* regen docs
2022-10-31 18:07:12 +00:00
Luke Kingland b1873083cb
feat: builder globally configurable (#1391) 2022-10-31 17:17:12 +00:00
Matej Vasek ecc0916ef4
feat: defer OpenShift detection (#1375)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-10-24 03:40:16 +00:00
Luke Kingland 034e2de849
chore: global config file paths (#1344)
* feat: config members and paths

- Adds Builder, Namespace, Registry and Verbose as globally
  configurable.
- Fixes problems where file paths were being created or required when
  not necessary.
- Relocates environment variable usage to main's use of config
- Adds FUNC_CONFIG_PATH
- Only creates paths on disk when necessary
- Makes non-existent config paths nonfatal

* postpone adding some members
2022-10-21 10:38:13 +00:00
Luke Kingland 4a051d15fe
chore: update deploy help text (#1351) 2022-10-18 03:09:10 +00:00
Matej Vasek d536b799f2
On cluster build without VCS (#1298)
* refactor: attach() and podReady() more general

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

* feat: added function for upload to a volume

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

* refactor: extract defaultSecurityContext

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

* fix: added runtime type check

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

* feat: allow on-cluster-build without VCS

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

* fix: reword error message

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

* fix: runtime type check

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

* test: e2e test for direct upload on-cluster-build

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

Signed-off-by: Matej Vasek <mvasek@redhat.com>
Co-authored-by: Lance Ball <lball@redhat.com>
2022-10-17 19:52:11 +00:00
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
Gunjan Vyas 06ade524de
feat: interactive prompt for on-cluster deploy (#1300)
* feat: interactive prompt for on-cluster deploy

* changed the prompt type to survey.Confirm
2022-10-06 18:31:32 +00:00
Luke Kingland 4c8f730099
feat: readonly global config (#1260)
* improved deploy test output

* remove unused config struct

* feat: read-only global config

Co-authored-by: Lance Ball <lball@redhat.com>
2022-09-23 17:49:13 +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
Luke Kingland 4b2bdc9b8a
fix: incorrect deploy namespace warnings (#1257) 2022-09-20 02:34:09 +00:00
Luke Kingland 15713b2a75
feat!: deploy autobuild and flag persistence (#1079)
* feat: deploy autobuild and flag persistence

* cleanup

* help text, comments and test cleanup

* removing usurped commands.txt

* add platform to deploy synopsis help
2022-09-14 11:45:10 +00:00
Luke Kingland 4e5e9927b2
fix: only use flag value as default or if altered (#1223) 2022-09-07 20:47:18 +00:00
Luke Kingland ae75e5e803
fix: image name derivation and flag precidence (#1185)
* fix: image name derivation and flag precidence

* cleanup

* fix image prompt, reorganize and cleanup

* client deploy image test

* be explicit about registry treatment in tests

* ineffassign

* fix: k8s env not required

* misspell

* minor cleanup

* recombine build and deploy configs

* test namesace choosing logic
2022-09-04 19:37:21 +00:00
Matej Vasek 6a0b4a2211
fix: flags more consistent between build/deploy (#1202)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-08-30 19:16:18 +00:00
Lance Ball 81289dc757
doc: use cobra markdown generator for command docs (#1169)
This commit removes the docs/reference/commands.txt file and instead
uses the Cobra built-in documentation generator to create markdown
documents for every command.

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

Signed-off-by: Lance Ball <lball@redhat.com>
2022-08-25 13:16:19 +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
Luke Kingland fecbc4ef8b
chore: use dot as path default rather than absolute path (#1184)
* use '.' in flags to indicate default function path

* regen commands.txt with '.' as default path

* centralize dot expansion

* minor cleanup

* update all references to path flag

* exits should be panics
2022-08-24 11:02:18 +00:00
David Fridrich e659256005
chore: use lower case *functions* in all CLI outputs (#1135)
* first run, F -> f

* fix

* fix

* misspells

* client*.go files

* add client*.go: misspells

* cmd dir test files

* docker dir

* function* files

* i*.go and job.go

* job.go,mock dir,repos*,s2i dir,schema dir,templates*

* test dir

* testing dir

* root dir *.go second round
2022-07-27 13:34:36 +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