Commit Graph

24 Commits

Author SHA1 Message Date
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
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
David Fridrich ec6ee77f5a
Remove progress package (spinner) (#1922)
* spinner print statements out

* structures out, del file

* fix pipelines_integration_test, return url now

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

* remove unnecessary goroutines

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

* remove goroutine completely

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

---------

Signed-off-by: gauron99 <fridrich.david19@gmail.com>
2023-08-16 15:13:42 +00:00
Matej Vasek a270f9e722
Fix pod security context (#1889)
* Revert "src: Use jobs not plain pods for auxiliary tasks (#1857)"

This reverts commit cb6f33d924.

* refactor: move code from openshift

This is needed to avoid circular package dependencies.

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

* fix: set pod SC only on non-OpenShift

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

---------

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2023-07-26 20:03:41 +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
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
Zbynek Roubalik 5a4803bf95
chore: refactor repository layout (#1554)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2023-02-15 08:46:52 +00:00
Luke Kingland 59f4e6a493
fix: mock and noop inconsistency (#1409)
* fix: mock remover missing default impl

* fix: client noop describer should not error

* src: replace generic client factory with test client

* simplify docs generator client
2022-11-07 12:45:22 +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
Matej Vasek 7a88eb48bc
test: test for docker runner (#1331)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-10-13 20:54:53 +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
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
Zbynek Roubalik 50243c740a
feat: `invoke` - allow insecure connections over SSL (#1255)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-09-20 12:25:10 +00:00
Adam Boczek e1e33370d3
fix: add extra request to template cmd to avoid subsequent if repo does not exist (#1206) (#1249) 2022-09-19 12:43:08 +00:00
Zbynek Roubalik 1112aaa2fe
feat: S2I strategy for on cluster build (#1191)
* feat: S2I strategy for on cluster build

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

* use upstream `s2i` task only

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

* use custom func-s2i task

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

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-08-25 13:03:19 +00:00
Zbynek Roubalik b4b4cc34c3
feat: add OpenShift related Annotations & Labels (#1106)
* feat: add OpenShift related Annotations & Labels

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

* fix test

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-07-13 18:19:14 +00:00
Luke Kingland 17dc507c25
feat: pack builder images individually configurable (#1028) 2022-06-03 20:31:52 +00:00
Matej Vasek e9932cdf43
fix: read pwd from non-tty input (#996)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-04-28 12:09:53 +00:00
Luke Kingland 9a0335de7d
src: exported client constructor with options (#883)
* update root and version structure and help text

* fix: limit openshift int test with tag

* refactor: commands to use simplifed, unified constructor

* fix ineffectual assignment lint error

* cleanup

* add repository to run command

* callout for forthcoming s2i builder impl

* lint errors

* re-add the deferred client factory

* remove setNamespaceFlag now that it is persistent

* avoid side-effect of global-mutating deploy tests

* reduce line-by-line difference for PR ease

* simplificaiton of tests and comment lines for further PR ease purposes

* reduce inconsequential differences for ease of PR

* tests to RootCommandConfig

* review comment updates

* fix lint errors

* replace stdlib Setenv in tests

Using t.Setenv will require an update to go1.17, which is out of scope
for this PR.

* pass ClientFactory throughout

* explicitly empty test command args

See https://github.com/spf13/cobra/pull/155

Errors can still be encountered when, for example, using precomiled
tests.  Explicitly setting constructed command args to the empty slice
ensures we avoid hitting any futher edge cases.
2022-03-30 00:58:46 +00:00
Luke Kingland 9dec4c20ee
differentiate repository and repositories (#900) 2022-03-16 14:01:59 -07:00
Luke Kingland 5a122c31e6
src: promote verbosity to constructor arg (#869)
* update root and version structure and help text

* fix: limit openshift int test with tag

* src: verbosity to constructor param

* fix misspelling

* fix merge error
2022-03-04 11:19:36 -08:00
Matej Vasek 4fec4afca1
Custom improvements for OpenShift (#825)
* Custom improvements for OpenShift

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

* fixup: osh cred loader

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

* fixup: style

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

* fixup: dns-err detec for fallback in cluster dial

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-22 10:17:04 -08:00
Matej Vasek 568af71712
src: cmd's common fn.Client (#824)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-09 08:19:41 -08:00