From 77bf0be306fc086a107c013e00de6a3dc827865a Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 12 Feb 2021 22:53:02 +0000 Subject: [PATCH] Remove broken examples Signed-off-by: Solomon Hykes --- examples/acme-platform/README.md | 23 --- examples/acme-platform/acme.cue | 38 ---- examples/acme-platform/alpine.cue | 24 --- examples/acme-platform/cue.mod/module.cue | 1 - examples/acme-platform/mynetlify.cue | 63 ------ examples/acme-platform/netlify/netlify.cue | 216 --------------------- examples/acme-platform/scratch.cue | 89 --------- examples/acme-platform/throaway | 3 - examples/olivier/example.cue | 63 ------ examples/olivier/values.cue | 3 - 10 files changed, 523 deletions(-) delete mode 100644 examples/acme-platform/README.md delete mode 100644 examples/acme-platform/acme.cue delete mode 100644 examples/acme-platform/alpine.cue delete mode 100644 examples/acme-platform/cue.mod/module.cue delete mode 100644 examples/acme-platform/mynetlify.cue delete mode 100644 examples/acme-platform/netlify/netlify.cue delete mode 100644 examples/acme-platform/scratch.cue delete mode 100644 examples/acme-platform/throaway delete mode 100644 examples/olivier/example.cue delete mode 100644 examples/olivier/values.cue diff --git a/examples/acme-platform/README.md b/examples/acme-platform/README.md deleted file mode 100644 index 11e9af89..00000000 --- a/examples/acme-platform/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# ACME platform - -Welcome to the acme-platform repository. It contains everything you need to start developing and shipping improvements -to the ACME Clothing Store. - -For information or support, contact the ACME Platform team: platform@acme.infralabs.io - -# Things you can do with ACME platform - - -## Pre-merge or post-merge QA - -## Create a personal dev environment - -## Cross-team integration testing - -## Sales demos - -## End-to-end product reviews - -## Testing infrastructure changes - -## Deploying to production (REQUIRES SPECIAL PRIVILEGES, talk to your SRE) diff --git a/examples/acme-platform/acme.cue b/examples/acme-platform/acme.cue deleted file mode 100644 index 951518e0..00000000 --- a/examples/acme-platform/acme.cue +++ /dev/null @@ -1,38 +0,0 @@ -// ACME platform: everything you need to develop and ship improvements to -// the ACME clothing store. -package acme - -import ( - "dagger.cloud/dagger" - "dagger.cloud/netlify" - "dagger.cloud/aws/ecs" - "dagger.cloud/microstaging" -) - -// Website on netlify -www: netlify & { - domain: string | *defaultDomain - - // By default, use a generated microstaging.io domain - // for easy environments on demand. - let defaultDomain=microstaging.#Domain & { - token: _ - prefix: "www.acme" - } -} - -// API deployed on ECS -api: ecs & { - domain: _ | *defaultDomain - - let defaultDomain = microstaging.#Domain & { - token: _ - prefix: "api.acme" - } -} - -// Database on RDS -db: rds & { - engine: "postgresql" - -} diff --git a/examples/acme-platform/alpine.cue b/examples/acme-platform/alpine.cue deleted file mode 100644 index 83ec7dd4..00000000 --- a/examples/acme-platform/alpine.cue +++ /dev/null @@ -1,24 +0,0 @@ -package alpine - - -#Image: { - - version: string | *"latest" - packages: [...string] - - #dag: { - do: [ - { - // - // - // fetch alpine - }, - { - for _, pkg in packages { - - } - } - - ] - } -} diff --git a/examples/acme-platform/cue.mod/module.cue b/examples/acme-platform/cue.mod/module.cue deleted file mode 100644 index b66f698b..00000000 --- a/examples/acme-platform/cue.mod/module.cue +++ /dev/null @@ -1 +0,0 @@ -module: "acme.infralabs.io/acme" diff --git a/examples/acme-platform/mynetlify.cue b/examples/acme-platform/mynetlify.cue deleted file mode 100644 index 6e48f039..00000000 --- a/examples/acme-platform/mynetlify.cue +++ /dev/null @@ -1,63 +0,0 @@ -package netlify - -import ( - ".../alpine" -) - - - - - -auth: { - #dag: { - encrypted: true - do: [ - { - action: "fetch" - type: "docker" - source: "alpine" - }, - { - action: "push" - } - ] - } - - { - username: string - password: string - } | { - // FIXME: enrypted! - token: string - } -} - -name: string -domain?: string -// FIXME: directory! -source: bl.#Dir - -let base = alpine.#Image & { - version: "foo" - packages: ["rsync", "npm", "openssh"] -} - -// Netlify site ID -id: { - info1: string - info2: string - - #dag: { - // run code to fetch id from netlify API - from: base - do: [ - { - action: "run" - command: ["netlify-get-id", name, "-o", "/netlify-id.json"] - } - ] - export: json: "/netlify-id.json" - } -} - -url: string diff --git a/examples/acme-platform/netlify/netlify.cue b/examples/acme-platform/netlify/netlify.cue deleted file mode 100644 index 93fa86e5..00000000 --- a/examples/acme-platform/netlify/netlify.cue +++ /dev/null @@ -1,216 +0,0 @@ -// Custom netlify package -// ACME platform team -// -// TODO: upstream to dagger standard library. -package netlify - -import ( - "dagger.cloud/dagger" -) - -// Netlify API token -token: { - #dag: { - encrypt: cipher: "..." - } - - string -} - - -// Netlify site name -name?: string - -// Source directory to deploy -source: dagger.#Dir - - -let apply={ - #dag: { - from: alpine.#Base - do: [ - ["run", "npm", "install", "netlify-cli", "-g"], - [ - "copy", - [ - "fetch", "git", "https://github.com/shykes/tests", "netlify-scripts", - ], "/", "/src", - ] - // 2. fetch custom netlify scripts & iunstall - // 3. get ID from name; create if doesn't exist - // 4. deploy (via builder) - ] - command: { - debug: { - from: base - do: ["run", "sh", "-c", """ - env && find /netlify - """] - } - } - } -} -apply - -deployedDir: { - #dag: { - from: apply - export: dir: "/netlify/content" - } -} - -// Netlify site ID -ID: { - string - - #dag: { - from: apply - export: string: "/netlify/site-id" - } -} - -url: { - string - - #dag: { - from: apply - export: string: "/netlify/url" - } -} - - - // Example of short-form cuellb pipeline - // 1. single-op pipeline can omit the array - // 2. action encoded in first key, instead of `action: ` field - // 3. op may implement short-form, - // in this case: `run: [...string]` instead of `run: { command: [...string] }` - do: run: ["ntlfy-get-site-id", name, "-o", "/netlify/site-id"] - // Declarative export from container, instead of awkward `readFile` pseudo-op - export: string: "/netlify/site-id" - } -} - - -// Configuration presets -preset: { - *"html" | "react" | "custom" - - #dag: { - settings: { - markup: select: { - "Static HTML site (no build)": "html" - "ReactJS app built with npm": "react" - "Custom builder": "custom" - } - } - } -} - -// Custom builder -// Default: no build, deploy as-is. -builder: { - in: dagger.#Dir & source - out: dagger.#Dir - - if preset == "html" { - // Pass-through builder that does nothing - out: in - } - if preset == "react" { - let app = reactjs.#App & { - source: in - } - out: app.build - } - - ... -} - - -scripts: { - dagger.#Directory | *latestScripts - - let latestScripts = { - #dag: { - do: { - action: "fetch" - type: "git" - source: "https://github.com/shykes/tests" - ref: "netlify-scripts" - } - } - export: dir: "/" - } - } - - // This is configurable for dev mode, but hide it from end users. - #dag: settings: hidden: true -} - -// Version of the netlify CLI to use -cliVersion: string | *latestCLIVersion - -let latestCLIVersion = { - string - - #dag: { - from: base - do: run: ["sh", "-c", "npm show netlify-cli dist-tags.latest > /latest-cli-version"] - export: string: "/latest-cli-version" - } -} - -// Custom container to run netlify commands + wrappers -let base=alpine.#Base & { - package: { - npm: true - curl: true - } -} - -let runner = { - #dag: { - from: base - do: [ - { - run: "npm", "install - action: "run" - command: ["npm", "install", "-g", "netlify-cli@" + cliVersion] - }, - { - // YOU ARE HERE - // incorporate "netify scripts from personal github" pattern from other POC - } - } -} - -url: { - string - - #dag: { - from: runner - do: run: { - command: #""" - netlify deploy - --dir="$(pwd)" \ - --auth="$(cat /netlify/token)" \ - --site="${NETLIFY_SITE_ID}" \ - --message="Blocklayer 'netlify deploy'" \ - --prod \ - | tee /tmp/stdout - curl \ - -i -X POST \ - -H "Authorization: Bearer $(cat /netlify/token)" \ - "https://api.netlify.com/api/v1/sites/${NETLIFY_SITE_ID}/ssl" - """# - mount: { - "/netlify/token": token - "/netlify/source": builder.out - } - dir: "/netlify/source" - env: { - NETLIFY_SITE_ID: ID - } - } - } -} diff --git a/examples/acme-platform/scratch.cue b/examples/acme-platform/scratch.cue deleted file mode 100644 index 3a1166d2..00000000 --- a/examples/acme-platform/scratch.cue +++ /dev/null @@ -1,89 +0,0 @@ -package netlify - - -#dag: { - do: [ - { - action: "fetch" - type: "container" - repository: "alpine" - tag: "latest" - }, - { - action: "run" - command: "apk add ..." - }, - { - action: "copy" - from: [ - { - action: "fetch" - type: "git" - repo: "https://github.com/shykes/stuff" - } - ] - source: "/" - dest: "/src" - }, - - ] -} - -// Name of the netlify site -name: { - string - - #dag: { - - } -} - -// ID of the netlify site -// FIXME: compute -id: { - string - - #dag: { - from: ... - do: [ - action: "run" - command: ["netlify-get-id", name, "-o", "/netlify-id.txt"] - ] - export: string: "/netlify-id.txt" - } -} - -// API token -// FIXME: encrypt secret! -token: { - #encrypt: { - pubkey: _ - cipher: _ - } - string -} - -// FIXME: how to receive a directory? -source: bl.#Dir - - -// Domain of the Netlify site -domain?: string - -// FIXME: compute -url: { - - #dag: { - do: [ - // ... - { - action: "run" - command: "netlify deploy" - dir: "/src" - mount: "/src": source - } - ] - } - - string -} diff --git a/examples/acme-platform/throaway b/examples/acme-platform/throaway deleted file mode 100644 index b28b04f6..00000000 --- a/examples/acme-platform/throaway +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/examples/olivier/example.cue b/examples/olivier/example.cue deleted file mode 100644 index a7a6aa3a..00000000 --- a/examples/olivier/example.cue +++ /dev/null @@ -1,63 +0,0 @@ -package example - -import ( - "dagger.cloud/alpine" - "dagger.cloud/dagger" -) - -test: { - string - #dagger: compute: [ - dagger.#Load & { from: alpine }, - dagger.#Copy & { - from: [ - dagger.#FetchContainer & { ref: alpine.ref }, - ] - dest: "/src" - // https://github.com/blocklayerhq/dagger/issues/9 - src: "/" - }, - dagger.#Exec & { - dir: "/src" - args: ["sh", "-c", """ - ls -l > /tmp/out - """ - ] - // https://github.com/blocklayerhq/dagger/issues/6 - mount: foo: {} - // mount: dagger.#Mount - }, - dagger.#Export & { - // https://github.com/blocklayerhq/dagger/issues/8 - // source: "/tmp/out" - }, - ] -} - -www: { - // Domain where the site will be deployed (user input) - domain: string - - url: { - string & =~ "https://.*" - - // https://github.com/blocklayerhq/dagger/issues/10 - #dagger2: compute: [ - dagger.#Load & { from: alpine }, - dagger.#Exec & { - args: ["sh", "-c", - """ - echo 'deploying to netlify (not really)' - echo 'https://\(domain)/foo' > /tmp/out - """ - ] - // https://github.com/blocklayerhq/dagger/issues/6 - mount: foo: {} - }, - dagger.#Export & { - // https://github.com/blocklayerhq/dagger/issues/8 - // source: "/tmp/out" - } - ] - } -} diff --git a/examples/olivier/values.cue b/examples/olivier/values.cue deleted file mode 100644 index 69c6ebdc..00000000 --- a/examples/olivier/values.cue +++ /dev/null @@ -1,3 +0,0 @@ -package example - -www: domain: "www.foobar.com"