* 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
* 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>
* fix: docker registry/repository parsing
Use go-containerregistry to do parsing.
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix: use kebab-case instead of camelCase
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* fix: use kebab-case instead of camelCase
Signed-off-by: Matej Vasek <mvasek@redhat.com>
---------
Signed-off-by: Matej Vasek <mvasek@redhat.com>
* 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
Ensures all tests which apply to both build and deploy commands are
invoked. Test implementations are kept on deploy command, as it is the
primary command and build is a derivitave. Slight logical and
alphabetical reordering.
* 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
Adds two meta-commands, 'Apply' and 'Update', to the client.
Renames 'Create' to 'Init' to avoid confusion with 'Update' (and to be more
linguistically similar to git commands), and adds it as an alias to the
create CLI command.
* effective path
* function context for build builder
* code review suggestions
- fix misspelled 'precedence' throughout
- remove superfluous command execution from test
- remove debug statements
- add FUNC_PATH precedence check with short-flag in effectivePath test
* rebase and update to NewTestClient
* chore: deploy namespace simplification
Separates namespace redeploy warnings from namespace value derivation
logic. Simplifies derivation by integration more closely with flag init
flow.
* cleanup
Updates the mock deployer to have the correct method signature
(match interface it is mocking). Usage is illustrated using a
refactored implementation of mock.NewDeployerWithResult.
* 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>
* 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>
All tests which are directory-sensitive now also:
- reset viper
- use t.Cleanup
- use t.TempDir
- use a clean XDG_CONFIG_HOME
- specify explict name when creating
- moves helpers to root_test
* 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
* feat: deploy autobuild and flag persistence
* cleanup
* help text, comments and test cleanup
* removing usurped commands.txt
* add platform to deploy synopsis help
* 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
* 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
* check namespace; add to func.yaml on first deploy; added tests and mock kubeconfig for testing
* change func args because only f.Namespace is used instead of the whole struct
* func comment
* misspell
* fix tests
* warning in stderr
* use context.Background
* add fake kubeconfig for new test
* --image can be given with digest, created parser and edited some help text to reflect this
* fixed small stuff
* tests for deploy with --image
* move parser to file, static test should be kept active
* updated some error mesgs; now prints a warning if flags not set explicitly, if set to a wrong value, return an error; updated tests to fit new error messages
* --image flag message edit
* removed warning; instead print info about disabled push a build unconditionally
* 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.
* added git related flags for remote builds
* fix dependency issues
* remove context cancel
* add # split for git url
* account for the use of git args with local build type
* fix error message for build type