Merge pull request #1401 from aluzzardi/europa-module

Re-organize modules for Europa
This commit is contained in:
Andrea Luzzardi 2022-01-11 17:04:45 -08:00 committed by GitHub
commit 0925ba588c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
87 changed files with 224 additions and 1047 deletions

View File

@ -19,8 +19,6 @@
- [dagger/op](./dagger/op.md) - op: low-level operations for Dagger processing pipelines
- [docker](./docker/README.md) - Docker container operations
- [docker/compose](./docker/compose.md) - Docker-compose operations
- [europa/dagger](./europa/dagger/README.md) - -
- [europa/dagger/engine](./europa/dagger/engine.md) - -
- [gcp](./gcp/README.md) - Google Cloud Platform
- [gcp/cloudrun](./gcp/cloudrun.md) - -
- [gcp/gcr](./gcp/gcr.md) - Google Container Registry

View File

@ -1,81 +0,0 @@
---
sidebar_label: dagger
---
# alpha.dagger.io/europa/dagger
```cue
import "alpha.dagger.io/europa/dagger"
```
## dagger.#DAG
A special kind of program which `dagger` can execute.
### dagger.#DAG Inputs
_No input._
### dagger.#DAG Outputs
_No output._
## dagger.#FS
A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS.
### dagger.#FS Inputs
_No input._
### dagger.#FS Outputs
_No output._
## dagger.#Plan
A deployment plan executed by `dagger up`
### dagger.#Plan Inputs
_No input._
### dagger.#Plan Outputs
_No output._
## dagger.#Secret
A reference to an external secret, for example: - A password - A SSH private key - An API token Secrets are never merged in the Cue tree. They can only be used by a special filesystem mount designed to minimize leak risk.
### dagger.#Secret Inputs
_No input._
### dagger.#Secret Outputs
_No output._
## dagger.#Service
A reference to a network service endpoint, for example: - A TCP or UDP port - A unix socket - An HTTPS endpoint
### dagger.#Service Inputs
_No input._
### dagger.#Service Outputs
_No output._
## dagger.#Subdir
Select a subdirectory from a filesystem tree
### dagger.#Subdir Inputs
_No input._
### dagger.#Subdir Outputs
_No output._

View File

@ -1,293 +0,0 @@
---
sidebar_label: engine
---
# alpha.dagger.io/europa/dagger/engine
```cue
import "alpha.dagger.io/europa/dagger/engine"
```
## engine.#Build
Build a container image using buildkit
### engine.#Build Inputs
_No input._
### engine.#Build Outputs
_No output._
## engine.#CacheDir
A (best effort) persistent cache dir
### engine.#CacheDir Inputs
_No input._
### engine.#CacheDir Outputs
_No output._
## engine.#Copy
Copy files from one FS tree to another
### engine.#Copy Inputs
_No input._
### engine.#Copy Outputs
_No output._
## engine.#CopyInfo
### engine.#CopyInfo Inputs
_No input._
### engine.#CopyInfo Outputs
_No output._
## engine.#DAG
A special kind of program which `dagger` can execute.
### engine.#DAG Inputs
_No input._
### engine.#DAG Outputs
_No output._
## engine.#Exec
Execute a command in a container
### engine.#Exec Inputs
_No input._
### engine.#Exec Outputs
_No output._
## engine.#FS
A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS.
### engine.#FS Inputs
_No input._
### engine.#FS Outputs
_No output._
## engine.#GitPull
Pull a directory from a git remote Warning: do NOT embed credentials in the remote url as this will expose them in logs. By using username and password Dagger will handle this for you in a secure manner.
### engine.#GitPull Inputs
_No input._
### engine.#GitPull Outputs
_No output._
## engine.#GitPush
Push a directory to a git remote
### engine.#GitPush Inputs
_No input._
### engine.#GitPush Outputs
_No output._
## engine.#HTTPFetch
Fetch a file over HTTP
### engine.#HTTPFetch Inputs
_No input._
### engine.#HTTPFetch Outputs
_No output._
## engine.#ImageConfig
Container image config. See [OCI](https://www.opencontainers.org/). Spec left open on purpose to account for additional fields. [Image Spec](https://github.com/opencontainers/image-spec/blob/main/specs-go/v1/config.go) [Docker Superset](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/dockerfile2llb/image.go)
### engine.#ImageConfig Inputs
_No input._
### engine.#ImageConfig Outputs
_No output._
## engine.#Merge
Merge multiple FS trees into one
### engine.#Merge Inputs
_No input._
### engine.#Merge Outputs
_No output._
## engine.#Mkdir
Create one or multiple directory in a container
### engine.#Mkdir Inputs
_No input._
### engine.#Mkdir Outputs
_No output._
## engine.#Mount
A transient filesystem mount.
### engine.#Mount Inputs
_No input._
### engine.#Mount Outputs
_No output._
## engine.#NewSecret
Create a new a secret from a filesystem tree
### engine.#NewSecret Inputs
_No input._
### engine.#NewSecret Outputs
_No output._
## engine.#Plan
A deployment plan executed by `dagger up`
### engine.#Plan Inputs
_No input._
### engine.#Plan Outputs
_No output._
## engine.#Pull
Download a container image from a remote repository
### engine.#Pull Inputs
_No input._
### engine.#Pull Outputs
_No output._
## engine.#Push
Upload a container image to a remote repository
### engine.#Push Inputs
_No input._
### engine.#Push Outputs
_No output._
## engine.#ReadFile
### engine.#ReadFile Inputs
_No input._
### engine.#ReadFile Outputs
_No output._
## engine.#Scratch
Produce an empty directory
### engine.#Scratch Inputs
_No input._
### engine.#Scratch Outputs
_No output._
## engine.#Secret
A reference to an external secret, for example: - A password - A SSH private key - An API token Secrets are never merged in the Cue tree. They can only be used by a special filesystem mount designed to minimize leak risk.
### engine.#Secret Inputs
_No input._
### engine.#Secret Outputs
_No output._
## engine.#Service
A reference to a network service endpoint, for example: - A TCP or UDP port - A unix or npipe socket - An HTTPS endpoint
### engine.#Service Inputs
_No input._
### engine.#Service Outputs
_No output._
## engine.#TempDir
A temporary directory for command execution
### engine.#TempDir Inputs
_No input._
### engine.#TempDir Outputs
_No output._
## engine.#WriteFile
Write a file to a filesystem tree, creating it if needed
### engine.#WriteFile Inputs
_No input._
### engine.#WriteFile Outputs
_No output._

View File

@ -1,165 +0,0 @@
---
sidebar_label: engine
---
# alpha.dagger.io/europa/dagger/engine
```cue
import "alpha.dagger.io/europa/dagger/engine"
```
## engine.#CacheDir
A (best effort) persistent cache dir
### engine.#CacheDir Inputs
_No input._
### engine.#CacheDir Outputs
_No output._
## engine.#Exec
Execute a command in a container
### engine.#Exec Inputs
_No input._
### engine.#Exec Outputs
_No output._
## engine.#FS
A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS.
### engine.#FS Inputs
_No input._
### engine.#FS Outputs
_No output._
## engine.#ImageConfig
Container image config. See [OCI](https://www.opencontainers.org/). Spec left open on purpose to account for additional fields. [Image Spec](https://github.com/opencontainers/image-spec/blob/main/specs-go/v1/config.go) [Docker Superset](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/dockerfile2llb/image.go)
### engine.#ImageConfig Inputs
_No input._
### engine.#ImageConfig Outputs
_No output._
## engine.#Mkdir
Create one or multiple directory in a container
### engine.#Mkdir Inputs
_No input._
### engine.#Mkdir Outputs
_No output._
## engine.#Mount
A transient filesystem mount.
### engine.#Mount Inputs
_No input._
### engine.#Mount Outputs
_No output._
## engine.#Plan
A deployment plan executed by `dagger up`
### engine.#Plan Inputs
_No input._
### engine.#Plan Outputs
_No output._
## engine.#Pull
Download a container image from a remote repository
### engine.#Pull Inputs
_No input._
### engine.#Pull Outputs
_No output._
## engine.#ReadFile
Read a file from a filesystem tree
### engine.#ReadFile Inputs
_No input._
### engine.#ReadFile Outputs
_No output._
## engine.#Secret
A reference to an external secret, for example: - A password - A SSH private key - An API token Secrets are never merged in the Cue tree. They can only be used by a special filesystem mount designed to minimize leak risk.
### engine.#Secret Inputs
_No input._
### engine.#Secret Outputs
_No output._
## engine.#Service
A reference to a network service endpoint, for example: - A TCP or UDP port - A unix or npipe socket - An HTTPS endpoint
### engine.#Service Inputs
_No input._
### engine.#Service Outputs
_No output._
## engine.#TempDir
A temporary directory for command execution
### engine.#TempDir Inputs
_No input._
### engine.#TempDir Outputs
_No output._
## engine.#WriteFile
Write a file to a filesystem tree, creating it if needed
### engine.#WriteFile Inputs
_No input._
### engine.#WriteFile Outputs
_No output._

View File

@ -1,11 +0,0 @@
---
sidebar_label: spec
---
# alpha.dagger.io/europa/dagger/engine/spec
Placeholder package, to keep docs generating tool happy.
```cue
import "alpha.dagger.io/europa/dagger/engine/spec"
```

View File

@ -1,281 +0,0 @@
---
sidebar_label: engine
---
# alpha.dagger.io/europa/dagger/engine/spec/engine
The Dagger API.
```cue
import "alpha.dagger.io/europa/dagger/engine/spec/engine"
```
## engine.#Build
Build a container image using buildkit
### engine.#Build Inputs
_No input._
### engine.#Build Outputs
_No output._
## engine.#CacheDir
A (best effort) persistent cache dir
### engine.#CacheDir Inputs
_No input._
### engine.#CacheDir Outputs
_No output._
## engine.#Copy
### engine.#Copy Inputs
_No input._
### engine.#Copy Outputs
_No output._
## engine.#CopyInfo
### engine.#CopyInfo Inputs
_No input._
### engine.#CopyInfo Outputs
_No output._
## engine.#DAG
A special kind of program which `dagger` can execute.
### engine.#DAG Inputs
_No input._
### engine.#DAG Outputs
_No output._
## engine.#Exec
Execute a command in a container
### engine.#Exec Inputs
_No input._
### engine.#Exec Outputs
_No output._
## engine.#FS
A reference to a filesystem tree. For example: - The root filesystem of a container - A source code repository - A directory containing binary artifacts Rule of thumb: if it fits in a tar archive, it fits in a #FS.
### engine.#FS Inputs
_No input._
### engine.#FS Outputs
_No output._
## engine.#GitPull
Pull a directory from a git remote
### engine.#GitPull Inputs
_No input._
### engine.#GitPull Outputs
_No output._
## engine.#GitPush
Push a directory to a git remote
### engine.#GitPush Inputs
_No input._
### engine.#GitPush Outputs
_No output._
## engine.#HTTPFetch
Fetch a file over HTTP
### engine.#HTTPFetch Inputs
_No input._
### engine.#HTTPFetch Outputs
_No output._
## engine.#ImageConfig
Container image config. See [OCI](https://www.opencontainers.org/). Spec left open on purpose to account for additional fields. [Image Spec](https://github.com/opencontainers/image-spec/blob/main/specs-go/v1/config.go) [Docker Superset](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/dockerfile2llb/image.go)
### engine.#ImageConfig Inputs
_No input._
### engine.#ImageConfig Outputs
_No output._
## engine.#Merge
### engine.#Merge Inputs
_No input._
### engine.#Merge Outputs
_No output._
## engine.#Mkdir
Create one or multiple directory in a container Create a directory
### engine.#Mkdir Inputs
_No input._
### engine.#Mkdir Outputs
_No output._
## engine.#Mount
A transient filesystem mount.
### engine.#Mount Inputs
_No input._
### engine.#Mount Outputs
_No output._
## engine.#Plan
A deployment plan executed by `dagger up`
### engine.#Plan Inputs
_No input._
### engine.#Plan Outputs
_No output._
## engine.#Pull
Download a container image from a remote repository
### engine.#Pull Inputs
_No input._
### engine.#Pull Outputs
_No output._
## engine.#Push
Upload a container image to a remote repository
### engine.#Push Inputs
_No input._
### engine.#Push Outputs
_No output._
## engine.#ReadFile
Read a file from a filesystem tree
### engine.#ReadFile Inputs
_No input._
### engine.#ReadFile Outputs
_No output._
## engine.#Scratch
Produce an empty directory
### engine.#Scratch Inputs
_No input._
### engine.#Scratch Outputs
_No output._
## engine.#Secret
A reference to an external secret, for example: - A password - A SSH private key - An API token Secrets are never merged in the Cue tree. They can only be used by a special filesystem mount designed to minimize leak risk.
### engine.#Secret Inputs
_No input._
### engine.#Secret Outputs
_No output._
## engine.#Service
A reference to a network service endpoint, for example: - A TCP or UDP port - A unix or npipe socket - An HTTPS endpoint
### engine.#Service Inputs
_No input._
### engine.#Service Outputs
_No output._
## engine.#TempDir
A temporary directory for command execution
### engine.#TempDir Inputs
_No input._
### engine.#TempDir Outputs
_No output._
## engine.#WriteFile
Write a file to a filesystem tree, creating it if needed
### engine.#WriteFile Inputs
_No input._
### engine.#WriteFile Outputs
_No output._

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
runtime_image_ref: string | *"thechangelog/runtime:2021-05-29T10.17.12Z"

View File

@ -3,7 +3,7 @@ package dagger
import (
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
// An artifact such as source code checkout, container image, binary archive...

View File

@ -1,7 +1,7 @@
package dagger
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
// A deployment plan executed by `dagger up`

View File

@ -1,7 +1,7 @@
package dagger
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
// A reference to a filesystem tree.

View File

@ -1,7 +1,7 @@
package dagger
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
// Select a subdirectory from a filesystem tree

View File

@ -3,24 +3,112 @@ package pkg
import (
"context"
"embed"
"errors"
"fmt"
"io/fs"
"os"
"path"
"path/filepath"
"github.com/gofrs/flock"
"github.com/rs/zerolog/log"
)
var (
// FS contains the filesystem of the stdlib.
//go:embed alpha.dagger.io/**/*.cue alpha.dagger.io/**/*/*.cue alpha.dagger.io/europa/dagger/*.cue alpha.dagger.io/europa/dagger/engine/*.cue
//go:embed alpha.dagger.io/**/*.cue alpha.dagger.io/**/*/*.cue dagger.io/**/*.cue dagger.io/**/*/*.cue
FS embed.FS
AlphaModule = "alpha.dagger.io"
EnginePackage = fmt.Sprintf("%s/europa/dagger/engine", AlphaModule)
)
func Vendor(ctx context.Context, dest string) error {
// Write the current version
var (
AlphaModule = "alpha.dagger.io"
DaggerModule = "dagger.io"
EnginePackage = fmt.Sprintf("%s/dagger/engine", DaggerModule)
modules = []string{
AlphaModule,
DaggerModule,
}
lockFilePath = "dagger.lock"
)
func Vendor(ctx context.Context, p string) error {
if p == "" {
p = getCueModParent()
}
cuePkgDir := path.Join(p, "cue.mod", "pkg")
if err := os.MkdirAll(cuePkgDir, 0755); err != nil {
return err
}
// Lock this function so no more than 1 process can run it at once.
lockFile := path.Join(cuePkgDir, lockFilePath)
l := flock.New(lockFile)
if err := l.Lock(); err != nil {
return err
}
defer func() {
l.Unlock()
os.Remove(lockFile)
}()
// ensure cue module is initialized
if err := cueModInit(ctx, p); err != nil {
return err
}
// generate `.gitignore`
if err := os.WriteFile(
path.Join(cuePkgDir, ".gitignore"),
[]byte(fmt.Sprintf("# generated by dagger\n%s\n%s\ndagger.lock\n", AlphaModule, DaggerModule)),
0600,
); err != nil {
return err
}
log.Ctx(ctx).Debug().Str("mod", p).Msg("vendoring packages")
// Unpack modules in a temporary directory
unpackDir, err := os.MkdirTemp(cuePkgDir, "vendor-*")
if err != nil {
return err
}
defer os.RemoveAll(unpackDir)
if err := extractModules(unpackDir); err != nil {
return err
}
for _, module := range modules {
// Semi-atomic swap of the module
//
// The following basically does:
// $ rm -rf cue.mod/pkg/MODULE.old
// $ mv cue.mod/pkg/MODULE cue.mod/pkg/MODULE.old
// $ mv VENDOR/MODULE cue.mod/pkg/MODULE
// $ rm -rf cue.mod/pkg/MODULE.old
moduleDir := path.Join(cuePkgDir, module)
backupModuleDir := moduleDir + ".old"
if err := os.RemoveAll(backupModuleDir); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
if err := os.Rename(moduleDir, backupModuleDir); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
defer os.RemoveAll(backupModuleDir)
if err := os.Rename(path.Join(unpackDir, module), moduleDir); err != nil {
return err
}
}
return nil
}
func extractModules(dest string) error {
return fs.WalkDir(FS, ".", func(p string, entry fs.DirEntry, err error) error {
if err != nil {
return err
@ -48,3 +136,56 @@ func Vendor(ctx context.Context, dest string) error {
return os.WriteFile(overlayPath, contents, 0600)
})
}
// getCueModParent traverses the directory tree up through ancestors looking for a cue.mod folder
func getCueModParent() string {
cwd, _ := os.Getwd()
parentDir := cwd
for {
if _, err := os.Stat(path.Join(parentDir, "cue.mod")); !errors.Is(err, os.ErrNotExist) {
break // found it!
}
parentDir = filepath.Dir(parentDir)
if parentDir == string(os.PathSeparator) {
// reached the root
parentDir = cwd // reset to working directory
break
}
}
return parentDir
}
func cueModInit(ctx context.Context, parentDir string) error {
lg := log.Ctx(ctx)
modDir := path.Join(parentDir, "cue.mod")
modFile := path.Join(modDir, "module.cue")
if _, err := os.Stat(modFile); err != nil {
if !errors.Is(err, os.ErrNotExist) {
return err
}
lg.Debug().Str("mod", parentDir).Msg("initializing cue.mod")
if err := os.WriteFile(modFile, []byte("module: \"\"\n"), 0600); err != nil {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "usr"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "pkg"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
return nil
}

View File

@ -11,10 +11,10 @@ import (
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/environment"
"go.dagger.io/dagger/pkg"
"go.dagger.io/dagger/plan/task"
"go.dagger.io/dagger/plancontext"
"go.dagger.io/dagger/solver"
"go.dagger.io/dagger/state"
"go.opentelemetry.io/otel"
)
@ -33,8 +33,8 @@ type Config struct {
func Load(ctx context.Context, cfg Config) (*Plan, error) {
log.Ctx(ctx).Debug().Interface("args", cfg.Args).Msg("loading plan")
// FIXME: universe vendoring
if err := state.VendorUniverse(ctx, ""); err != nil {
// FIXME: vendoring path
if err := pkg.Vendor(ctx, ""); err != nil {
return nil, err
}

View File

@ -10,7 +10,6 @@ import (
"path/filepath"
"strings"
"github.com/gofrs/flock"
"github.com/rs/zerolog/log"
"go.dagger.io/dagger/keychain"
"go.dagger.io/dagger/pkg"
@ -32,7 +31,6 @@ const (
planDir = "plan"
manifestFile = "values.yaml"
computedFile = "computed.json"
lockFilePath = "dagger.lock"
)
type Project struct {
@ -57,7 +55,7 @@ func Init(ctx context.Context, dir string) (*Project, error) {
return nil, err
}
if err := VendorUniverse(ctx, root); err != nil {
if err := pkg.Vendor(ctx, root); err != nil {
return nil, err
}
@ -354,133 +352,3 @@ func (w *Project) cleanPackageName(ctx context.Context, pkg string) (string, err
return p, nil
}
func cueModInit(ctx context.Context, parentDir string) error {
lg := log.Ctx(ctx)
modDir := path.Join(parentDir, "cue.mod")
modFile := path.Join(modDir, "module.cue")
if _, err := os.Stat(modFile); err != nil {
if !errors.Is(err, os.ErrNotExist) {
return err
}
lg.Debug().Str("mod", parentDir).Msg("initializing cue.mod")
if err := os.WriteFile(modFile, []byte("module: \"\"\n"), 0600); err != nil {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "usr"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
if err := os.Mkdir(path.Join(modDir, "pkg"), 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
return nil
}
func VendorUniverse(ctx context.Context, p string) error {
if p == "" {
p = getCueModParent()
}
cueModDir := path.Join(p, "cue.mod")
if err := os.Mkdir(cueModDir, 0755); err != nil {
if !errors.Is(err, os.ErrExist) {
return err
}
}
if err := os.MkdirAll(cueModDir, 0755); err != nil {
return err
}
lockFilePath := path.Join(cueModDir, lockFilePath)
fileLock := flock.New(lockFilePath)
if err := fileLock.Lock(); err != nil {
return err
}
defer func() {
fileLock.Unlock()
os.Remove(lockFilePath)
}()
// ensure cue module is initialized
if err := cueModInit(ctx, p); err != nil {
return err
}
// add universe and lock file to `.gitignore`
if err := os.WriteFile(
path.Join(p, "cue.mod", "pkg", ".gitignore"),
[]byte(fmt.Sprintf("# generated by dagger\n%s\ndagger.lock\n", pkg.AlphaModule)),
0600,
); err != nil {
return err
}
log.Ctx(ctx).Debug().Str("mod", p).Msg("vendoring universe")
// Vendor in a temporary directory
tmp, err := os.MkdirTemp(path.Join(p, "cue.mod", "pkg"), "vendor-*")
if err != nil {
return err
}
if err := pkg.Vendor(ctx, tmp); err != nil {
// FIXME(samalba): disabled install remote stdlib temporarily
// if _, err := mod.Install(ctx, p, stdlib.ModuleName, ""); err != nil {
return err
}
// Semi-atomic swap of the vendor directory
// The following basically does:
// rm -rf cue.mod/pkg/MODULE.old
// mv cue.mod/pkg/MODULE cue.mod/pkg/MODULE.old
// mv VENDOR cue.mod/pkg/MODULE
// rm -rf cue.mod/pkg/MODULE.old
newStdlib := path.Join(p, "cue.mod", "pkg", pkg.AlphaModule)
oldStdlib := newStdlib + ".old"
if err := os.RemoveAll(oldStdlib); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
if err := os.Rename(newStdlib, oldStdlib); err != nil && !errors.Is(err, os.ErrNotExist) {
return err
}
defer os.RemoveAll(oldStdlib)
if err := os.Rename(path.Join(tmp, pkg.AlphaModule), newStdlib); err != nil {
return err
}
return nil
}
func getCueModParent() string {
cwd, _ := os.Getwd()
parentDir := cwd
// traverse the directory tree up through ancestors looking for a cue.mod folder
for {
if _, err := os.Stat(path.Join(parentDir, "cue.mod")); !errors.Is(err, os.ErrNotExist) {
break // found it!
}
parentDir = filepath.Dir(parentDir)
if parentDir == string(os.PathSeparator) {
// reached the root
parentDir = cwd // reset to working directory
break
}
}
return parentDir
}

View File

@ -6,6 +6,7 @@ import (
"cuelang.org/go/cue"
"go.dagger.io/dagger/compiler"
"go.dagger.io/dagger/pkg"
"go.dagger.io/dagger/plancontext"
)
@ -55,7 +56,7 @@ func (s *State) CompilePlan(ctx context.Context) (*compiler.Value, error) {
// 2) For backward compatibility: if the project was `dagger
// init`-ed before we added support for vendoring universe, it might not
// contain a `cue.mod`.
if err := VendorUniverse(ctx, w); err != nil {
if err := pkg.Vendor(ctx, w); err != nil {
return nil, err
}

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
"alpha.dagger.io/os"
)

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: data: engine.#WriteFile & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package testing
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: badref: engine.#GitPull & {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: badremote: engine.#GitPull & {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: gitPull: engine.#GitPull & {

View File

@ -1,6 +1,6 @@
package testing
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: invalid: engine.#GitPull & {}

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
inputs: secrets: token: command: {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: fetch: engine.#HTTPFetch & {

View File

@ -1,6 +1,6 @@
package main
import "alpha.dagger.io/europa/dagger/engine"
import "dagger.io/dagger/engine"
engine.#Plan & {
actions: fetch: engine.#HTTPFetch & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -2,7 +2,7 @@ package main
import (
"strings"
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,8 +1,8 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"alpha.dagger.io/europa/dagger"
"dagger.io/dagger/engine"
"dagger.io/dagger"
)
engine.#Plan & {

View File

@ -1,8 +1,8 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"alpha.dagger.io/europa/dagger"
"dagger.io/dagger/engine"
"dagger.io/dagger"
)
engine.#Plan & {

View File

@ -1,8 +1,8 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"alpha.dagger.io/europa/dagger"
"dagger.io/dagger/engine"
"dagger.io/dagger"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {

View File

@ -1,7 +1,7 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
"dagger.io/dagger/engine"
)
engine.#Plan & {