Remove broken examples
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
parent
e8527ddcf5
commit
77bf0be306
@ -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)
|
@ -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"
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package alpine
|
||||
|
||||
|
||||
#Image: {
|
||||
|
||||
version: string | *"latest"
|
||||
packages: [...string]
|
||||
|
||||
#dag: {
|
||||
do: [
|
||||
{
|
||||
//
|
||||
//
|
||||
// fetch alpine
|
||||
},
|
||||
{
|
||||
for _, pkg in packages {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
module: "acme.infralabs.io/acme"
|
@ -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
|
@ -1,216 +0,0 @@
|
||||
// Custom netlify package
|
||||
// ACME platform team <platform@acme.infralabs.io>
|
||||
//
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
|
||||
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
package example
|
||||
|
||||
www: domain: "www.foobar.com"
|
Reference in New Issue
Block a user