Fixes an issue where the default templates could be pulled
and conflict with TemplateConfigs, meaning the template set in
TemplateConfigs was never pulled.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Swarm support has now been dropped. This change is blocking
changes in upstream components which rely on the SDK
bundled in the CLI.
Updated comparison in tests to work with structs
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
The publish command can be used to build and push a multi-arc image with
Docker buildx and buildkit. A multi-arch template must be used which
a Dockerfile that accepts TARGET/BUILDPLATFORM.
Tested with the golang-middleware template.
The resulting image worked fine on RPi and Docker Desktop.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Pulls the build-args up one level to reduce the verbosity
and complexity of writing stack.yml
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
**What**
- Extend the schema specification to add `CopyExtraPaths` array of
additional relative paths within the project to copy into the functions
handler folder.
- Expand the CopyFiles utility method to support the additional paths
slice
- Ensure that the extra paths copy can not copy folders from outside the
current project. This is the same behavior and nearly the same
implementation as is found in the `docker build`
- To compare with the docker implementation see
bba833928c/builder/remotecontext/detect.go (L182)bba833928c/pkg/containerfs/containerfs.go (L78)
and a09e6e323e/pkg/symlink/fs.go (L49)
- Check that extra paths do not match the entire project folder,
this avoids copying too much into the build scope and is likely a typo
by the user
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
Fixes: #754
* The destination folder for the user's function / handler was
hard-coded to ./function/ or ./ for the Dockerfile template, this
patch allows users to override the value in template.yml
* Set handler_folder to a custom value such as "src"
Tested by updating the node template to use a handler_folder of
src, the build failed, then the Dockerfile was updated to match
the src folder instead of function, this resolved the error
and once deployed, it worked as expected.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Adding functionality which will pull templates defined in the
function YAML file. Also removed the filtering funcitonality
from template pull stack command and renamed the method which
will be used to pull the configuration
Signed-off-by: Martin Dekov <mvdekov@gmail.com>
The openfaas provider was introduced as a default over 8 months
ago, so anyone still using the generic and legacy term "faas"
should update their stack.yml file. Simply replacing "faas" with
"openfaas" is sufficient, all files created over the past
8 months+ should already have this text.
This is the final step of the depreciation of the legacy
provider "faas" and has no bearing on functionality.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Adding template pull stack command which will pull templates
from configuration field in the function yaml or from separate
yaml file with that same field
Signed-off-by: Martin Dekov <mvdekov@gmail.com>
Adding support for namespaces on the following commands:
- delete
- deploy
- describe
- list
- store deploy
- remove
Signed-off-by: Martin Dekov <mvdekov@gmail.com>
A default version is added to the stack file. Tested on
a Linux client by creating a new function to confirm that
a default version is added.
Unit tests were created to validate the version when parsing an
existing stack YAML file.
Signed-off-by: Kevin <kevin_turcios@outlook.com>
This commit adds support for environment variable substitution
using the following library: https://github.com/drone/envsubst
Tested with unit test and on Linux client and an e2e test with
making the language for url-ping in the samples configurable
via an env-var.
Fixes: #606
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
The provider name value of faas is archaic and should be changed
to openfaas. The CLI code already supports this but the generated
values use the text faas still.
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
The YAML schema has an incorrect naming for YAML using camelCase,
this PR updates the naming to "readonly_root_filesystem" which
is more consistent with existing code and YAML naming.
Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
**What**
- Add the ReadOnlyRootFilesystem option to the stack schema
- Pass the value of ReadOnlyRootFilesystem to the create function
request
- Update the vendor lock to bunp the faas version
- Update the vendor lock to include docker-credential-helper because it
was required to build correctly
- Add `readonly` flag to the deploy command
- If the flag is true, it will override the function defintion parsed
from the yaml
- Bump the version on `openfaas/faas`
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
This commit updates `faas-cli new` command to print language specific
welcome message by default. It also has a flag `--quiet` or `-q` to
supress the welcome message.
Fixes: #437
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
Initial work added the build-options into commands/build.go under preRunBuild.
In testing this was found to mean that --lang was having to be added to the
CLI even though it was already specified in the yaml.
This work has refactored the build-options work to move it into the builder package
at which point the language, whether from the CLI or yaml, is known and so negates the
need for the user to 'double supply'.
The basic flow is bring together all desired build-options, determine that they are all
valid for the current language, convert the build-options to a list of packages, deduplicate
the packages, convert to a build-arg of ADDITIONAL_PACKAGES= before appending any build-args
od the same name to the set.
Signed-off-by: rgee0 <richard@technologee.co.uk>
This change adds a `build-option` flag to `faas-cli build`, e.g.
`faas-cli build -f stack.yml --build-option=dev`. If the
function language template has applied `build_options`
specification in its `template.yml` file, i.e.
```
build_options:
- name: dev
packages:
- musl-dev
- gcc
- make
```
then `ADDITIONAL_PACKAGE` agrument will be passed by `build-arg`.
This allows the listed packages to be built by the template's
`Dockerfile` if it is edited to support the feature.
To see an example of how to edit a languge template to addopt the
new feature, please review the python3 template.
Signed-off-by: Ivana Yovcheva (VMware) <iyovcheva@vmware.com>
Currently only faas is allowed as a value for the provider field.
This change allows a value of openfaas which may be needed for
integration with the "Serverless Inc" CLI framework.
Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
mocked local template repository for test
update TEMPLATE.md to reflect that docker is a language
rename stack variable to stackYaml to avoid conflict with imported package
Signed-off-by: Minh-Quan TRAN <account@itscaro.me>
1) Improve readability by adding canExpandTemplateData() function, which
returns an enum telling what to do with the data found in the zip
archive.
2) Add function data to ARMHF directories in template/ dir
3) More descriptive naming for test array in language_template_test.go
and checkLanguage() function changed to templateFolderExists()
Signed-off-by: Eric Stoekl <ems5311@gmail.com>
is not present in language template directory
Needs to add a 'template.yml' to each fake language template dir in
commands/testdata/new_function/template/<lang> in order to have current
tests pass. Deletes some unnecessary .gitignore files as a result.
Signed-off-by: Eric Stoekl <ems5311@gmail.com>
1) Moves code that merges zip file contents into template/ dir into
expandTemplatesFromZip() function. Removes hard-coded constant.
2) Sort list of languages found with 'faas-cli new --list' before
printing
3) Fixes for typos, more descriptive comments, and remove incorrect
license attribution
Signed-off-by: Eric Stoekl <ems5311@gmail.com>
Pull language templates from any repo that has a 'template/' directory
in the root with 'faas-cli template pull <github repo>'.
Also allows 'faas-cli new --lang' to list available languages
Signed-off-by: Eric Stoekl <ems5311@gmail.com>
Signed-off-by: Minh-Quan TRAN <account@itscaro.me>