This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/universe.dagger.io/examples/changelog.com/highlevel/ci.cue

148 lines
3.2 KiB
CUE
Raw Normal View History

package ci
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/docker"
"universe.dagger.io/examples/changelog.com/highlevel/elixir/mix"
)
dagger.#Plan & {
// Receive things from client
inputs: {
directories: {
// App source code
app: _
}
secrets: {
// Docker ID password
docker: _
}
params: {
// Which Elixir base image to download
runtime_image: docker.#Ref | *"thechangelog/runtime:2021-05-29T10.17.12Z"
// Which test DB image to download
test_db_image: docker.#Ref | *"circleci/postgres:12.6"
}
}
// Do things
actions: {
// Reuse in all mix commands
_appName: "changelog"
prod: assets: docker.#Build & {
steps: [
// 1. Start from dev assets :)
dev.assets,
// 2. Mix magical command
mix.#Run & {
command: {
name: "mix"
args: ["phx.digest"]
}
mix: {
env: "prod"
app: _appName
Make changelog.com highlevel Europa run We fixed a few issues with @shykes & @jlongtine, and @talentedmrjones gave us this great command to run: cd pkg/universe.dagger.io/examples/changelog.com/highlevel dagger up --europa ./gerhard --log debug --log-format plain 7:42PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.9.3 7:42PM DBG system | loading plan args=[ "./gerhard/" ] 7:42PM DBG system | vendoring packages mod=/Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io 7:42PM DBG system | spawning buildkit job attrs=null localdirs={ "/Users/gerhard/github.com/thechangelog/changelog.com/": "/Users/gerhard/github.com/thechangelog/changelog.com" } 7:42PM INF actions.test.db.pull._op | computing 7:42PM INF actions.test.run._exec | computing 7:42PM INF inputs.directories.app | computing 7:42PM INF actions.dev.build._dag."0"._op | computing 7:42PM INF actions.test.build._dag."0"._op | computing 7:42PM ERR actions.test.run._exec | failed: invalid FS at path "actions.test.run._exec.input": FS is not set duration=0s 7:42PM DBG inputs.directories.app | loading local directory path=/Users/gerhard/github.com/thechangelog/changelog.com/ 7:42PM ERR actions.dev.build._dag."0"._op | canceled duration=0s 7:42PM ERR actions.test.db.pull._op | canceled duration=0s 7:42PM ERR actions.test.build._dag."0"._op | canceled duration=0s 7:42PM ERR inputs.directories.app | canceled duration=0s 7:42PM FTL system | failed to up environment: task failed: actions.test.run._exec: invalid FS at path "actions.test.run._exec.input": FS is not set The next step is to figure out why this is failing @jlongtine. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-01-21 20:49:28 +01:00
depsCache: "private"
buildCache: "private"
}
workdir: _
// FIXME: remove copy-pasta
mounts: nodeModules: {
contents: engine.#CacheDir & {
// FIXME: do we need an ID here?
id: "\(mix.app)_assets_node_modules"
// FIXME: does this command need write access to node_modules cache?
Make changelog.com highlevel Europa run We fixed a few issues with @shykes & @jlongtine, and @talentedmrjones gave us this great command to run: cd pkg/universe.dagger.io/examples/changelog.com/highlevel dagger up --europa ./gerhard --log debug --log-format plain 7:42PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.9.3 7:42PM DBG system | loading plan args=[ "./gerhard/" ] 7:42PM DBG system | vendoring packages mod=/Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io 7:42PM DBG system | spawning buildkit job attrs=null localdirs={ "/Users/gerhard/github.com/thechangelog/changelog.com/": "/Users/gerhard/github.com/thechangelog/changelog.com" } 7:42PM INF actions.test.db.pull._op | computing 7:42PM INF actions.test.run._exec | computing 7:42PM INF inputs.directories.app | computing 7:42PM INF actions.dev.build._dag."0"._op | computing 7:42PM INF actions.test.build._dag."0"._op | computing 7:42PM ERR actions.test.run._exec | failed: invalid FS at path "actions.test.run._exec.input": FS is not set duration=0s 7:42PM DBG inputs.directories.app | loading local directory path=/Users/gerhard/github.com/thechangelog/changelog.com/ 7:42PM ERR actions.dev.build._dag."0"._op | canceled duration=0s 7:42PM ERR actions.test.db.pull._op | canceled duration=0s 7:42PM ERR actions.test.build._dag."0"._op | canceled duration=0s 7:42PM ERR inputs.directories.app | canceled duration=0s 7:42PM FTL system | failed to up environment: task failed: actions.test.run._exec: invalid FS at path "actions.test.run._exec.input": FS is not set The next step is to figure out why this is failing @jlongtine. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-01-21 20:49:28 +01:00
concurrency: "private"
}
dest: "\(workdir)/node_modules"
}
},
]
}
dev: {
build: mix.#Build & {
env: "dev"
app: "thechangelog"
base: inputs.params.runtime_image
source: inputs.directories.app.contents
}
assets: docker.#Build & {
steps: [
// 1. Start from dev runtime build
Make changelog.com highlevel Europa run We fixed a few issues with @shykes & @jlongtine, and @talentedmrjones gave us this great command to run: cd pkg/universe.dagger.io/examples/changelog.com/highlevel dagger up --europa ./gerhard --log debug --log-format plain 7:42PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.9.3 7:42PM DBG system | loading plan args=[ "./gerhard/" ] 7:42PM DBG system | vendoring packages mod=/Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io 7:42PM DBG system | spawning buildkit job attrs=null localdirs={ "/Users/gerhard/github.com/thechangelog/changelog.com/": "/Users/gerhard/github.com/thechangelog/changelog.com" } 7:42PM INF actions.test.db.pull._op | computing 7:42PM INF actions.test.run._exec | computing 7:42PM INF inputs.directories.app | computing 7:42PM INF actions.dev.build._dag."0"._op | computing 7:42PM INF actions.test.build._dag."0"._op | computing 7:42PM ERR actions.test.run._exec | failed: invalid FS at path "actions.test.run._exec.input": FS is not set duration=0s 7:42PM DBG inputs.directories.app | loading local directory path=/Users/gerhard/github.com/thechangelog/changelog.com/ 7:42PM ERR actions.dev.build._dag."0"._op | canceled duration=0s 7:42PM ERR actions.test.db.pull._op | canceled duration=0s 7:42PM ERR actions.test.build._dag."0"._op | canceled duration=0s 7:42PM ERR inputs.directories.app | canceled duration=0s 7:42PM FTL system | failed to up environment: task failed: actions.test.run._exec: invalid FS at path "actions.test.run._exec.input": FS is not set The next step is to figure out why this is failing @jlongtine. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-01-21 20:49:28 +01:00
{
output: build.output
},
// 2. Build web assets
mix.#Run & {
mix: {
env: "dev"
app: _appName
Make changelog.com highlevel Europa run We fixed a few issues with @shykes & @jlongtine, and @talentedmrjones gave us this great command to run: cd pkg/universe.dagger.io/examples/changelog.com/highlevel dagger up --europa ./gerhard --log debug --log-format plain 7:42PM DBG system | detected buildkit config haveHostNetwork=true isActive=true version=v0.9.3 7:42PM DBG system | loading plan args=[ "./gerhard/" ] 7:42PM DBG system | vendoring packages mod=/Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io 7:42PM DBG system | spawning buildkit job attrs=null localdirs={ "/Users/gerhard/github.com/thechangelog/changelog.com/": "/Users/gerhard/github.com/thechangelog/changelog.com" } 7:42PM INF actions.test.db.pull._op | computing 7:42PM INF actions.test.run._exec | computing 7:42PM INF inputs.directories.app | computing 7:42PM INF actions.dev.build._dag."0"._op | computing 7:42PM INF actions.test.build._dag."0"._op | computing 7:42PM ERR actions.test.run._exec | failed: invalid FS at path "actions.test.run._exec.input": FS is not set duration=0s 7:42PM DBG inputs.directories.app | loading local directory path=/Users/gerhard/github.com/thechangelog/changelog.com/ 7:42PM ERR actions.dev.build._dag."0"._op | canceled duration=0s 7:42PM ERR actions.test.db.pull._op | canceled duration=0s 7:42PM ERR actions.test.build._dag."0"._op | canceled duration=0s 7:42PM ERR inputs.directories.app | canceled duration=0s 7:42PM FTL system | failed to up environment: task failed: actions.test.run._exec: invalid FS at path "actions.test.run._exec.input": FS is not set The next step is to figure out why this is failing @jlongtine. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
2022-01-21 20:49:28 +01:00
depsCache: "private"
buildCache: "private"
}
// FIXME: move this to a reusable def (yarn package? or private?)
mounts: nodeModules: {
contents: engine.#CacheDir & {
// FIXME: do we need an ID here?
id: "\(mix.app)_assets_node_modules"
// FIXME: will there be multiple writers?
concurrency: "locked"
}
dest: "\(workdir)/node_modules"
}
// FIXME: run 'yarn install' and 'yarn run compile' separately, with different caching?
// FIXME: can we reuse universe.dagger.io/yarn ???? 0:-)
command: {
name: "sh"
flags: "-c": """
yarn install --frozen-lockfile && yarn run compile"
"""
}
workdir: "/app/assets"
},
]
}
}
test: {
build: mix.#Build & {
env: "test"
app: _appName
base: inputs.params.runtime_image
source: inputs.directories.app.contents
}
// Run tests
run: docker.#Run & {
image: build.output
command: {
name: "mix"
args: ["test"]
}
// Don't cache running tests
// Just because we've tested a version before, doesn't mean we don't
// want to test it again.
// FIXME: make this configurable
always: true
}
db: {
// Pull test DB image
pull: docker.#Pull & {
source: inputs.params.test_db_image
}
// Run test DB
// FIXME: kill once no longer needed (when tests are done running)
run: docker.#Run & {
image: pull.output
}
}
}
}
}