Commit Graph

113 Commits

Author SHA1 Message Date
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
Zbynek Roubalik 3d6ef471b7
chore: sync docs with source code (#1261)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>

Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-09-20 11:54: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
Matej Vasek 15e2363ffa
fixup: fix base for another PR (#1237)
PR author is not available for rebase.

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

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-09-13 21:46:47 +00:00
Adam Boczek 4d622bc007
feat: group main help message to put important commands to the top (#1152)
* feat: add initial version of command groups and template engine (#215)

* feat: add relevant dependencies and vendor files (#215)

* feat: extend TestUsageFlags for hidden flags and flags with no shorthand (#215)

* feat: refactor root.go to use command groups (#215)

* feat: move the long help of root cmd to the usage templates section (#215)

* feat: updates after rebase (#215)

* feat: update after review (#215)

* feat: rename 'options' into 'flags' to align with the old help (#215)

* feat: remove support for help options, add template for global flags help section (#215)

* feat: update handling of root command help to support proper use of templates and docs generation (#215)

* feat: generate new docs (#215)
2022-09-13 14:13:48 +00:00
Matej Vasek 17625b7c0d
docs: update podman doc (#1228)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-09-09 09:43:24 +00:00
Matej Vasek a0b772c2cb
docs: update podman docs (#1220)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-09-07 15:20:18 +00:00
Chengzhi Yang fc54831ff0
fixed a misspell in docs (#1217)
# Changes
- bugs: variable `body` was misspelled
2022-09-07 08:39:18 +00:00
Ying Chun Guo d0a181bd24
use correct sample repository name in command usage (#1207) 2022-08-31 11:19:16 +00:00
Lance Ball 34499bceee
doc: update generated docs for 'deploy' (#1203)
Signed-off-by: Lance Ball <lball@redhat.com>

Signed-off-by: Lance Ball <lball@redhat.com>
2022-08-30 20:24:16 +00:00
Matej Vasek 56b1db3500
Improve `func config envs` (#1188)
* Added ability to add env non-interactively
* Added ability to list envs as JSON

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

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-08-30 15:41:17 +00:00
Matej Vasek cd64b70b47
fix: trailing white spaces in genrated docs (#1198)
Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-08-30 13:38:18 +00:00
Ying Chun Guo ac4497da28
fix a broken link in docs (#1196) 2022-08-29 19:14:15 +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
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
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
Ying Chun Guo 0441770267
fix link to reference/command.txt (#1161) 2022-08-11 15:23:59 +00:00
Lance Ball df022f5c93
docs: replace commands.md with generated text file (#1089)
* docs: replace commands.md with generated text file

This commit removes commands.md document which tends to get out of date
pretty easily and replaces it with a generated commands.txt file. The
help text generation is fairly naive, but should be sufficient for the
time being.

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

* fixup: tweak title formatting

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

* fixup: run build-docs.sh again after recent change

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

* fixup: add docs generation to make build target

Also removes the random UUID as the default for `invoke` since it's a
little misleading. That value will not be the one that's used, since
it's random. And because it's random, it changes the docs every time.

Signed-off-by: Lance Ball <lball@redhat.com>
2022-07-25 16:10:24 +00:00
jwcesign dad6047e5b
Update to the latest knative version (#1101)
Signed-off-by: jiang wei <jwcesign@gmail.com>
2022-07-11 08:20:12 +00:00
Josh Gavant 3b9d6c2ee0
doc: add closing mark (#1073)
Without this the following section is unintentionally included in the code quote.
2022-06-20 07:07:16 +00:00
Lance Ball af916e7dd7
doc: fix some func.yaml fields (#1069)
* doc: fix some func.yaml fields

Addresses recent changes in func.yaml processing. Not all fields
for the file are documented. I'm not sure if they all should be.

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

* fixup whitespace

Signed-off-by: Lance Ball <lball@redhat.com>
2022-06-16 17:16:17 +00:00
David Fridrich e1866f1c86
chore: fix link to on_cluster_build.md (#1067)
* fix link to on_cluster_build.yaml

* fix link to on_cluster_build.md
2022-06-16 14:19:18 +00:00
Lance Ball bc6383e55c
fix: update various doc links (#980)
* fix: update various doc links

There were a few links in the documentation that did not get updated in
the most recent docs restructuring. This addresses those issues that I
could find.

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

* fixup: whitespace

Signed-off-by: Lance Ball <lball@redhat.com>
2022-04-20 12:10:29 +00:00
Bryan Tong 23a040d063
Change Knaive (lol) to Knative (#981)
Signed-off-by: Bryan Tong <tongb@vmware.com>
2022-04-20 06:53:29 +00:00
Lance Ball 76c647a1c7
docs: add a language pack "contract" document (#918)
* docs: restructure & add a language pack "contract"

The docs/guides/langugage-packs.md document does a good job of describing
what's required of a language pack in terms of directory structure and the
options for the `manifest.yaml` file. But it does a pretty crappy job of
describing the whole thing in context. I've tried to do that here.

Also some fixes to links and reorganization of the docs to make things a
little easier to find.

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

* fixup: inline language pack referenc into contract

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

* fixup: minor wording tweak

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

* fixup: whitespace

Signed-off-by: Lance Ball <lball@redhat.com>
2022-04-11 13:30:07 +00:00
Lance Ball 4e369a013a
chore: add release process and func_darwin_arm64 to the release artifacts (#945)
* fix: add func_darwin_arm64 to the release artifacts

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

* chore: add ARM64 release target/propose process

I noticed in the most recent release, that a MacOS M1 binary was not
produced. This commit adds that target to `hack/release.sh`. Additionally
the CHANGELOG.md files and version.txt files have been updated to accurately
reflect the current status. Finally, I've proposed a release process in
the new file `docs/RELEASING.md`.

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

* fixup: remove trailing whitespace

Signed-off-by: Lance Ball <lball@redhat.com>
2022-04-07 15:22:46 +00:00
Zbynek Roubalik e9251f518c
feat: on cluster build doens't require privileged cluster permissions (#934)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-04-05 12:52:43 +00:00
Lance Ball 7b001a198a
doc: add documentation for using podman remotely (#907)
* doc: add documentation for using podman remotely

This commit adds more documentation for using podman, specifically in this
case, connecting to and using a remote podman service from a Mac computer.

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

* fixup

Signed-off-by: Lance Ball <lball@redhat.com>
2022-03-16 14:46:47 -07:00
Luke Kingland 9dec4c20ee
differentiate repository and repositories (#900) 2022-03-16 14:01:59 -07:00
Zbynek Roubalik 5de9e193b8
parameter `-P` is not needed in grep in pre-commit hook (#895)
Signed-off-by: Zbynek Roubalik <zroubalik@gmail.com>
2022-03-14 06:33:18 -07:00
Matej Vasek fa17dc9e4b
Update wrt switch from pkger to custom ZIP pkging (#889)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-03-09 17:39:46 -08:00
Matej Vasek ff06ed426a
Update developer documentation. (#888)
* Update developer documentation.

Update documentation for template generation.

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

* Apply suggestions from code review

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

Co-authored-by: Lance Ball <lball@redhat.com>
2022-03-09 12:25:50 -08:00
Helio Frota efc3b208cb
fix: minor typos in docs (#862) 2022-02-23 07:25:39 -08:00
Matej Vasek f25724ad71
Fix podman guide (#836)
Signed-off-by: Matej Vasek <mvasek@redhat.com>
2022-02-17 05:58:12 -08:00
Matej Vasek 7ee4e0fafa
Update guide for podman (#828)
* Update guide for podman

In newer versions of func there is no need
for starting service and setting DOCKER_HOST envvar.

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

* fix per review request

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

Co-authored-by: Lance Ball <lball@redhat.com>
2022-02-11 12:23:18 -08:00
Sameer Vohra c6e67ef037
Update installing_cli.md (#806)
Add reference for kn plugins. Specifically plugins need a `kn-` prefix to be detected by know.
2022-02-02 00:25:33 -08:00
salaboy 61bf5b9da2
Adding git add before commit and push (#781) 2022-01-25 08:27:48 -08:00
Luke Kingland e918f74b9e
feat!: invoke (#705)
* feat!: rename 'emit' to 'invoke' and default to local

This commit renames 'func emit' command to 'func invoke' and makes the
default behavior to send an event to localhost. The special '--sink'
value 'local' is changed to 'cluster' to indicate that the function
should be invoked on the cluster instead of locally. All other behavior
has remained the same.

BREAKING CHANGE

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

* fixup: update commands.md doc

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

* squash: change Emitter interface to Invoker

Changes Emit() to Send() in the (now named) Invoker interface, and changes
Emit() to Invoke() in the client.

BREAKING CHANGE

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

* squash: use a common Invoker interface for HTTP and events

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

* checkpoint

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

* fixup: change Emitter to EventInvoker

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

* Invoke v2 Draft

* feat: client invoke function

* static invoke defaults and methods

* remove assimilated invoker package

* includes an ignored .func directory on create

* Instances manager with local and remote defaults

Funciton Info is now Instance, representing a Function in a given
environment.

Describing a Function instance is now Instances().Get(f, environment)

Moves Runner to be async with a Stop method to enable returning runtime pid
and port for persisting.

Instances now have a place for primary Route in addition to all routes slice

Running Functions write PID and Port to .func

* cascading targets: local vs remote vs ad-hoc endpoint

* runner start signals and cancel cleanup

* return run on context done or err on channel

* async runner

Refactors the image runner to start the container asynchronously,
reporting back the port on which it started.  Errors are communicated
back via a provided channel and stop is signaled using context
cancelation.

* pid neither required nor available

* add withTransport option

Incorporates addition of custom transport of the emitter into the
renamed version invoker. Flag and help text cleanup.  Re-additionof the
Info accessor.

* schema now includes invocation data

* loop build msg

* run jobs

Externally exposed port is now chosen based on availability, with 8080
preferred and falling back to an os-chosen open port.
The Client Run method is now async, returning the port assigned to the
running Function, a stop/cleanup function and a runtime errors channel.
The Runner is internally divided into the runner and its started Jobs.

* job metadata

Extracts job metadata tracking to a Job object in the core,
Handles multiple instances of the same Function by creating a single
file for each instances in .func/instances/<port>

* remove superfluous error types and flag bindings

* feat: enable invoke target remote

* feat: preferentially invoke local, remote if running

* feat: read --file for invoke

* feat: invoke confirm prompts

* fixup cli tests

- Updates to handle asynchronous Runner
- Standardize on the naming convention for selective running

* docker runner tests and lint errors

* test refactor

* feat: invoke format override

* comments, spelling and other cleanup

* invoke command doc

* feat: invoke format interactive option

* rename runjob.go to job.go

* e2e test flag update

* test naming homoginization

* silence build activity messages when verbose

* test debugging

* code review updates

- return Job from Client.Run rather than constituent members
- Treat .gitignore as contentious, punting on feature to mutate if
  extant.
- docs wording changes
- add invocation format to pertinent manifest.yaml files

* help text spelling etc.

Co-authored-by: Lance Ball <lball@redhat.com>
2022-01-21 12:04:05 -08:00
Lance Ball 74158dc63d
fixup: document minimum podman version (#766)
Signed-off-by: Lance Ball <lball@redhat.com>
2022-01-18 11:12:33 -08:00
Zbynek Roubalik f06fd97759
src: simplyfing Knative Deployer RoleBinding (#759)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2022-01-13 08:21:12 -08:00
Zbynek Roubalik 9117940e14
doc: on cluster build documentation (#744)
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
2022-01-12 11:55:51 -08:00
Luke Kingland f63af0d34e
fix: move integration port to unregistered range (#701)
* fix: move registry port to unregistered range

Moves the integration testing port into the unregistered range (above
49151) to minimized potential conflicts.

* update e2e and podman with named registry
2021-12-07 15:05:38 -08:00
Matej Vasek addd865452
docs: `podman`: known issue + macOS doc (#698)
* docs: `podman`: known issue + macOS doc

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

* fixup: doc

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

* Update docs/guides/podman.md

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

* fixup: style

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

Co-authored-by: Lance Ball <lball@redhat.com>
2021-12-02 08:14:46 -08:00
Sameer Vohra 1d0a001c99
Update getting_started_localhost.md (#672)
nit: simplify wording
2021-11-22 03:59:14 -08:00
Luke Kingland c2e1b769cc
src: direct serialization of Function metadata as func.yaml (#641)
* src: directly serialize Function metadata as func.yaml

Functions now save directly to func.yaml using .Write().
Fixes a serialization error where defaults were not respected on load.
Moves runtime and template defaults into function constructor.
Extracts Function validation (was config validation) into separate functions.
Extracts associated test files (validation) into separate unit test files.
Updates schema generator to use Function

* comment spelling and re-enabling tests
2021-11-17 06:18:35 -08:00
Lance Ball e319ea3b62
feat: add support for manifest.yaml at repo/language/template levels (#558)
* feat!: add support for manifest.yaml and runtime.yaml

BREAKING CHANGE
This commit adds the concepts of a manifest.yaml file at the top level
of a template repository, and a runtime.yaml file for each language/runtime
within the repository. Prior to this, repository metadata was primarily
restricted to information that could be gleaned from the file system, such
as the directory name used as the Name.

A manifest.yaml file contains a Name, URL, Version, and a list of supported
runtimes; and if all of the runtimes expose the same health endpoints, these
can be set here.

Within a runtime directory, there may exist a runtime.yaml file which allows
language pack providers to set the health endpoints, overriding the values
set in manifest.yaml, as well as Builders and Buildpacks.

This change removes support for a builders.yaml file in a runtime/template
directory, as this was guaranteed to be redundant with the builders.yaml
file in a sibling template directory. The choice was to move these up a
level to runtime/runtime.yaml.

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

* fixup: bump go version for unit tests

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

* fixup: using go 1.16 now requires 'go mod tidy'
See: https://golang.org/doc/go1.16

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

* fixup: restore support for directory traversal

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

* fixup: whitespace linting

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

* fixup: update func_yaml-schema.json

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

* fixup: spelling errors caught by reviewdog

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

* fixup: use os.ReadDir

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

* squash: restore project creation from remote repos

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

* fixup: remove billyFilesystem

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

* doc: expand on language pack documentation

Adds more detail around how language packs can be provided by third
parties, and the expected structure and metadata required.

Fixes: https://github.com/knative-sandbox/kn-plugin-func/issues/452

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

* doc: update language pack documentation

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

* fixup: cleanup deps

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

* fixup: cleanup deps - again

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

* fixup: reviewdog whitespace cleanup

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

* fixup: custom repo template listing

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

* fixup: bump go version for integration tests

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

* fixup: adjust test-templates repo uri for e2e

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

* fix: don't fail when extended templates don't support a given runtime

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

* src: repo and template type hierarchy

As the client API increases in complexity, upgrading to a more correct
type hierarchy for the object managers serves to keep things clean.  In
this update, the Repository and Templates manager now use constructors
with private members, including a backreference to the root Client
object, which provides the mangers with full access to the current
client instance API for implementing their (growing) features.

* src: template manager writes

The templateWriter struct has now been upgraded to integrate with the
newly-added type system which includes a Templates Manager by adding a
.Write method which writes a template at the given location.  This
encapsulation of the write functionality moves us towards having a
cleaner abstraction atop writing any template to disk from any
repository.

In addition, the "Get" prefix was removed from many accessor methods, as
this is standard a Go idiom.

* src: templates write including denormalize

- merges templateWriter into templates manager
- denormalization of builders, health endpoints etc. made part of .Write
- write logic now works on a Template rather than string paths etc

The templates manager can now write out a template given a function directy.
Included internnaly to write is the denormalization logic, which is now closer
to where it is used, which should improve cohesion and decouple the template
implementation detail from the Client. Also moves the write logic closer to the
template itself, with the expectation the same will happen for functions when
Config and Function are merged.

* src: vendor

* src: merge manifests into domain model

In general, the manifests sytsem is merged more tightly into the overall
system while also expalding it to use a path to templates to avoid
having to create a full filesystem shadow-copy in yaml. Preserves
backwards-compatiblity by keeping the base case a yaml-free repo of only
templates.  Creaets a hierarchical inheritance from repository to
runtime to template for builders, endpoints etc.  whcih allows for the
manifest within templates to be a first-class citizen, though its use
will be rather rare.  Some more in-depth explanations of the more
substantive changes are as follows:

- Merges Manifest with Repository

The Manifest structure is essentially a serialized Repository, so they
are now the same object.

- Converts repo URL to a calculated field

The URL is informative and entirely dependent on the current state of
the repo, so it should be calculated to avoid confusion and avoid being
serialized to the manifest.

- Merge FunctionTemplate with Template

The struct being serialized here is a Template, so they are now the same object

- Extracts new "BuildConfig" embedded struct

The Builders and Buildpacks members are shared between Repository,
Runtime and Template, so they are now an embedded stuct in the same
manner as HealthEndpoints.

- yaml 'inline' declaration for embedded structs

The HealthEndpoints and other embedded structs were not actually being
read from their configs because of a nuance of yaml which (in contrast
to json unmarshallers) requires the `,inline` tag on the struct member
to trigger inclusion in decode.

- Replaces Repository's runtimes member with templates

While it is true that on disk templates are subdivided into their
effective runtime, this is for ease of development.  The logical
structure is: repositories have templates.  Templates are applicabe to
runtimes.  Therefore the correct API is to have templates a direct
member of repository but requiring a runtime filter for access.

- Use repository templates path instead of full list

The goal is to support the use of repositories which contain more than
just templates.  The solution is to define an alternate location for
templates (such as ./templates).  Creating an entire exhaustive manifest
where each runtime and each template is defined with a name and path is
a usurpation of the responsibilities of a filesystem, and causes
unintend negative knock-on effects.  Let's try this simple solution
before jumping to the nuclear option of defining a filesystem-in-yaml.

- Use filesystems when loading repository objects

The fact that a file exists on the disk, embedded, or remote should be
of no concern to most of the code.  This is accomplished by using the
filesystem abstraction which is used during template writing.  This will
be further improved in future versions by upgrading to use the fs.FS
interface and tooling.

- Uses manifest.yaml at all levels

Once the hierarchical nature of the manifest was instituted, it seemed
more intuitive to have the same filename at each level.  This also has
the nice benefit of being backwards-compatible with template-level
manifest.  This is not a correctness issue, but a guess that remembering
a single filename which can exist at different levels in a hierarchy is
easier to remember than different filenames, and its location in the
hierearchy sufficient differentiator making the different filenames
_perhaps_ unencssary.  The constants are left as separate for an easy
revert.

- Moves static defaults into code wherever possible

Wherever yaml was being statically compiled in, it was updated such that
canonical values for static defaults were defined on the Go structure,
with the yaml being for overrides.  For example Default Readiness and
Liveness endpoints.

Some notable benefits of letting the filesystem do it's thing:
* Preserves the ability to create a repository of templates without
  hacking yaml
* Reflects changes directly in IDEs which have native support for
  filesystem, not so for a proprietary manifest.yaml
* the builtin repository has no name, so parsing a manifest from within
  it is both prone to error and confusing, as it could lead future
  developers to submit PRs which change its name.

* fix: revert repository.git to a bare server repo

* src: repository default name

The Repository struct now includes a Name and DefaultName. The former is
the current name of the repository, and corresponds to the path on disk.
The latter is the name specified in the manifest.yaml, and is used as
the default name of the repository when no name is provided.

Fixes an issue where there could be name collisions using a uuid for the
initial name until the manifest is read in.

Restructures the embedded repositories such that one exemplifies a base
case repo with no metadata and only templates, the other specifying a
manifest to exemplify for example a complete language pack.

Adds a test such that all three cases are covered: explicit name, no
name but manifest-defined default name, URI-derived name.

* feat: single repo mode

Enables single repository mode suystem-wide, which fully implements the
logic intended by the WithRepository option.

The default repoisitory is now programatically defined, and while by
default is the embedded repo, it can be overriden using the
WithRepository option.  This keeps the logic internal to the
repositories managet, removeing the need for a crossp-cutting concern in
other parts of the system.

* src: manifest inheritance and existence tests

Respects alternate templates location when defined in a manifest.
Respects manifest embedded structs HealthEndpoints and BuildConfig at
each of the three levels, with inheritance:  Repo, Runtime and Template.
Separates test repositories into the two cases of a templates-only repo
(with no manifest) and a complex repo (with manifests) such as for
language packs.
Leaves the BuildConfig struct as inline but sets the HealthEndpoints as
being named, such that the latter has its fields in the yaml under the
key 'healthEndpoints' but the former does not (passthrough).
Adds error checks when attempting to access named repo when in
single-repo mode.

* src: remove function merge

Removes feature of mergine a func.yaml defined in a template in favor of
sticking with the manifest.yaml until such time as this is requested.
Assuming YAGNI.

* src: repo filesystems

- Embeds repositories with an internal filesystem
- Replaces filesystem disk checkouts with in-memory until final write
- Combines template Write of various types into a single write which uses the
  filesystem of the applicable templates's repository
- Template is now a simple noun, with logic localized to the templates manager
- Adds better error message regarding single repo mode conditions

The reason for replacing filesystem-based repository instances with in-memory
(especially remote for WithRepository mode) is for a few reasons:  First, 'Add'
will fail without using the temporary UUID hack if there already exists a
repository of the _repo_ name (due to a filesystem collision).  We have
to read the repo to determine the default name as well, so it's messy to avoid.
Second, using an on-disk version is potentially leaky because it may leave
files on the system in the event of a process interruption; able to be
mitigated, but with a likewise hacky use of a os temp directory.  Third, it
may cause racing conditions when using multiple instances the Client as a lib.
Lastly, it precludes our ability to run without touching the filesystm: a
useful mode when running as a pure library or in security-restricted
environments.

* fix: paths within embedded fs

* src: repositories code cleanup

* Removes the manual 0_18 version suffix
* Reanames "single" (uri for single-mode) to the more descriptive
  "remote" (with associated accessor api)
* Default repo name when no URI provided is set to default
* Various wording improvements in error text and comments

* src: error formatting

* feat: templates from local file paths

Adds back the local os filesystem as a fallthrough to support loading
template repositories from file:// paths on disk, without the
requirement that they also be git repositories.

* fix: clone once

Fixes the shortcut of performing a clone to read the manifest prior to
cloning the repository to disk.  This double-clone was replaced by a
single clone (applying the manifest) followed by a file copy from the
in-memory FS to the on-disk repository location.

* src: test fixes

* respect explict name on repository .Add
* fail if repository already exists
* update expected test filenames to new general (non-go-specific) setup
* adds the default repo name to the NewRepository constructor,
  internalizing the somewhat tricky default logic.
* move repo write logig to repo itself, as it will contain impl-specific
  nuances.
* invalid repo path is an error, but only if defined
* temporarily disable repository URL test

* src: update templates test to reflect new name 'cloudevents'

* src: fix go templates and repackage

* fixup: reviewdog spelling errors

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

* fixup: reviewdog whitespace cleanup

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

* fixup: run ./hack/update-codegen.sh

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

* fixup: restore boson-project templates for e2e

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

* fixup: do not error if default repo location does not exist

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

* fixup: typo

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

* paketo builder and paket community rust buildpack (#599)

* fixup: apply f161d50084

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

* fixup: update documentation to match impl

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

* fixup: add git attributes to ignore linting on binary files

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

* fixup: remove whitespace

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

* fixup: tweak linter rules

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

* fixup: tweak .gitattributes

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

Co-authored-by: Luke Kingland <lkingland2038@gmail.com>
Co-authored-by: Shashankft9 <48708039+Shashankft9@users.noreply.github.com>
2021-10-27 07:09:01 -07:00
Preetham 9b01368418
docs: documentation for `buildEnv` (#592)
* Doc for func.yaml's buildEnv

* Update docs/guides/func_yaml.md

Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>

Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com>
2021-10-25 05:58:38 -07:00
Lance Ball 68b0904b17
feat!: rename event templates to 'cloudevents' (#584)
* feat!: rename event templates to 'cloudevents'

This commit renames the templates for cloudevents to be named "cloudevents".

BREAKING CHANGE

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

* fixup: update commands.md doc

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

* fixup: fix make test-templates

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

* fixup: missed an e2e test change

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

* fixup: gitignore and pkged.go

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

* fixup: adjust Makefile recipe for pkged.go

Signed-off-by: Lance Ball <lball@redhat.com>
2021-10-13 14:19:42 -07:00
Omer B a167b89d5a
Update installing_cli.md (#539)
closes #441
2021-09-18 09:26:32 -07:00