From 529f63c931cc004fd1aa22270dbba118fae943ec Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Fri, 26 Oct 2018 16:18:47 +0200 Subject: [PATCH] fix(openfaas): builder now works on all platforms And considerably more elegant too! --- garden-service/src/plugins/openfaas/openfaas.ts | 7 +++---- garden-service/static/openfaas/builder/Dockerfile | 6 ------ garden-service/static/openfaas/builder/garden.yml | 14 -------------- .../static/openfaas/templates/garden.yml | 5 +++++ 4 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 garden-service/static/openfaas/builder/Dockerfile delete mode 100644 garden-service/static/openfaas/builder/garden.yml create mode 100644 garden-service/static/openfaas/templates/garden.yml diff --git a/garden-service/src/plugins/openfaas/openfaas.ts b/garden-service/src/plugins/openfaas/openfaas.ts index cfaa903189..b46293ce09 100644 --- a/garden-service/src/plugins/openfaas/openfaas.ts +++ b/garden-service/src/plugins/openfaas/openfaas.ts @@ -107,7 +107,7 @@ export function gardenPlugin({ config }: { config: OpenFaasConfig }): GardenPlug config = validate(config, configSchema, { context: "OpenFaaS provider config" }) return { - modules: [join(STATIC_DIR, "openfaas", "builder")], + modules: [join(STATIC_DIR, "openfaas", "templates")], actions: { async getEnvironmentStatus({ ctx }: GetEnvironmentStatusParams) { const ofGarden = await getOpenFaasGarden(ctx) @@ -155,10 +155,10 @@ export function gardenPlugin({ config }: { config: OpenFaasConfig }): GardenPlug ) moduleConfig.build.dependencies.push({ - name: "builder", + name: "templates", plugin: "openfaas", copy: [{ - source: "templates/template", + source: "template", target: ".", }], }) @@ -187,7 +187,6 @@ export function gardenPlugin({ config }: { config: OpenFaasConfig }): GardenPlug getBuildStatus: getGenericModuleBuildStatus, async build({ ctx, module }: BuildModuleParams) { - // prepare the stack.yml file, before handing off the build to the generic handler await writeStackFile(ctx, module, {}) const buildLog = await faasCli.stdout({ diff --git a/garden-service/static/openfaas/builder/Dockerfile b/garden-service/static/openfaas/builder/Dockerfile deleted file mode 100644 index 912672f496..0000000000 --- a/garden-service/static/openfaas/builder/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM openfaas/faas-cli:0.7.3 - -WORKDIR /build - -RUN apk add docker -RUN faas-cli template pull diff --git a/garden-service/static/openfaas/builder/garden.yml b/garden-service/static/openfaas/builder/garden.yml deleted file mode 100644 index 33724ee6bd..0000000000 --- a/garden-service/static/openfaas/builder/garden.yml +++ /dev/null @@ -1,14 +0,0 @@ -module: - description: Used for pre-fetching templates, before building containers - name: builder - type: generic - build: - command: [ - "rm", "-rf", "templates", - "&&", - "git", "clone", "https://github.com/openfaas/templates.git", - "&&", - "cd templates", - "&&", - "git", "checkout", "85fca87", - ] diff --git a/garden-service/static/openfaas/templates/garden.yml b/garden-service/static/openfaas/templates/garden.yml new file mode 100644 index 0000000000..037da275fb --- /dev/null +++ b/garden-service/static/openfaas/templates/garden.yml @@ -0,0 +1,5 @@ +module: + description: OpenFaaS templates for building functions + name: templates + type: generic + repositoryUrl: https://github.com/openfaas/templates.git#master