Commit Graph

126 Commits

Author SHA1 Message Date
Luke Kingland eb17ea77e8
fix: make image digest check more permissive (#2510)
* fix: make image digest check more permissive

* use extant implementation for digest check
2024-09-24 07:14:48 +00:00
David Fridrich a13056e4ee
migrate client-pkg to client/pkg (#2477)
* migrate

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>

* migrate more

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>

* sort imports

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>

---------

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
2024-09-04 10:08:32 +00:00
David Fridrich ca61712d4b
allow digested images to be 'run' (#2445)
* init fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* dont override direct deploy tag, more tests

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* dont validate with tagged image, fix comment

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* init run fix for --image

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* init

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* int test, add valid untdigested images to run

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* check images passed to runner for func run command

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix build/deploy image passing bug add test

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* remove extra printing

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* merge functions to digested

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* misspell

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* simplify

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>

* quick fix

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>

* remove prints, comment

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>

---------

Signed-off-by: gauron99 <fridrich.david19@gmail.com>
Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
2024-08-28 06:13:02 +00:00
David Fridrich bda9487aa8
fix: Allow undigested images to be deployed directly (#2390)
* init fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* dont override direct deploy tag, more tests

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* dont validate with tagged image, fix comment

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* simplify

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* comments

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

---------

Signed-off-by: gauron99 <fridrich.david19@gmail.com>
2024-07-16 14:08:55 +00:00
norbjd d8793d48d9
Clarify registry-insecure flag description (#2348)
Related to #2335
2024-06-11 13:56:01 +00:00
norbjd 056f3ff744
Honor registry-insecure flag in deploy command (#2335) 2024-06-07 00:04:43 +00:00
David Fridrich aa909bdc44
Run func without HOME defined/ unaccessible .config dir (#2236)
* fixed integration tests

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* def creds back

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* docker config.json credentials test when HOME not defined

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* pack test

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* simplify

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* og creds, small fixes

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* s2i test no home

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* remove unnecessary stuff

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* deploy test without home

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* confict fix after rebase

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* move test, dont delete

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* runtime change

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* node image signals fixed and smaller size for GH actions

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* return err

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* cred test

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* clean up comments

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

---------

Signed-off-by: gauron99 <fridrich.david19@gmail.com>
2024-06-04 00:04:52 +00:00
Luke Kingland e6fa020f78
fix: test and namespace isolation (#2187)
* fix: namespace logic cleanup and test isolation

- Pulls logic for defaulting to active namespace (K8S) moved UP to CLI during
  flag default calculation.
- Pushes logic of deciding between f.Namespace vs f.Deploy.Namespace down into
  implementations.
- Updates some tests which needed to have their environment cleared.
- Refactors Pipelines tests to use client API.
- Removes namespaces as a state variable all structures, instead passing as
  an argument.
- Moves FromTempDirectory to testing package for use outside cmd.

* fix spelling errors

* fix: pipelines remover always returned (empty) error

* update tekton namespace handling

* fix: remove deprecated GitLab config: max_concurrency
2024-05-17 08:25:46 +00:00
Luke Kingland 9beea04064
Basic auth (#2242)
* feat: host builder basic auth

* update tests

* mark oci basic auth flags hidden

* cleanup
- Remove debug statements
- Fix test race
- Update licenses

* spelling and linting errors
2024-03-26 09:17:21 +00:00
Dave Protasowski 1d0d7611b2
Introduce a --registry-insecure flag (#2234)
* fix env var casing otherwise flags with hyphens will continue to have hyphens

* Introduce an --registry-insecure flag

* fix build tests

* fix TestList

* fix insecure (http) push
2024-03-16 04:45:20 +00:00
David Fridrich 7e95ca2181
Cleanup orphaned func, new image-name calculation (#1962)
* forced namespace change, deletes old func, kind works

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* new .deploy.image field

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* building

* building

* add first iteration of complete functionality with f.Build.Image and f.Deploy.Image that STILL contains a workaround for image digest which is populated on Push instead of Build

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* base tests fixes for compile

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix base tests2 for now, integration test has a possible TODO

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* new generated schema

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix some tests using .Image and create new test

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* remove nested .func

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* get rid of test

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* remove my debug test

* fix namespace change test

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix pipeline run to use .Deploy.Image

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix TestDeploy_ConfigApplied and change pipelines image being used

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix some tests

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix actions - return value, configApplied and registry on subsequent deploy different

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* update empty image in tests issue

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix client.Apply tests with passing image value to .Deploy after push

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* openshift override on namespace change forced, remove useless print

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* printing fixes, reviewdog, buildConfig return

* fix pipelines test by feeding image name to .Deploy, comments

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* update more tests

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* new test, comment

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* misspell

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* remove unnecessary comments

* fix from review

* namespace updated with 2 fields; new error definitions; deploy functionality cleanup

* remove k8s service host var in test

* error definition; fix client tests; cli delete fixup

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* new schema

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* namespace fixes; remover arguments fix

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* delete_test cmd

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* schema, new local remote flag instead of deploy

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix test to have now required namespace

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* add namespace check, test action

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix integration deploy test, comments

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix wrongly removed namespace

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* small changes to remover and ns added to its tests

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* test moving logic to client

* fix deploy bug, remove verbose for better logs

* pipelines, clean remover

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* newline

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* namespace required in remover, and fixed remote deployer - returns ns

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* fix integ test for pipelines.Run

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* cleanup

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* registry update change on deploy, some prints

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* new deploy tests and mock update

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* new tests, ns determination in mocks

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* deploy digested img doesnt populate build

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* comments

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

* remove todo

Signed-off-by: gauron99 <fridrich.david19@gmail.com>

---------

Signed-off-by: gauron99 <fridrich.david19@gmail.com>
2024-02-27 10:44:20 +00:00
Gunjan Vyas e6c53eb083
func write: write localsettings to .func/local.yaml (#2121) 2024-01-19 08:56:06 +00:00
David Fridrich 5135a9205b
typos (#1936)
Signed-off-by: gauron99 <fridrich.david19@gmail.com>
2023-08-17 19:11:42 +00:00
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