-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5f41d17
Showing
57 changed files
with
3,506 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
|
||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
env: | ||
GH_USERNAME: ${{ github.actor }} | ||
GH_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- run: make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
.build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PIPER = go run ./cmd/piper --log-level=debug | ||
|
||
build: | ||
$(PIPER) do go build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/innoai-tech/infra/pkg/cli" | ||
|
||
"github.com/octohelm/piper/pkg/engine" | ||
"github.com/octohelm/piper/pkg/logutil" | ||
) | ||
|
||
func init() { | ||
cli.AddTo(App, &Do{}) | ||
} | ||
|
||
type Do struct { | ||
cli.C | ||
logutil.Logger | ||
engine.Pipeline | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"os" | ||
|
||
"github.com/innoai-tech/infra/pkg/cli" | ||
|
||
"github.com/octohelm/piper/internal/version" | ||
) | ||
|
||
var App = cli.NewApp("piper", version.Version()) | ||
|
||
func main() { | ||
if err := cli.Execute(context.Background(), App, os.Args[1:]); err != nil { | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
gen/ | ||
pkg/ | ||
module.sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module: "github.com/octohelm/piper" | ||
|
||
require: { | ||
"piper.octohelm.tech": "v0.0.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package busybox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package cuepkg | ||
|
||
import ( | ||
"context" | ||
"embed" | ||
"fmt" | ||
"github.com/pkg/errors" | ||
"io" | ||
"io/fs" | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/octohelm/cuemod/pkg/cuemod/stdlib" | ||
"github.com/octohelm/piper/pkg/engine/plan/task/core" | ||
"github.com/octohelm/unifs/pkg/filesystem" | ||
) | ||
|
||
//go:embed piper.octohelm.tech | ||
var daggerPortalModules embed.FS | ||
|
||
var ( | ||
PiperModule = "piper.octohelm.tech" | ||
) | ||
|
||
func RegistryCueStdlibs() error { | ||
wagonModule, err := createWagonModule(daggerPortalModules) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// ugly lock embed version | ||
if err := registerStdlib(filesystem.AsReadDirFS(wagonModule), "v0.0.0", PiperModule); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
} | ||
|
||
func registerStdlib(fs fs.ReadDirFS, ver string, modules ...string) error { | ||
stdlib.Register(fs, ver, modules...) | ||
return nil | ||
} | ||
|
||
func createWagonModule(otherFs ...fs.ReadDirFS) (filesystem.FileSystem, error) { | ||
mfs := filesystem.NewMemFS() | ||
|
||
ctx := context.Background() | ||
|
||
for _, f := range otherFs { | ||
if err := listFile(f, ".", func(filename string) error { | ||
src, err := f.Open(filename) | ||
if err != nil { | ||
return errors.Wrap(err, "open source file failed") | ||
} | ||
defer src.Close() | ||
|
||
if err := filesystem.MkdirAll(ctx, mfs, filepath.Dir(filename)); err != nil { | ||
return err | ||
} | ||
dest, err := mfs.OpenFile(ctx, filename, os.O_RDWR|os.O_CREATE, os.ModePerm) | ||
if err != nil { | ||
return errors.Wrap(err, "open dest file failed") | ||
} | ||
defer dest.Close() | ||
|
||
if _, err := io.Copy(dest, src); err != nil { | ||
return err | ||
} | ||
return nil | ||
}); err != nil { | ||
return nil, err | ||
} | ||
} | ||
|
||
coreCue := fmt.Sprintf("%s/core/core.cue", PiperModule) | ||
|
||
if err := filesystem.MkdirAll(ctx, mfs, filepath.Dir(coreCue)); err != nil { | ||
return nil, err | ||
} | ||
file, err := mfs.OpenFile(context.Background(), coreCue, os.O_CREATE|os.O_RDWR, os.ModePerm) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer file.Close() | ||
if err := core.DefaultFactory.WriteCueDeclsTo(file); err != nil { | ||
return nil, err | ||
} | ||
|
||
return mfs, nil | ||
} | ||
|
||
func listFile(f fs.ReadDirFS, root string, each func(filename string) error) error { | ||
return fs.WalkDir(f, root, func(path string, d fs.DirEntry, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if d.IsDir() { | ||
return nil | ||
} | ||
rel := path | ||
if root != "" && root != "." { | ||
rel, _ = filepath.Rel(root, path) | ||
} | ||
return each(rel) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cuepkg | ||
|
||
import ( | ||
"fmt" | ||
"github.com/octohelm/piper/pkg/wd" | ||
"testing" | ||
) | ||
|
||
func TestCuePkg(t *testing.T) { | ||
cuepkgs, err := createWagonModule(daggerPortalModules) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
_ = wd.ListFile(cuepkgs, "", func(filename string) error { | ||
fmt.Println(filename) | ||
return nil | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
module github.com/octohelm/piper | ||
|
||
go 1.21 | ||
|
||
replace github.com/octohelm/unifs => ../../../github.com/octohelm/unifs | ||
|
||
replace github.com/k0sproject/rig => github.com/k0sproject/rig v0.15.2-0.20231214092155-eaf96adb3d48 | ||
|
||
require ( | ||
cuelang.org/go v0.7.0 | ||
github.com/go-courier/logr v0.3.0 | ||
github.com/innoai-tech/infra v0.0.0-20231124085701-81f94504013c | ||
github.com/k0sproject/rig v0.15.1 | ||
github.com/kevinburke/ssh_config v1.2.0 | ||
github.com/mattn/go-colorable v0.1.13 | ||
github.com/octohelm/cuemod v0.9.0 | ||
github.com/octohelm/gengo v0.0.0-20230809023313-1339e47458a4 | ||
github.com/octohelm/storage v0.0.0-20231213035828-4a91cdd3f879 | ||
github.com/octohelm/unifs v0.0.0-00010101000000-000000000000 | ||
github.com/octohelm/x v0.0.0-20231115103341-17be3238221d | ||
github.com/opencontainers/go-digest v1.0.0 | ||
github.com/opencontainers/image-spec v1.1.0-rc5 | ||
github.com/pkg/errors v0.9.1 | ||
golang.org/x/exp v0.0.0-20231214170342-aacd6d4b4611 | ||
golang.org/x/net v0.19.0 | ||
) | ||
|
||
require ( | ||
cuelabs.dev/go/oci/ociregistry v0.0.0-20231205091233-3bb0ee105e4a // indirect | ||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect | ||
github.com/ChrisTrenkamp/goxpath v0.0.0-20210404020558-97928f7e12b6 // indirect | ||
github.com/Microsoft/go-winio v0.6.1 // indirect | ||
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d // indirect | ||
github.com/alessio/shellescape v1.4.2 // indirect | ||
github.com/cockroachdb/apd/v3 v3.2.1 // indirect | ||
github.com/creasty/defaults v1.7.0 // indirect | ||
github.com/davidmz/go-pageant v1.0.2 // indirect | ||
github.com/emicklei/proto v1.13.0 // indirect | ||
github.com/go-logr/logr v1.3.0 // indirect | ||
github.com/gofrs/uuid v4.4.0+incompatible // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect | ||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect | ||
github.com/google/uuid v1.5.0 // indirect | ||
github.com/hashicorp/go-uuid v1.0.3 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/jcmturner/aescts/v2 v2.0.0 // indirect | ||
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect | ||
github.com/jcmturner/gofork v1.7.6 // indirect | ||
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect | ||
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect | ||
github.com/jcmturner/rpc/v2 v2.0.3 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect | ||
github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect | ||
github.com/masterzen/winrm v0.0.0-20220917170901-b07f6cb0598d // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/go-wordwrap v1.0.1 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect | ||
github.com/onsi/gomega v1.30.0 // indirect | ||
github.com/protocolbuffers/txtpbfmt v0.0.0-20231025115547-084445ff1adf // indirect | ||
github.com/spf13/cobra v1.8.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
golang.org/x/crypto v0.17.0 // indirect | ||
golang.org/x/mod v0.14.0 // indirect | ||
golang.org/x/sync v0.5.0 // indirect | ||
golang.org/x/sys v0.15.0 // indirect | ||
golang.org/x/term v0.15.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
golang.org/x/tools v0.16.1 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/apiextensions-apiserver v0.29.0 // indirect | ||
k8s.io/apimachinery v0.29.0 // indirect | ||
k8s.io/klog/v2 v2.110.1 // indirect | ||
k8s.io/utils v0.0.0-20231127182322-b307cd553661 // indirect | ||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect | ||
sigs.k8s.io/yaml v1.4.0 // indirect | ||
) |
Oops, something went wrong.