From a2088a09acad3af27e1f0db16ea46247d632e76f Mon Sep 17 00:00:00 2001 From: jffarge Date: Wed, 8 Sep 2021 15:19:19 +0200 Subject: [PATCH] docs: :recycle: merge API Reference and Universe menu entries Signed-off-by: jffarge --- Makefile | 4 ++-- docs/learn/1004-first-env.md | 11 ++++++---- docs/learn/1008-aws-cloudformation.md | 22 +++++++++++++------ docs/reference/{universe => }/README.md | 0 docs/reference/_category_.json | 2 +- docs/reference/{universe => }/alpine.md | 0 docs/reference/{universe => }/aws/README.md | 0 .../{universe => }/aws/cloudformation.md | 0 docs/reference/{universe => }/aws/ecr.md | 0 docs/reference/{universe => }/aws/ecs.md | 0 docs/reference/{universe => }/aws/eks.md | 0 docs/reference/{universe => }/aws/elb.md | 0 docs/reference/{universe => }/aws/rds.md | 0 docs/reference/{universe => }/aws/s3.md | 0 docs/reference/{universe => }/azure/README.md | 0 .../{universe => }/azure/resourcegroup.md | 0 .../reference/{universe => }/azure/storage.md | 0 .../reference/{universe => }/dagger/README.md | 0 docs/reference/{universe => }/dagger/op.md | 0 .../reference/{universe => }/docker/README.md | 0 .../{universe => }/docker/compose.md | 0 docs/reference/{universe => }/gcp/README.md | 0 docs/reference/{universe => }/gcp/cloudrun.md | 0 docs/reference/{universe => }/gcp/gcr.md | 0 docs/reference/{universe => }/gcp/gcs.md | 0 docs/reference/{universe => }/gcp/gke.md | 0 docs/reference/{universe => }/git.md | 0 docs/reference/{universe => }/go.md | 0 docs/reference/{universe => }/io.md | 0 docs/reference/{universe => }/java/maven.md | 0 docs/reference/{universe => }/js/yarn.md | 0 .../{universe => }/kubernetes/README.md | 0 .../{universe => }/kubernetes/helm.md | 0 .../{universe => }/kubernetes/kustomize.md | 0 docs/reference/{universe => }/netlify.md | 0 docs/reference/{universe => }/os.md | 0 docs/reference/{universe => }/random.md | 0 docs/reference/{universe => }/terraform.md | 0 docs/reference/universe/_category_.json | 3 --- docs/use-cases/1012-ci.md | 12 +++++----- website/netlify.toml | 2 +- 41 files changed, 32 insertions(+), 24 deletions(-) rename docs/reference/{universe => }/README.md (100%) rename docs/reference/{universe => }/alpine.md (100%) rename docs/reference/{universe => }/aws/README.md (100%) rename docs/reference/{universe => }/aws/cloudformation.md (100%) rename docs/reference/{universe => }/aws/ecr.md (100%) rename docs/reference/{universe => }/aws/ecs.md (100%) rename docs/reference/{universe => }/aws/eks.md (100%) rename docs/reference/{universe => }/aws/elb.md (100%) rename docs/reference/{universe => }/aws/rds.md (100%) rename docs/reference/{universe => }/aws/s3.md (100%) rename docs/reference/{universe => }/azure/README.md (100%) rename docs/reference/{universe => }/azure/resourcegroup.md (100%) rename docs/reference/{universe => }/azure/storage.md (100%) rename docs/reference/{universe => }/dagger/README.md (100%) rename docs/reference/{universe => }/dagger/op.md (100%) rename docs/reference/{universe => }/docker/README.md (100%) rename docs/reference/{universe => }/docker/compose.md (100%) rename docs/reference/{universe => }/gcp/README.md (100%) rename docs/reference/{universe => }/gcp/cloudrun.md (100%) rename docs/reference/{universe => }/gcp/gcr.md (100%) rename docs/reference/{universe => }/gcp/gcs.md (100%) rename docs/reference/{universe => }/gcp/gke.md (100%) rename docs/reference/{universe => }/git.md (100%) rename docs/reference/{universe => }/go.md (100%) rename docs/reference/{universe => }/io.md (100%) rename docs/reference/{universe => }/java/maven.md (100%) rename docs/reference/{universe => }/js/yarn.md (100%) rename docs/reference/{universe => }/kubernetes/README.md (100%) rename docs/reference/{universe => }/kubernetes/helm.md (100%) rename docs/reference/{universe => }/kubernetes/kustomize.md (100%) rename docs/reference/{universe => }/netlify.md (100%) rename docs/reference/{universe => }/os.md (100%) rename docs/reference/{universe => }/random.md (100%) rename docs/reference/{universe => }/terraform.md (100%) delete mode 100644 docs/reference/universe/_category_.json diff --git a/Makefile b/Makefile index 5b6de955..e62baa70 100644 --- a/Makefile +++ b/Makefile @@ -59,11 +59,11 @@ install: dagger .PHONY: docs docs: dagger - ./cmd/dagger/dagger doc --output ./docs/reference/universe --format md + ./cmd/dagger/dagger doc --output ./docs/reference --format md .PHONY: docslint docslint: docs - @test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference/universe | cut -d ' ' -f3 | tee /dev/stderr)" + @test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference | cut -d ' ' -f3 | tee /dev/stderr)" .PHONY: web web: diff --git a/docs/learn/1004-first-env.md b/docs/learn/1004-first-env.md index c1307338..0997f1f0 100644 --- a/docs/learn/1004-first-env.md +++ b/docs/learn/1004-first-env.md @@ -131,6 +131,7 @@ In Dagger terms, this component has two essential properties: Let's write the corresponding Cue code to a new file in our package: ```cue file=./tests/multibucket/source.cue title="todoapp/cue.mod/multibucket/source.cue" + ``` This code defines a component at the key `src` and specifies that it is both an artifact and an input. @@ -140,12 +141,13 @@ This code defines a component at the key `src` and specifies that it is both an The second component of our plan is the Yarn package built from the app source code: ```cue file=./tests/multibucket/yarn.cue title="todoapp/cue.mod/multibucket/yarn.cue" + ``` Let's break it down: - `package multibucket`: this file is part of the multibucket package -- `import ( "alpha.dagger.io/js/yarn" )`: import a package from the [Dagger Universe](../reference/universe/README.md). +- `import ( "alpha.dagger.io/js/yarn" )`: import a package from the [Dagger Universe](../reference/README.md). - `app: yarn.#Package`: apply the `#Package` definition at the key `app` - `&`: also merge the following values at the same key... - `{ source: src }`: set the key `app.source` to the value of `src`. This snippet of code connects our two components, forming the first link in our DAG @@ -159,12 +161,13 @@ _FIXME_: this section is not yet available because the [Amazon S3 package](https The third component of our plan is the Netlify site to which the app will be deployed: ```cue file=./tests/multibucket/netlify.cue title="todoapp/cue.mod/multibucket/netlify.cue" + ``` This component is very similar to the previous one: - We use the same package name as the other files -- We import another package from the [Dagger Universe](../reference/universe/README.md). +- We import another package from the [Dagger Universe](../reference/README.md). - `site: "netlify": site.#Netlify`: apply the `#Site` definition at the key `site.netlify`. Note the use of quotes to protect the key from name conflict. - `&`: also merge the following values at the same key... - `{ contents: app.build }`: set the key `site.netlify.contents` to the value of `app.build`. This line connects our components 2 and 3, forming the second link in our DAG. @@ -172,14 +175,14 @@ This component is very similar to the previous one: ### Exploring a package documentation But wait: how did we know what fields were available in `yarn.#Package` and `netlify.#Site`? -Answer: thanks to the `dagger doc` command, which prints the documentation of any package from [Dagger Universe](../reference/universe/README.md). +Answer: thanks to the `dagger doc` command, which prints the documentation of any package from [Dagger Universe](../reference/README.md). ```shell dagger doc alpha.dagger.io/netlify dagger doc alpha.dagger.io/js/yarn ``` -You can also browse the [Dagger Universe](../reference/universe/README.md) reference in the documentation. +You can also browse the [Dagger Universe](../reference/README.md) reference in the documentation. ## Setup the environment diff --git a/docs/learn/1008-aws-cloudformation.md b/docs/learn/1008-aws-cloudformation.md index 7884bcb4..a28a5596 100644 --- a/docs/learn/1008-aws-cloudformation.md +++ b/docs/learn/1008-aws-cloudformation.md @@ -18,7 +18,7 @@ The provisioning strategy detailed below follows S3 best practices. However, to #### Relays -The first thing to consider when developing a plan based on relays is to read their universe reference: it summarizes the expected inputs and their corresponding formats. [Here](../reference/universe/aws/cloudformation.md) is the Cloudformation one. +The first thing to consider when developing a plan based on relays is to read their universe reference: it summarizes the expected inputs and their corresponding formats. [Here](../reference/aws/cloudformation.md) is the Cloudformation one. ## Initialize a Dagger Workspace and Environment @@ -67,11 +67,12 @@ The idea here is to follow best practices in [S3 buckets](https://docs.aws.amazo Create a file named `template.cue` and add the following configuration to it. ```cue file=./tests/cloudformation/template.cue title="todoapp/cloudformation/template.cue" + ``` ##### 2. Cloudformation relay -As our plan relies on [Cloudformation's relay](../reference/universe/aws/cloudformation.md), let's dissect the expected inputs by gradually incorporating them into our plan. +As our plan relies on [Cloudformation's relay](../reference/aws/cloudformation.md), let's dissect the expected inputs by gradually incorporating them into our plan. ```shell dagger doc alpha.dagger.io/aws/cloudformation @@ -104,6 +105,7 @@ The config values are all part of the `aws` relay. Regarding this package, as yo Let's implement the first step, use the `aws.#Config` relay, and request its first inputs: the region to deploy and the AWS credentials. ```cue file=./tests/cloudformation/source-begin.cue title="todoapp/cloudformation/source.cue" + ``` This defines: @@ -146,6 +148,7 @@ dagger up -e cloudformation # Try to run the plan. As expected, we encounter a f Now that we have the `config` definition properly configured, let's modify the Cloudformation one: ```cue file=./tests/cloudformation/source-end.cue title="todoapp/cloudformation/source.cue" + ``` This defines: @@ -192,11 +195,11 @@ dagger input secret awsConfig.secretKey yourSecretKey -e cloudformation Finally ! We now have a working template ready to be used to provision S3 infrastructures. Let's deploy it: @@ -265,6 +268,7 @@ import Tabs from "@theme/Tabs"; import TabItem from "@theme/TabItem"; ```cue file=./tests/cloudformation/template/convert.cue title="todoapp/cloudformation/convert.cue" + ``` This defines: @@ -308,6 +312,7 @@ rm cloudformation/convert.cue Open `cloudformation/template.cue` and append below elements with copied Cue definition of the JSON: ```cue file=./tests/cloudformation/template/template-begin.cue title="todoapp/cloudformation/template.cue" + ``` We're using the built-in `json.Marshal` function to convert CUE back to JSON, so Cloudformation still receives the same template. @@ -323,11 +328,13 @@ Now that the template is defined in CUE, we can use the language to add more fle Let's define a re-usable `#Deployment` definition in `todoapp/cloudformation/deployment.cue`: ```cue file=./tests/cloudformation/template/deployment.cue title="todoapp/cloudformation/deployment.cue" + ``` `template.cue` can be rewritten as follows: ```cue file=./tests/cloudformation/template/template-end.cue title="todoapp/cloudformation/template.cue" + ``` Verify template @@ -360,6 +367,7 @@ dagger query template -f text -e cloudformation Reimplement `source.cue`: ```cue file=./tests/cloudformation/source-end.cue title="todoapp/cloudformation/source.cue" + ``` And we can now deploy it: diff --git a/docs/reference/universe/README.md b/docs/reference/README.md similarity index 100% rename from docs/reference/universe/README.md rename to docs/reference/README.md diff --git a/docs/reference/_category_.json b/docs/reference/_category_.json index ebb5aca6..5db33572 100644 --- a/docs/reference/_category_.json +++ b/docs/reference/_category_.json @@ -1,5 +1,5 @@ { - "label": "API Reference", + "label": "Universe - API Reference", "position": 5, "collapsed": false } diff --git a/docs/reference/universe/alpine.md b/docs/reference/alpine.md similarity index 100% rename from docs/reference/universe/alpine.md rename to docs/reference/alpine.md diff --git a/docs/reference/universe/aws/README.md b/docs/reference/aws/README.md similarity index 100% rename from docs/reference/universe/aws/README.md rename to docs/reference/aws/README.md diff --git a/docs/reference/universe/aws/cloudformation.md b/docs/reference/aws/cloudformation.md similarity index 100% rename from docs/reference/universe/aws/cloudformation.md rename to docs/reference/aws/cloudformation.md diff --git a/docs/reference/universe/aws/ecr.md b/docs/reference/aws/ecr.md similarity index 100% rename from docs/reference/universe/aws/ecr.md rename to docs/reference/aws/ecr.md diff --git a/docs/reference/universe/aws/ecs.md b/docs/reference/aws/ecs.md similarity index 100% rename from docs/reference/universe/aws/ecs.md rename to docs/reference/aws/ecs.md diff --git a/docs/reference/universe/aws/eks.md b/docs/reference/aws/eks.md similarity index 100% rename from docs/reference/universe/aws/eks.md rename to docs/reference/aws/eks.md diff --git a/docs/reference/universe/aws/elb.md b/docs/reference/aws/elb.md similarity index 100% rename from docs/reference/universe/aws/elb.md rename to docs/reference/aws/elb.md diff --git a/docs/reference/universe/aws/rds.md b/docs/reference/aws/rds.md similarity index 100% rename from docs/reference/universe/aws/rds.md rename to docs/reference/aws/rds.md diff --git a/docs/reference/universe/aws/s3.md b/docs/reference/aws/s3.md similarity index 100% rename from docs/reference/universe/aws/s3.md rename to docs/reference/aws/s3.md diff --git a/docs/reference/universe/azure/README.md b/docs/reference/azure/README.md similarity index 100% rename from docs/reference/universe/azure/README.md rename to docs/reference/azure/README.md diff --git a/docs/reference/universe/azure/resourcegroup.md b/docs/reference/azure/resourcegroup.md similarity index 100% rename from docs/reference/universe/azure/resourcegroup.md rename to docs/reference/azure/resourcegroup.md diff --git a/docs/reference/universe/azure/storage.md b/docs/reference/azure/storage.md similarity index 100% rename from docs/reference/universe/azure/storage.md rename to docs/reference/azure/storage.md diff --git a/docs/reference/universe/dagger/README.md b/docs/reference/dagger/README.md similarity index 100% rename from docs/reference/universe/dagger/README.md rename to docs/reference/dagger/README.md diff --git a/docs/reference/universe/dagger/op.md b/docs/reference/dagger/op.md similarity index 100% rename from docs/reference/universe/dagger/op.md rename to docs/reference/dagger/op.md diff --git a/docs/reference/universe/docker/README.md b/docs/reference/docker/README.md similarity index 100% rename from docs/reference/universe/docker/README.md rename to docs/reference/docker/README.md diff --git a/docs/reference/universe/docker/compose.md b/docs/reference/docker/compose.md similarity index 100% rename from docs/reference/universe/docker/compose.md rename to docs/reference/docker/compose.md diff --git a/docs/reference/universe/gcp/README.md b/docs/reference/gcp/README.md similarity index 100% rename from docs/reference/universe/gcp/README.md rename to docs/reference/gcp/README.md diff --git a/docs/reference/universe/gcp/cloudrun.md b/docs/reference/gcp/cloudrun.md similarity index 100% rename from docs/reference/universe/gcp/cloudrun.md rename to docs/reference/gcp/cloudrun.md diff --git a/docs/reference/universe/gcp/gcr.md b/docs/reference/gcp/gcr.md similarity index 100% rename from docs/reference/universe/gcp/gcr.md rename to docs/reference/gcp/gcr.md diff --git a/docs/reference/universe/gcp/gcs.md b/docs/reference/gcp/gcs.md similarity index 100% rename from docs/reference/universe/gcp/gcs.md rename to docs/reference/gcp/gcs.md diff --git a/docs/reference/universe/gcp/gke.md b/docs/reference/gcp/gke.md similarity index 100% rename from docs/reference/universe/gcp/gke.md rename to docs/reference/gcp/gke.md diff --git a/docs/reference/universe/git.md b/docs/reference/git.md similarity index 100% rename from docs/reference/universe/git.md rename to docs/reference/git.md diff --git a/docs/reference/universe/go.md b/docs/reference/go.md similarity index 100% rename from docs/reference/universe/go.md rename to docs/reference/go.md diff --git a/docs/reference/universe/io.md b/docs/reference/io.md similarity index 100% rename from docs/reference/universe/io.md rename to docs/reference/io.md diff --git a/docs/reference/universe/java/maven.md b/docs/reference/java/maven.md similarity index 100% rename from docs/reference/universe/java/maven.md rename to docs/reference/java/maven.md diff --git a/docs/reference/universe/js/yarn.md b/docs/reference/js/yarn.md similarity index 100% rename from docs/reference/universe/js/yarn.md rename to docs/reference/js/yarn.md diff --git a/docs/reference/universe/kubernetes/README.md b/docs/reference/kubernetes/README.md similarity index 100% rename from docs/reference/universe/kubernetes/README.md rename to docs/reference/kubernetes/README.md diff --git a/docs/reference/universe/kubernetes/helm.md b/docs/reference/kubernetes/helm.md similarity index 100% rename from docs/reference/universe/kubernetes/helm.md rename to docs/reference/kubernetes/helm.md diff --git a/docs/reference/universe/kubernetes/kustomize.md b/docs/reference/kubernetes/kustomize.md similarity index 100% rename from docs/reference/universe/kubernetes/kustomize.md rename to docs/reference/kubernetes/kustomize.md diff --git a/docs/reference/universe/netlify.md b/docs/reference/netlify.md similarity index 100% rename from docs/reference/universe/netlify.md rename to docs/reference/netlify.md diff --git a/docs/reference/universe/os.md b/docs/reference/os.md similarity index 100% rename from docs/reference/universe/os.md rename to docs/reference/os.md diff --git a/docs/reference/universe/random.md b/docs/reference/random.md similarity index 100% rename from docs/reference/universe/random.md rename to docs/reference/random.md diff --git a/docs/reference/universe/terraform.md b/docs/reference/terraform.md similarity index 100% rename from docs/reference/universe/terraform.md rename to docs/reference/terraform.md diff --git a/docs/reference/universe/_category_.json b/docs/reference/universe/_category_.json deleted file mode 100644 index a7715dec..00000000 --- a/docs/reference/universe/_category_.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "label": "Universe" -} diff --git a/docs/use-cases/1012-ci.md b/docs/use-cases/1012-ci.md index 8d4c3fd8..7d636390 100644 --- a/docs/use-cases/1012-ci.md +++ b/docs/use-cases/1012-ci.md @@ -22,7 +22,7 @@ Dagger is the perfect tool for CI workflows. frontend? The backend won't be built again. - **Composable & Reusable**. Define re-usable steps and [share](../learn/1010-dev-cue-package.md) them across all your projects. Or with the world. Dagger - ships with [dozens of re-usable components](../reference/universe/README.md) + ships with [dozens of re-usable components](../reference/README.md) ## Example @@ -71,9 +71,9 @@ lint: os.#Container & { The configuration above defines: - **source** code of the project. More on this later. -- **test** *task* which executes `go test` inside the source artifact +- **test** _task_ which executes `go test` inside the source artifact using the `golang` Docker image -- **lint** *task* which executes `golangci-lint` inside the source artifact +- **lint** _task_ which executes `golangci-lint` inside the source artifact using the `golangci-lint` Docker image. Before we can execute the configuration, we need to set up the Dagger workspace and environment. @@ -118,7 +118,7 @@ integration with GitHub easier. Dagger workflows scale really well with CI complexity. The following example illustrates how to test two different projects in the same -repository: a *Node* frontend (located in *./frontend*) along with a *Go* backend (located in *./backend*). +repository: a _Node_ frontend (located in _./frontend_) along with a _Go_ backend (located in _./backend_). From the project repository, update the file named `ci/main.cue` with the following configuration. @@ -180,7 +180,7 @@ frontend: { Larger configurations can be split into multiple files, for example `backend.cue` and `frontend.cue` ::: -The configuration above defines a *frontend* and *backend* structure, each +The configuration above defines a _frontend_ and _backend_ structure, each containing: - A **code** directory, defined as a subdirectory of **source** @@ -199,5 +199,5 @@ $ dagger up `frontend.test` and `backend.test` are running in parallel since there are no dependencies between each other. -If you were to make changes to the *./frontend* directory, only +If you were to make changes to the _./frontend_ directory, only `frontend.test` will be executed. diff --git a/website/netlify.toml b/website/netlify.toml index 04f6ca49..74759735 100644 --- a/website/netlify.toml +++ b/website/netlify.toml @@ -47,5 +47,5 @@ status = 200 [[redirects]] from = "/reference" -to = "/reference/universe/alpine" +to = "/reference/alpine" status = 302