From de3ffe06102be61681f251a7a62ac72a2e368239 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 17:49:16 -0700 Subject: [PATCH 1/8] cmd docs: fix markdown linter Signed-off-by: Andrea Luzzardi --- cmd/dagger/cmd/common/common.go | 17 +++++++++++++++-- cmd/dagger/cmd/doc.go | 34 ++++++++++++++++----------------- cmd/dagger/cmd/input/list.go | 2 +- cmd/dagger/cmd/output/list.go | 2 +- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/cmd/dagger/cmd/common/common.go b/cmd/dagger/cmd/common/common.go index b2f2f847..29a8865a 100644 --- a/cmd/dagger/cmd/common/common.go +++ b/cmd/dagger/cmd/common/common.go @@ -122,8 +122,21 @@ func FormatValue(val *compiler.Value) string { return strings.ReplaceAll(valStr, "\n", "\\n") } -// ValueDocString returns the value doc from the comment lines -func ValueDocString(val *compiler.Value) string { +// ValueDocFull returns the full doc of the value +func ValueDocFull(val *compiler.Value) string { + docs := []string{} + for _, c := range val.Doc() { + docs = append(docs, c.Text()) + } + doc := strings.TrimSpace(strings.Join(docs, "\n")) + if len(doc) == 0 { + return "-" + } + return doc +} + +// ValueDocOneLine returns the value doc as a single line +func ValueDocOneLine(val *compiler.Value) string { docs := []string{} for _, c := range val.Doc() { docs = append(docs, strings.TrimSpace(c.Text())) diff --git a/cmd/dagger/cmd/doc.go b/cmd/dagger/cmd/doc.go index 25560883..dcf111e4 100644 --- a/cmd/dagger/cmd/doc.go +++ b/cmd/dagger/cmd/doc.go @@ -107,7 +107,7 @@ func init() { } func mdEscape(s string) string { - escape := []string{"|", "<", ">"} + escape := []string{"<", ">"} for _, c := range escape { s = strings.ReplaceAll(s, c, `\`+c) } @@ -151,7 +151,7 @@ func loadCode(packageName string) (*compiler.Value, error) { func printValuesText(iw io.Writer, libName string, values []*compiler.Value) { w := tabwriter.NewWriter(iw, 0, 4, len(textPadding), ' ', 0) for _, i := range values { - docStr := terminalTrim(common.ValueDocString(i)) + docStr := terminalTrim(common.ValueDocOneLine(i)) fmt.Fprintf(w, "\t\t%s\t%s\t%s\n", formatLabel(libName, i), common.FormatValue(i), docStr) } @@ -167,9 +167,8 @@ func printValuesMarkdown(iw io.Writer, libName string, values []*compiler.Value) fmt.Fprintf(w, "|*%s*\t|``%s``\t|%s\t|\n", formatLabel(libName, i), mdEscape(common.FormatValue(i)), - mdEscape(common.ValueDocString(i))) + mdEscape(common.ValueDocOneLine(i))) } - fmt.Fprintln(w) w.Flush() } @@ -181,7 +180,7 @@ func valuesToJSON(libName string, values []*compiler.Value) []ValueJSON { v := ValueJSON{} v.Name = formatLabel(libName, i) v.Type = common.FormatValue(i) - v.Description = common.ValueDocString(i) + v.Description = common.ValueDocOneLine(i) val = append(val, v) } @@ -201,18 +200,17 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile switch format { case textFormat: fmt.Fprintf(w, "Package %s\n", packageName) - fmt.Fprintf(w, "\n%s\n", common.ValueDocString(val)) + fmt.Fprintf(w, "\n%s\n", common.ValueDocFull(val)) case markdownFormat: - fmt.Fprintf(w, "## Package %s\n", mdEscape(packageName)) - comment := common.ValueDocString(val) + fmt.Fprintf(w, "# Package %s\n", mdEscape(packageName)) + comment := common.ValueDocFull(val) if comment == "-" { - fmt.Println() break } - fmt.Fprintf(w, "\n%s\n\n", mdEscape(comment)) + fmt.Fprintf(w, "\n%s\n", mdEscape(comment)) case jsonFormat: packageJSON.Name = packageName - comment := common.ValueDocString(val) + comment := common.ValueDocFull(val) if comment != "-" { packageJSON.Description = comment } @@ -235,18 +233,18 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile } // Field Name + Description - comment := common.ValueDocString(v) + comment := common.ValueDocOneLine(v) switch format { case textFormat: fmt.Fprintf(w, "\n%s\n\n%s%s\n", name, textPadding, comment) case markdownFormat: - fmt.Fprintf(w, "### %s\n\n", name) + fmt.Fprintf(w, "\n## %s\n\n", name) if comment != "-" { fmt.Fprintf(w, "%s\n\n", mdEscape(comment)) } case jsonFormat: fieldJSON.Name = name - comment := common.ValueDocString(val) + comment := common.ValueDocOneLine(val) if comment != "-" { fieldJSON.Description = comment } @@ -263,9 +261,9 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile fmt.Fprintf(w, "\n%sInputs:\n", textPadding) printValuesText(w, name, inp) case markdownFormat: - fmt.Fprintf(w, "#### %s Inputs\n\n", mdEscape(name)) + fmt.Fprintf(w, "### %s Inputs\n\n", mdEscape(name)) if len(inp) == 0 { - fmt.Fprintf(w, "_No input._\n\n") + fmt.Fprintf(w, "_No input._\n") break } printValuesMarkdown(w, name, inp) @@ -284,9 +282,9 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile fmt.Fprintf(w, "\n%sOutputs:\n", textPadding) printValuesText(w, name, out) case markdownFormat: - fmt.Fprintf(w, "#### %s Outputs\n\n", mdEscape(name)) + fmt.Fprintf(w, "\n### %s Outputs\n\n", mdEscape(name)) if len(out) == 0 { - fmt.Fprintf(w, "_No output._\n\n") + fmt.Fprintf(w, "_No output._\n") break } printValuesMarkdown(w, name, out) diff --git a/cmd/dagger/cmd/input/list.go b/cmd/dagger/cmd/input/list.go index 0d97d0f4..2df921ed 100644 --- a/cmd/dagger/cmd/input/list.go +++ b/cmd/dagger/cmd/input/list.go @@ -69,7 +69,7 @@ var listCmd = &cobra.Command{ inp.Path(), common.FormatValue(inp), isUserSet(st, inp), - common.ValueDocString(inp), + common.ValueDocOneLine(inp), ) } diff --git a/cmd/dagger/cmd/output/list.go b/cmd/dagger/cmd/output/list.go index 502d7b10..983becc8 100644 --- a/cmd/dagger/cmd/output/list.go +++ b/cmd/dagger/cmd/output/list.go @@ -72,7 +72,7 @@ func ListOutputs(ctx context.Context, st *state.State, isTTY bool) { fmt.Fprintf(w, "%s\t%s\t%s\n", out.Path(), common.FormatValue(out), - common.ValueDocString(out), + common.ValueDocOneLine(out), ) } From b53e2136b7b5be38d8a6167f741c15152ba7efae Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 18:25:08 -0700 Subject: [PATCH 2/8] cmd docs: add frontmatter metadata Signed-off-by: Andrea Luzzardi --- cmd/dagger/cmd/doc.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd/dagger/cmd/doc.go b/cmd/dagger/cmd/doc.go index dcf111e4..5ec42c41 100644 --- a/cmd/dagger/cmd/doc.go +++ b/cmd/dagger/cmd/doc.go @@ -8,6 +8,7 @@ import ( "io/fs" "os" "path" + "path/filepath" "strings" "text/tabwriter" "unicode/utf8" @@ -107,7 +108,7 @@ func init() { } func mdEscape(s string) string { - escape := []string{"<", ">"} + escape := []string{"|", "<", ">"} for _, c := range escape { s = strings.ReplaceAll(s, c, `\`+c) } @@ -164,7 +165,7 @@ func printValuesMarkdown(iw io.Writer, libName string, values []*compiler.Value) fmt.Fprintf(w, "| Name\t| Type\t| Description \t|\n") fmt.Fprintf(w, "| -------------\t|:-------------:\t|:-------------:\t|\n") for _, i := range values { - fmt.Fprintf(w, "|*%s*\t|``%s``\t|%s\t|\n", + fmt.Fprintf(w, "|*%s*\t| `%s`\t|%s\t|\n", formatLabel(libName, i), mdEscape(common.FormatValue(i)), mdEscape(common.ValueDocOneLine(i))) @@ -202,7 +203,10 @@ func PrintDoc(ctx context.Context, w io.Writer, packageName string, val *compile fmt.Fprintf(w, "Package %s\n", packageName) fmt.Fprintf(w, "\n%s\n", common.ValueDocFull(val)) case markdownFormat: - fmt.Fprintf(w, "# Package %s\n", mdEscape(packageName)) + fmt.Fprintf(w, "---\nsidebar_label: %s\n---\n\n", + filepath.Base(packageName), + ) + fmt.Fprintf(w, "# %s\n", mdEscape(packageName)) comment := common.ValueDocFull(val) if comment == "-" { break @@ -331,7 +335,7 @@ func walkStdlib(ctx context.Context, output, format string) { pkg := fmt.Sprintf("dagger.io/%s", p) lg.Info().Str("package", pkg).Str("format", format).Msg("generating doc") - val, err := loadCode(fmt.Sprintf("dagger.io/%s", p)) + val, err := loadCode(pkg) if err != nil { if strings.Contains(err.Error(), "no CUE files") { lg.Warn().Str("package", p).Err(err).Msg("ignoring") @@ -340,7 +344,7 @@ func walkStdlib(ctx context.Context, output, format string) { return err } - PrintDoc(ctx, f, p, val, format) + PrintDoc(ctx, f, pkg, val, format) return nil }) From e1f28a73e52b88b6a473eeb287b115b06b29eb6d Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 17:35:18 -0700 Subject: [PATCH 3/8] docs: add `make universe` Signed-off-by: Andrea Luzzardi --- Makefile | 10 +++++++++- docs/reference/_category_.json | 4 ++++ docs/reference/universe/_category_.json | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 docs/reference/_category_.json create mode 100644 docs/reference/universe/_category_.json diff --git a/Makefile b/Makefile index 19d25878..80286974 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ shellcheck: shellcheck ./tests/*.bats ./tests/*.bash .PHONY: lint -lint: shellcheck cuelint golint check-buildkit-version +lint: shellcheck cuelint golint check-buildkit-version universelint .PHONY: check-buildkit-version check-buildkit-version: @@ -50,6 +50,14 @@ integration: dagger-debug install: dagger go install ./cmd/dagger +.PHONY: universe +universe: dagger + ./cmd/dagger/dagger doc --output ./docs/reference/universe --format md + +.PHONY: universelint +universelint: universe + @test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference/universe | cut -d ' ' -f3 | tee /dev/stderr)" + .PHONY: docs docs: yarn --cwd "./website" install diff --git a/docs/reference/_category_.json b/docs/reference/_category_.json new file mode 100644 index 00000000..1b337d5a --- /dev/null +++ b/docs/reference/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "Reference", + "position": 5 +} diff --git a/docs/reference/universe/_category_.json b/docs/reference/universe/_category_.json new file mode 100644 index 00000000..a7715dec --- /dev/null +++ b/docs/reference/universe/_category_.json @@ -0,0 +1,3 @@ +{ + "label": "Universe" +} From f3f5e7c7145a205aebb31437f480dac83a81b4f0 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 17:35:42 -0700 Subject: [PATCH 4/8] docs: make universe Signed-off-by: Andrea Luzzardi --- docs/reference/universe/alpine.md | 15 ++ docs/reference/universe/aws.md | 37 ++++ docs/reference/universe/aws/cloudformation.md | 26 +++ docs/reference/universe/aws/ecr.md | 23 +++ docs/reference/universe/aws/ecs.md | 5 + docs/reference/universe/aws/eks.md | 25 +++ docs/reference/universe/aws/elb.md | 24 +++ docs/reference/universe/aws/rds.md | 66 +++++++ docs/reference/universe/aws/s3.md | 49 ++++++ docs/reference/universe/dagger.md | 17 ++ docs/reference/universe/dagger/op.md | 161 ++++++++++++++++++ docs/reference/universe/docker.md | 91 ++++++++++ docs/reference/universe/file.md | 84 +++++++++ docs/reference/universe/gcp.md | 37 ++++ docs/reference/universe/gcp/gcr.md | 23 +++ docs/reference/universe/gcp/gke.md | 25 +++ docs/reference/universe/git.md | 53 ++++++ docs/reference/universe/go.md | 70 ++++++++ docs/reference/universe/io.md | 59 +++++++ docs/reference/universe/js.md | 0 docs/reference/universe/js/yarn.md | 31 ++++ docs/reference/universe/kubernetes.md | 31 ++++ docs/reference/universe/kubernetes/helm.md | 27 +++ .../universe/kubernetes/kustomize.md | 33 ++++ docs/reference/universe/netlify.md | 42 +++++ docs/reference/universe/os.md | 49 ++++++ docs/reference/universe/random.md | 33 ++++ docs/reference/universe/terraform.md | 20 +++ stdlib/git/git.cue | 2 +- stdlib/random/string.cue | 6 +- 30 files changed, 1162 insertions(+), 2 deletions(-) create mode 100644 docs/reference/universe/alpine.md create mode 100644 docs/reference/universe/aws.md create mode 100644 docs/reference/universe/aws/cloudformation.md create mode 100644 docs/reference/universe/aws/ecr.md create mode 100644 docs/reference/universe/aws/ecs.md create mode 100644 docs/reference/universe/aws/eks.md create mode 100644 docs/reference/universe/aws/elb.md create mode 100644 docs/reference/universe/aws/rds.md create mode 100644 docs/reference/universe/aws/s3.md create mode 100644 docs/reference/universe/dagger.md create mode 100644 docs/reference/universe/dagger/op.md create mode 100644 docs/reference/universe/docker.md create mode 100644 docs/reference/universe/file.md create mode 100644 docs/reference/universe/gcp.md create mode 100644 docs/reference/universe/gcp/gcr.md create mode 100644 docs/reference/universe/gcp/gke.md create mode 100644 docs/reference/universe/git.md create mode 100644 docs/reference/universe/go.md create mode 100644 docs/reference/universe/io.md create mode 100644 docs/reference/universe/js.md create mode 100644 docs/reference/universe/js/yarn.md create mode 100644 docs/reference/universe/kubernetes.md create mode 100644 docs/reference/universe/kubernetes/helm.md create mode 100644 docs/reference/universe/kubernetes/kustomize.md create mode 100644 docs/reference/universe/netlify.md create mode 100644 docs/reference/universe/os.md create mode 100644 docs/reference/universe/random.md create mode 100644 docs/reference/universe/terraform.md diff --git a/docs/reference/universe/alpine.md b/docs/reference/universe/alpine.md new file mode 100644 index 00000000..a517876e --- /dev/null +++ b/docs/reference/universe/alpine.md @@ -0,0 +1,15 @@ +--- +sidebar_label: alpine +--- + +# dagger.io/alpine + +## #Image + +### #Image Inputs + +_No input._ + +### #Image Outputs + +_No output._ diff --git a/docs/reference/universe/aws.md b/docs/reference/universe/aws.md new file mode 100644 index 00000000..09b49682 --- /dev/null +++ b/docs/reference/universe/aws.md @@ -0,0 +1,37 @@ +--- +sidebar_label: aws +--- + +# dagger.io/aws + +## #CLI + +Re-usable aws-cli component + +### #CLI Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | + +### #CLI Outputs + +_No output._ + +## #Config + +Base AWS Config + +### #Config Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*region* | `string` |AWS region | +|*accessKey* | `dagger.#Secret` |AWS access key | +|*secretKey* | `dagger.#Secret` |AWS secret key | + +### #Config Outputs + +_No output._ diff --git a/docs/reference/universe/aws/cloudformation.md b/docs/reference/universe/aws/cloudformation.md new file mode 100644 index 00000000..79f80d3c --- /dev/null +++ b/docs/reference/universe/aws/cloudformation.md @@ -0,0 +1,26 @@ +--- +sidebar_label: cloudformation +--- + +# dagger.io/aws/cloudformation + +## #Stack + +AWS CloudFormation Stack + +### #Stack Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*source* | `string` |Source is the Cloudformation template (JSON/YAML string) | +|*stackName* | `string` |Stackname is the cloudformation stack | +|*onFailure* | `*"DO_NOTHING" \| "ROLLBACK" \| "DELETE"` |Behavior when failure to create/update the Stack | +|*timeout* | `*10 \| \>=0 & int` |Timeout for waiting for the stack to be created/updated (in minutes) | +|*neverUpdate* | `*false \| bool` |Never update the stack if already exists | + +### #Stack Outputs + +_No output._ diff --git a/docs/reference/universe/aws/ecr.md b/docs/reference/universe/aws/ecr.md new file mode 100644 index 00000000..90ea3225 --- /dev/null +++ b/docs/reference/universe/aws/ecr.md @@ -0,0 +1,23 @@ +--- +sidebar_label: ecr +--- + +# dagger.io/aws/ecr + +## #Credentials + +Credentials retriever for ECR + +### #Credentials Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | + +### #Credentials Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*secret* | `string` |- | diff --git a/docs/reference/universe/aws/ecs.md b/docs/reference/universe/aws/ecs.md new file mode 100644 index 00000000..89716b3f --- /dev/null +++ b/docs/reference/universe/aws/ecs.md @@ -0,0 +1,5 @@ +--- +sidebar_label: ecs +--- + +# dagger.io/aws/ecs diff --git a/docs/reference/universe/aws/eks.md b/docs/reference/universe/aws/eks.md new file mode 100644 index 00000000..458f527d --- /dev/null +++ b/docs/reference/universe/aws/eks.md @@ -0,0 +1,25 @@ +--- +sidebar_label: eks +--- + +# dagger.io/aws/eks + +## #KubeConfig + +KubeConfig config outputs a valid kube-auth-config for kubectl client + +### #KubeConfig Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*clusterName* | `string` |EKS cluster name | +|*version* | `*"v1.19.9" \| string` |Kubectl version | + +### #KubeConfig Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*kubeconfig* | `string` |kubeconfig is the generated kube configuration file | diff --git a/docs/reference/universe/aws/elb.md b/docs/reference/universe/aws/elb.md new file mode 100644 index 00000000..78ce0178 --- /dev/null +++ b/docs/reference/universe/aws/elb.md @@ -0,0 +1,24 @@ +--- +sidebar_label: elb +--- + +# dagger.io/aws/elb + +## #RandomRulePriority + +Returns a non-taken rule priority (randomized) + +### #RandomRulePriority Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*listenerArn* | `string` |ListenerArn | + +### #RandomRulePriority Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*priority* | `string` |exported priority | diff --git a/docs/reference/universe/aws/rds.md b/docs/reference/universe/aws/rds.md new file mode 100644 index 00000000..2fc1603e --- /dev/null +++ b/docs/reference/universe/aws/rds.md @@ -0,0 +1,66 @@ +--- +sidebar_label: rds +--- + +# dagger.io/aws/rds + +## #CreateDB + +### #CreateDB Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*name* | `string` |DB name | +|*dbArn* | `string` |ARN of the database instance | +|*secretArn* | `string` |ARN of the database secret (for connecting via rds api) | +|*dbType* | `string` |- | + +### #CreateDB Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*out* | `string` |Name of the DB created | + +## #CreateUser + +### #CreateUser Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*username* | `string` |Username | +|*password* | `string` |Password | +|*dbArn* | `string` |ARN of the database instance | +|*secretArn* | `string` |ARN of the database secret (for connecting via rds api) | +|*grantDatabase* | `*"" \| string` |- | +|*dbType* | `string` |- | + +### #CreateUser Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*out* | `string` |Outputed username | + +## #Instance + +### #Instance Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*dbArn* | `string` |ARN of the database instance | + +### #Instance Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*hostname* | `_\|_` |DB hostname | +|*port* | `_\|_` |DB port | +|*info* | `_\|_` |- | diff --git a/docs/reference/universe/aws/s3.md b/docs/reference/universe/aws/s3.md new file mode 100644 index 00000000..c57b17ed --- /dev/null +++ b/docs/reference/universe/aws/s3.md @@ -0,0 +1,49 @@ +--- +sidebar_label: s3 +--- + +# dagger.io/aws/s3 + +## #Put + +S3 file or Directory upload + +### #Put Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*target* | `string` |Target S3 URL (eg. s3://\/\/\) | +|*contentType* | `*"" \| string` |Object content type | +|*always* | `*true \| bool` |Always write the object to S3 | + +### #Put Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*url* | `string` |URL of the uploaded S3 object | + +## #Sync + +S3 Sync + +### #Sync Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |AWS region | +|*config.accessKey* | `dagger.#Secret` |AWS access key | +|*config.secretKey* | `dagger.#Secret` |AWS secret key | +|*source* | `dagger.#Artifact` |Source Artifact to upload to S3 | +|*target* | `string` |Target S3 URL (eg. s3://\/\/\) | +|*delete* | `*false \| bool` |Files that exist in the destination but not in the source are deleted during sync. | +|*contentType* | `*"" \| string` |Object content type | +|*always* | `*true \| bool` |Always write the object to S3 | + +### #Sync Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*url* | `string` |URL of the uploaded S3 object | diff --git a/docs/reference/universe/dagger.md b/docs/reference/universe/dagger.md new file mode 100644 index 00000000..c97e55e8 --- /dev/null +++ b/docs/reference/universe/dagger.md @@ -0,0 +1,17 @@ +--- +sidebar_label: dagger +--- + +# dagger.io/dagger + +## #Secret + +Secret value + +### #Secret Inputs + +_No input._ + +### #Secret Outputs + +_No output._ diff --git a/docs/reference/universe/dagger/op.md b/docs/reference/universe/dagger/op.md new file mode 100644 index 00000000..e5e051e6 --- /dev/null +++ b/docs/reference/universe/dagger/op.md @@ -0,0 +1,161 @@ +--- +sidebar_label: op +--- + +# dagger.io/dagger/op + +op: low-level operations for Dagger processing pipelines + +## #Copy + +### #Copy Inputs + +_No input._ + +### #Copy Outputs + +_No output._ + +## #DockerBuild + +### #DockerBuild Inputs + +_No input._ + +### #DockerBuild Outputs + +_No output._ + +## #DockerLogin + +### #DockerLogin Inputs + +_No input._ + +### #DockerLogin Outputs + +_No output._ + +## #Exec + +### #Exec Inputs + +_No input._ + +### #Exec Outputs + +_No output._ + +## #Export + +Export a value from fs state to cue + +### #Export Inputs + +_No input._ + +### #Export Outputs + +_No output._ + +## #FetchContainer + +### #FetchContainer Inputs + +_No input._ + +### #FetchContainer Outputs + +_No output._ + +## #FetchGit + +### #FetchGit Inputs + +_No input._ + +### #FetchGit Outputs + +_No output._ + +## #Load + +### #Load Inputs + +_No input._ + +### #Load Outputs + +_No output._ + +## #Local + +### #Local Inputs + +_No input._ + +### #Local Outputs + +_No output._ + +## #Mkdir + +### #Mkdir Inputs + +_No input._ + +### #Mkdir Outputs + +_No output._ + +## #Op + +One operation in a pipeline #Op does not current enforce the op spec at full resolution, to avoid triggering performance issues. See https://github.com/dagger/dagger/issues/445 To enforce the full #Op spec (see op_fullop.cue), run with "-t fullop" + +### #Op Inputs + +_No input._ + +### #Op Outputs + +_No output._ + +## #PushContainer + +### #PushContainer Inputs + +_No input._ + +### #PushContainer Outputs + +_No output._ + +## #Subdir + +### #Subdir Inputs + +_No input._ + +### #Subdir Outputs + +_No output._ + +## #Workdir + +### #Workdir Inputs + +_No input._ + +### #Workdir Outputs + +_No output._ + +## #WriteFile + +### #WriteFile Inputs + +_No input._ + +### #WriteFile Outputs + +_No output._ diff --git a/docs/reference/universe/docker.md b/docs/reference/universe/docker.md new file mode 100644 index 00000000..5516e911 --- /dev/null +++ b/docs/reference/universe/docker.md @@ -0,0 +1,91 @@ +--- +sidebar_label: docker +--- + +# dagger.io/docker + +## #Build + +Build a Docker image from source, using included Dockerfile + +### #Build Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*source* | `dagger.#Artifact` |- | + +### #Build Outputs + +_No output._ + +## #Client + +A container image to run the Docker client + +### #Client Inputs + +_No input._ + +### #Client Outputs + +_No output._ + +## #ImageFromDockerfile + +Build a Docker image from the provided Dockerfile contents + +### #ImageFromDockerfile Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*dockerfile* | `string` |- | +|*context* | `dagger.#Artifact` |- | + +### #ImageFromDockerfile Outputs + +_No output._ + +## #Pull + +Pull a docker container + +### #Pull Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*from* | `string` |Remote ref (example: "index.docker.io/alpine:latest") | + +### #Pull Outputs + +_No output._ + +## #Push + +Push a docker image + +### #Push Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*ref* | `string` |Remote ref (example: "index.docker.io/alpine:latest") | +|*source* | `dagger.#Artifact` |Image | + +### #Push Outputs + +_No output._ + +## #Run + +### #Run Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*ssh.host* | `string` |ssh host | +|*ssh.user* | `string` |ssh user | +|*ssh.port* | `*22 \| int` |ssh port | +|*ssh.key* | `dagger.#Secret` |private key | +|*ref* | `string` |Image reference (e.g: nginx:alpine) | + +### #Run Outputs + +_No output._ diff --git a/docs/reference/universe/file.md b/docs/reference/universe/file.md new file mode 100644 index 00000000..d7be3274 --- /dev/null +++ b/docs/reference/universe/file.md @@ -0,0 +1,84 @@ +--- +sidebar_label: file +--- + +# dagger.io/file + +DEPRECATED: see dagger.io/os + +## #Append + +### #Append Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*filename* | `string` |- | +|*permissions* | `*0o644 \| int` |- | +|*contents* | `(string\|bytes)` |- | +|*from* | `dagger.#Artifact` |- | + +### #Append Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*orig* | `string` |- | + +## #Create + +### #Create Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*filename* | `string` |- | +|*permissions* | `*0o644 \| int` |- | +|*contents* | `(string\|bytes)` |- | + +### #Create Outputs + +_No output._ + +## #Glob + +### #Glob Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*glob* | `string` |- | +|*from* | `dagger.#Artifact` |- | + +### #Glob Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*filenames* | `_\|_` |trim suffix because ls always ends with newline | +|*files* | `string` |- | + +## #Read + +### #Read Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*filename* | `string` |- | +|*from* | `dagger.#Artifact` |- | + +### #Read Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*contents* | `string` |- | + +## #read + +### #read Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*path* | `string` |- | +|*from* | `dagger.#Artifact` |- | + +### #read Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*data* | `string` |- | diff --git a/docs/reference/universe/gcp.md b/docs/reference/universe/gcp.md new file mode 100644 index 00000000..09183ef1 --- /dev/null +++ b/docs/reference/universe/gcp.md @@ -0,0 +1,37 @@ +--- +sidebar_label: gcp +--- + +# dagger.io/gcp + +## #Config + +Base Google Cloud Config + +### #Config Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*region* | `string` |GCP region | +|*project* | `string` |GCP project | +|*serviceKey* | `dagger.#Secret` |GCP service key | + +### #Config Outputs + +_No output._ + +## #GCloud + +Re-usable gcloud component + +### #GCloud Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | + +### #GCloud Outputs + +_No output._ diff --git a/docs/reference/universe/gcp/gcr.md b/docs/reference/universe/gcp/gcr.md new file mode 100644 index 00000000..737b2c23 --- /dev/null +++ b/docs/reference/universe/gcp/gcr.md @@ -0,0 +1,23 @@ +--- +sidebar_label: gcr +--- + +# dagger.io/gcp/gcr + +## #Credentials + +Credentials retriever for GCR + +### #Credentials Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | + +### #Credentials Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*secret* | `string` |- | diff --git a/docs/reference/universe/gcp/gke.md b/docs/reference/universe/gcp/gke.md new file mode 100644 index 00000000..edb4b5e8 --- /dev/null +++ b/docs/reference/universe/gcp/gke.md @@ -0,0 +1,25 @@ +--- +sidebar_label: gke +--- + +# dagger.io/gcp/gke + +## #KubeConfig + +KubeConfig config outputs a valid kube-auth-config for kubectl client + +### #KubeConfig Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*config.region* | `string` |GCP region | +|*config.project* | `string` |GCP project | +|*config.serviceKey* | `dagger.#Secret` |GCP service key | +|*clusterName* | `string` |GKE cluster name | +|*version* | `*"v1.19.9" \| string` |Kubectl version | + +### #KubeConfig Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*kubeconfig* | `string` |kubeconfig is the generated kube configuration file | diff --git a/docs/reference/universe/git.md b/docs/reference/universe/git.md new file mode 100644 index 00000000..27c1fbc7 --- /dev/null +++ b/docs/reference/universe/git.md @@ -0,0 +1,53 @@ +--- +sidebar_label: git +--- + +# dagger.io/git + +## #CurrentBranch + +Get the name of the current checked out branch or tag + +### #CurrentBranch Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*repository* | `dagger.#Artifact` |- | + +### #CurrentBranch Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*name* | `string` |- | + +## #Repository + +A git repository + +### #Repository Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*remote* | `string` |Git remote. Example: "https://github.com/dagger/dagger" | +|*ref* | `string` |Git ref: can be a commit, tag or branch. Example: "main" | +|*subdir* | `*null \| string` |(optional) Subdirectory | + +### #Repository Outputs + +_No output._ + +## #Tags + +List tags of a repository + +### #Tags Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*repository* | `dagger.#Artifact` |- | + +### #Tags Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*tags* | `[]` |- | diff --git a/docs/reference/universe/go.md b/docs/reference/universe/go.md new file mode 100644 index 00000000..f128366e --- /dev/null +++ b/docs/reference/universe/go.md @@ -0,0 +1,70 @@ +--- +sidebar_label: go +--- + +# dagger.io/go + +## #Build + +### #Build Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*version* | `*"1.16" \| string` |Go version to use | +|*source* | `dagger.#Artifact` |Source Directory to build | +|*packages* | `*"." \| string` |Packages to build | +|*arch* | `*"amd64" \| string` |Target architecture | +|*os* | `*"linux" \| string` |Target OS | +|*tags* | `*"" \| string` |Build tags to use for building | +|*ldflags* | `*"" \| string` |LDFLAGS to use for linking | + +### #Build Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*output* | `string` |Specify the targeted binary name | + +## #Container + +A standalone go environment + +### #Container Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*version* | `*"1.16" \| string` |Go version to use | +|*source* | `dagger.#Artifact` |- | +|*image.from* | `"docker.io/golang:1.16-alpine"` |Remote ref (example: "index.docker.io/alpine:latest") | + +### #Container Outputs + +_No output._ + +## #Go + +### #Go Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*version* | `*"1.16" \| string` |Go version to use | +|*args* | `[]` |Arguments to the Go binary | +|*source* | `dagger.#Artifact` |Source Directory to build | + +### #Go Outputs + +_No output._ + +## #Test + +### #Test Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*version* | `*"1.16" \| string` |Go version to use | +|*source* | `dagger.#Artifact` |Source Directory to build | +|*packages* | `*"." \| string` |Packages to test | +|*args* | `["test", "-v", *"." \| string]` |Arguments to the Go binary | + +### #Test Outputs + +_No output._ diff --git a/docs/reference/universe/io.md b/docs/reference/universe/io.md new file mode 100644 index 00000000..6e66b9b3 --- /dev/null +++ b/docs/reference/universe/io.md @@ -0,0 +1,59 @@ +--- +sidebar_label: io +--- + +# dagger.io/io + +## #Dir + +Standard interface for directory operations in cue + +### #Dir Inputs + +_No input._ + +### #Dir Outputs + +_No output._ + +## #File + +Standard interface for file operations in cue + +### #File Inputs + +_No input._ + +### #File Outputs + +_No output._ + +## #ReadWriter + +### #ReadWriter Inputs + +_No input._ + +### #ReadWriter Outputs + +_No output._ + +## #Reader + +### #Reader Inputs + +_No input._ + +### #Reader Outputs + +_No output._ + +## #Writer + +### #Writer Inputs + +_No input._ + +### #Writer Outputs + +_No output._ diff --git a/docs/reference/universe/js.md b/docs/reference/universe/js.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/reference/universe/js/yarn.md b/docs/reference/universe/js/yarn.md new file mode 100644 index 00000000..05a1b2ef --- /dev/null +++ b/docs/reference/universe/js/yarn.md @@ -0,0 +1,31 @@ +--- +sidebar_label: yarn +--- + +# dagger.io/js/yarn + +Yarn is a package manager for Javascript applications +https://yarnpkg.com + +## #Package + +A Yarn package. + +### #Package Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*source* | `dagger.#Artifact` |Application source code | +|*package* | `struct` |Extra alpine packages to install | +|*cwd* | `*"." \| string` |working directory to use | +|*env* | `struct` |Environment variables | +|*writeEnvFile* | `*"" \| string` |Write the contents of `environment` to this file, in the "envfile" format. | +|*buildDir* | `*"build" \| string` |Read build output from this directory (path must be relative to working directory). | +|*script* | `*"build" \| string` |Run this yarn script | +|*args* | `*[] \| []` |Optional arguments for the script | + +### #Package Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*build* | `struct` |- | diff --git a/docs/reference/universe/kubernetes.md b/docs/reference/universe/kubernetes.md new file mode 100644 index 00000000..53365ef7 --- /dev/null +++ b/docs/reference/universe/kubernetes.md @@ -0,0 +1,31 @@ +--- +sidebar_label: kubernetes +--- + +# dagger.io/kubernetes + +## #Kubectl + +### #Kubectl Inputs + +_No input._ + +### #Kubectl Outputs + +_No output._ + +## #Resources + +Apply Kubernetes resources + +### #Resources Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*namespace* | `*"default" \| string` |Kubernetes Namespace to deploy to | +|*version* | `*"v1.19.9" \| string` |Version of kubectl client | +|*kubeconfig* | `dagger.#Secret` |Kube config file | + +### #Resources Outputs + +_No output._ diff --git a/docs/reference/universe/kubernetes/helm.md b/docs/reference/universe/kubernetes/helm.md new file mode 100644 index 00000000..15c2e983 --- /dev/null +++ b/docs/reference/universe/kubernetes/helm.md @@ -0,0 +1,27 @@ +--- +sidebar_label: helm +--- + +# dagger.io/kubernetes/helm + +## #Chart + +Install a Helm chart + +### #Chart Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*name* | `string` |Helm deployment name | +|*namespace* | `string` |Kubernetes Namespace to deploy to | +|*action* | `*"installOrUpgrade" \| "install" \| "upgrade"` |Helm action to apply | +|*timeout* | `*"5m" \| string` |time to wait for any individual Kubernetes operation (like Jobs for hooks) | +|*wait* | `*true \| bool` |if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state before marking the release as successful. It will wait for as long as timeout | +|*atomic* | `*true \| bool` |if set, installation process purges chart on fail. The wait option will be set automatically if atomic is used | +|*kubeconfig* | `dagger.#Secret` |Kube config file | +|*version* | `*"3.5.2" \| string` |Helm version | +|*kubectlVersion* | `*"v1.19.9" \| string` |Kubectl version | + +### #Chart Outputs + +_No output._ diff --git a/docs/reference/universe/kubernetes/kustomize.md b/docs/reference/universe/kubernetes/kustomize.md new file mode 100644 index 00000000..739bfa99 --- /dev/null +++ b/docs/reference/universe/kubernetes/kustomize.md @@ -0,0 +1,33 @@ +--- +sidebar_label: kustomize +--- + +# dagger.io/kubernetes/kustomize + +## #Kustomization + +### #Kustomization Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*version* | `*"v3.8.7" \| string` |Kustomize binary version | + +### #Kustomization Outputs + +_No output._ + +## #Kustomize + +Apply a Kubernetes Kustomize folder + +### #Kustomize Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*source* | `dagger.#Artifact` |Kubernetes source | +|*kustomization* | `string` |Optional Kustomization file | +|*version* | `*"v3.8.7" \| string` |Kustomize binary version | + +### #Kustomize Outputs + +_No output._ diff --git a/docs/reference/universe/netlify.md b/docs/reference/universe/netlify.md new file mode 100644 index 00000000..6b689ef1 --- /dev/null +++ b/docs/reference/universe/netlify.md @@ -0,0 +1,42 @@ +--- +sidebar_label: netlify +--- + +# dagger.io/netlify + +## #Account + +A Netlify account + +### #Account Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*name* | `*"" \| string` |Use this Netlify account name (also referred to as "team" in the Netlify docs) | +|*token* | `dagger.#Secret` |Netlify authentication token | + +### #Account Outputs + +_No output._ + +## #Site + +A Netlify site + +### #Site Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*account.name* | `*"" \| string` |Use this Netlify account name (also referred to as "team" in the Netlify docs) | +|*account.token* | `dagger.#Secret` |Netlify authentication token | +|*contents* | `dagger.#Artifact` |Contents of the application to deploy | +|*name* | `string` |Deploy to this Netlify site | +|*create* | `*true \| bool` |Create the Netlify site if it doesn't exist? | + +### #Site Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*url* | `string` |Website url | +|*deployUrl* | `string` |Unique Deploy URL | +|*logsUrl* | `string` |Logs URL for this deployment | diff --git a/docs/reference/universe/os.md b/docs/reference/universe/os.md new file mode 100644 index 00000000..d00d86f9 --- /dev/null +++ b/docs/reference/universe/os.md @@ -0,0 +1,49 @@ +--- +sidebar_label: os +--- + +# dagger.io/os + +## #Container + +Built-in container implementation, using buildkit + +### #Container Inputs + +_No input._ + +### #Container Outputs + +_No output._ + +## #Dir + +### #Dir Inputs + +_No input._ + +### #Dir Outputs + +_No output._ + +## #File + +Built-in file implementation, using buildkit + +### #File Inputs + +_No input._ + +### #File Outputs + +_No output._ + +## #ReadDir + +### #ReadDir Inputs + +_No input._ + +### #ReadDir Outputs + +_No output._ diff --git a/docs/reference/universe/random.md b/docs/reference/universe/random.md new file mode 100644 index 00000000..4a75dfe0 --- /dev/null +++ b/docs/reference/universe/random.md @@ -0,0 +1,33 @@ +--- +sidebar_label: random +--- + +# dagger.io/random + +Random generation utilities. + +Example: + +```cue +str: random.#String & { + seed: "str" + length: 10 +} +``` + +## #String + +Generate a random string + +### #String Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*seed* | `string` |Seed of the random string to generate. When using the same `seed`, the same random string will be generated because of caching. | +|*length* | `*12 \| number` |length of the string | + +### #String Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*out* | `string` |generated random string | diff --git a/docs/reference/universe/terraform.md b/docs/reference/universe/terraform.md new file mode 100644 index 00000000..2b7f39c8 --- /dev/null +++ b/docs/reference/universe/terraform.md @@ -0,0 +1,20 @@ +--- +sidebar_label: terraform +--- + +# dagger.io/terraform + +## #Configuration + +### #Configuration Inputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*version* | `*"latest" \| string` |- | +|*source* | `dagger.#Artifact` |- | + +### #Configuration Outputs + +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*output* | `struct` |- | diff --git a/stdlib/git/git.cue b/stdlib/git/git.cue index 2519c303..546bf236 100644 --- a/stdlib/git/git.cue +++ b/stdlib/git/git.cue @@ -10,7 +10,7 @@ import ( #Repository: { // Git remote. - // Example: "https://github.com/dagger/dagger") + // Example: "https://github.com/dagger/dagger" remote: string @dagger(input) // Git ref: can be a commit, tag or branch. diff --git a/stdlib/random/string.cue b/stdlib/random/string.cue index 7fe66ac1..882e2650 100644 --- a/stdlib/random/string.cue +++ b/stdlib/random/string.cue @@ -1,12 +1,16 @@ // Random generation utilities. // // Example: -// ``` +// +// ```cue // str: random.#String & { // seed: "str" // length: 10 // } // ``` +// +// +// package random import ( From 5537ab33de0d17e24df5364732044de55277b620 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 17:36:30 -0700 Subject: [PATCH 5/8] ci: add universe linting Signed-off-by: Andrea Luzzardi --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4f9022f..f76d55fb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: - name: Lint run: | - make shellcheck cuelint check-buildkit-version + make shellcheck cuelint check-buildkit-version universelint - name: Markdown Lint uses: nosborn/github-action-markdown-cli@v1.1.1 From 606398b69a7a8d754e365697ff0b4e90596db4de Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 18:33:39 -0700 Subject: [PATCH 6/8] docs: don't create docs file for empty packages Signed-off-by: Andrea Luzzardi --- cmd/dagger/cmd/doc.go | 12 ++++++------ docs/reference/universe/js.md | 0 2 files changed, 6 insertions(+), 6 deletions(-) delete mode 100644 docs/reference/universe/js.md diff --git a/cmd/dagger/cmd/doc.go b/cmd/dagger/cmd/doc.go index 5ec42c41..836423d0 100644 --- a/cmd/dagger/cmd/doc.go +++ b/cmd/dagger/cmd/doc.go @@ -327,12 +327,6 @@ func walkStdlib(ctx context.Context, output, format string) { return err } - f, err := os.Create(filepath) - if err != nil { - return err - } - defer f.Close() - pkg := fmt.Sprintf("dagger.io/%s", p) lg.Info().Str("package", pkg).Str("format", format).Msg("generating doc") val, err := loadCode(pkg) @@ -344,6 +338,12 @@ func walkStdlib(ctx context.Context, output, format string) { return err } + f, err := os.Create(filepath) + if err != nil { + return err + } + defer f.Close() + PrintDoc(ctx, f, pkg, val, format) return nil }) diff --git a/docs/reference/universe/js.md b/docs/reference/universe/js.md deleted file mode 100644 index e69de29b..00000000 From 940d9ccfeec5ab0692678255f349dbffac395cc9 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 18:40:08 -0700 Subject: [PATCH 7/8] docs: fix non-escaped URLs Signed-off-by: Andrea Luzzardi --- docs/reference/universe/dagger/op.md | 2 +- docs/reference/universe/git.md | 10 +++++----- docs/reference/universe/js/yarn.md | 1 - stdlib/dagger/op/op.cue | 8 +++----- stdlib/git/git.cue | 2 +- stdlib/js/yarn/yarn.cue | 1 - 6 files changed, 10 insertions(+), 14 deletions(-) diff --git a/docs/reference/universe/dagger/op.md b/docs/reference/universe/dagger/op.md index e5e051e6..d732b878 100644 --- a/docs/reference/universe/dagger/op.md +++ b/docs/reference/universe/dagger/op.md @@ -110,7 +110,7 @@ _No output._ ## #Op -One operation in a pipeline #Op does not current enforce the op spec at full resolution, to avoid triggering performance issues. See https://github.com/dagger/dagger/issues/445 To enforce the full #Op spec (see op_fullop.cue), run with "-t fullop" +One operation in a pipeline ### #Op Inputs diff --git a/docs/reference/universe/git.md b/docs/reference/universe/git.md index 27c1fbc7..b390e0d7 100644 --- a/docs/reference/universe/git.md +++ b/docs/reference/universe/git.md @@ -26,11 +26,11 @@ A git repository ### #Repository Inputs -| Name | Type | Description | -| ------------- |:-------------: |:-------------: | -|*remote* | `string` |Git remote. Example: "https://github.com/dagger/dagger" | -|*ref* | `string` |Git ref: can be a commit, tag or branch. Example: "main" | -|*subdir* | `*null \| string` |(optional) Subdirectory | +| Name | Type | Description | +| ------------- |:-------------: |:-------------: | +|*remote* | `string` |Git remote. Example: `"https://github.com/dagger/dagger"` | +|*ref* | `string` |Git ref: can be a commit, tag or branch. Example: "main" | +|*subdir* | `*null \| string` |(optional) Subdirectory | ### #Repository Outputs diff --git a/docs/reference/universe/js/yarn.md b/docs/reference/universe/js/yarn.md index 05a1b2ef..913fcd7e 100644 --- a/docs/reference/universe/js/yarn.md +++ b/docs/reference/universe/js/yarn.md @@ -5,7 +5,6 @@ sidebar_label: yarn # dagger.io/js/yarn Yarn is a package manager for Javascript applications -https://yarnpkg.com ## #Package diff --git a/stdlib/dagger/op/op.cue b/stdlib/dagger/op/op.cue index aeb94423..abcb023e 100644 --- a/stdlib/dagger/op/op.cue +++ b/stdlib/dagger/op/op.cue @@ -3,11 +3,9 @@ package op // One operation in a pipeline // -// #Op does not current enforce the op spec at full resolution, to avoid -// triggering performance issues. See -// https://github.com/dagger/dagger/issues/445 -// -// To enforce the full #Op spec (see op_fullop.cue), run with "-t fullop" +// FIXME: #Op does not current enforce the op spec at full resolution, to avoid +// FIXME: triggering performance issues. See https://github.com/dagger/dagger/issues/445 +// FIXME: To enforce the full #Op spec (see op_fullop.cue), run with "-t fullop" #Op: { do: string ... diff --git a/stdlib/git/git.cue b/stdlib/git/git.cue index 546bf236..f4eb40fe 100644 --- a/stdlib/git/git.cue +++ b/stdlib/git/git.cue @@ -10,7 +10,7 @@ import ( #Repository: { // Git remote. - // Example: "https://github.com/dagger/dagger" + // Example: `"https://github.com/dagger/dagger"` remote: string @dagger(input) // Git ref: can be a commit, tag or branch. diff --git a/stdlib/js/yarn/yarn.cue b/stdlib/js/yarn/yarn.cue index 47393166..20887bc7 100644 --- a/stdlib/js/yarn/yarn.cue +++ b/stdlib/js/yarn/yarn.cue @@ -1,5 +1,4 @@ // Yarn is a package manager for Javascript applications -// https://yarnpkg.com package yarn import ( From 6d5142aa673c9d0b1e45cef1b9a6c56dd9d32394 Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Tue, 8 Jun 2021 18:57:45 -0700 Subject: [PATCH 8/8] docs: use make docs to re-generate the docs Signed-off-by: Andrea Luzzardi --- .github/workflows/ci.yml | 2 +- Makefile | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f76d55fb..22dc496b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: - name: Lint run: | - make shellcheck cuelint check-buildkit-version universelint + make shellcheck cuelint check-buildkit-version docslint - name: Markdown Lint uses: nosborn/github-action-markdown-cli@v1.1.1 diff --git a/Makefile b/Makefile index 80286974..1e2cc1ba 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ shellcheck: shellcheck ./tests/*.bats ./tests/*.bash .PHONY: lint -lint: shellcheck cuelint golint check-buildkit-version universelint +lint: shellcheck cuelint golint check-buildkit-version docslint .PHONY: check-buildkit-version check-buildkit-version: @@ -50,15 +50,15 @@ integration: dagger-debug install: dagger go install ./cmd/dagger -.PHONY: universe -universe: dagger +.PHONY: docs +docs: dagger ./cmd/dagger/dagger doc --output ./docs/reference/universe --format md -.PHONY: universelint -universelint: universe +.PHONY: docslint +docslint: docs @test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference/universe | cut -d ' ' -f3 | tee /dev/stderr)" -.PHONY: docs -docs: +.PHONY: web +web: yarn --cwd "./website" install yarn --cwd "./website" start