Skip to content

Commit

Permalink
docs/draft: align cue-by-examples with upstream
Browse files Browse the repository at this point in the history
This aligns some unpublished cue-by-example guides (that are exercised
in CI) with their upstream forms, as of
cue-labs/cue-by-example#38.

Signed-off-by: Jonathan Matthews <[email protected]>
Change-Id: Ide585b28c627c0eeac96389ed68b4d5bd06b8c3d
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1203334
TryBot-Result: CUEcueckoo <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
  • Loading branch information
jpluscplusm committed Oct 31, 2024
1 parent 2335aa3 commit 9e7d46a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
8 changes: 4 additions & 4 deletions content/docs/draft/cbe-005_gitlab_ci/en.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ know you're managing your pipelines with CUE.

| :exclamation: WARNING :exclamation: |
|:--------------------------------------- |
| This guide requires that you use `cue` version `v0.11.0-alpha.2` or later. **The process described below won't work with earlier versions**. Check the version of your `cue` command by running `cue version`, and [upgrade it](https://cuelang.org/dl) if needed.
| This guide requires that you use `cue` version `v0.11.0-alpha.4` or later. **The process described below won't work with earlier versions**. Check the version of your `cue` command by running `cue version`, and [upgrade it](https://cuelang.org/dl) if needed.

## Prerequisites

Expand Down Expand Up @@ -185,8 +185,8 @@ Convert the GitLab schema from JSON Schema to CUE:

:computer: `terminal`
{{{with script "en" "9"}}}
cue import jsonschema+strictFeatures=0: \
internal/ci/gitlab/gitlab.cicd.pipeline.schema.json -p gitlab -l '#Pipeline:'
cue import -p gitlab -l '#Pipeline:' \
internal/ci/gitlab/gitlab.cicd.pipeline.schema.json
{{{end}}}

This command will create the file `internal/ci/gitlab/gitlab.cicd.pipeline.schema.cue`
Expand Down Expand Up @@ -298,7 +298,7 @@ diff ../12.expected.txt ../12.actual.txt

| :exclamation: WARNING :exclamation: |
|:--------------------------------------- |
| If you *don't* see the usage explanation for the `regenerate` workflow command (or if you receive an error message) then **either** your workflow command isn't set up as CUE requires, **or** you're running a CUE version older than `v0.11.0-alpha.2`. If you've [upgraded to at least that version](https://cuelang.org/dl) but the usage explanation still isn't being displayed then: (1) double check the contents of the `ci_tool.cue` file and the modifications you made to it; (2) make sure its location in the repository is precisely as given in this guide; (3) ensure the filename is *exactly* `ci_tool.cue`; (4) run `cue vet ./internal/ci/gitlab` and check that your pipelines actually validate successfully - in other words: were they truly valid before you even started this process? Lastly, make sure you've followed all the steps in this guide, and that you invoked the `cue help` command from the repository's root directory. If you get really stuck, please come and join [the CUE community](https://cuelang.org/community/) and ask for some help!
| If you *don't* see the usage explanation for the `regenerate` workflow command (or if you receive an error message) then **either** your workflow command isn't set up as CUE requires, **or** you're running a CUE version older than `v0.11.0-alpha.4`. If you've [upgraded to at least that version](https://cuelang.org/dl) but the usage explanation still isn't being displayed then: (1) double check the contents of the `ci_tool.cue` file and the modifications you made to it; (2) make sure its location in the repository is precisely as given in this guide; (3) ensure the filename is *exactly* `ci_tool.cue`; (4) run `cue vet ./internal/ci/gitlab` and check that your pipelines actually validate successfully - in other words: were they truly valid before you even started this process? Lastly, make sure you've followed all the steps in this guide, and that you invoked the `cue help` command from the repository's root directory. If you get really stuck, please come and join [the CUE community](https://cuelang.org/community/) and ask for some help!

#### :arrow_right: Regenerate the YAML pipeline file

Expand Down
6 changes: 3 additions & 3 deletions content/docs/draft/cbe-005_gitlab_ci/gen_cache.cue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package site
"14": "U3CbYQ0viVRaklzhlEknDxcUj4/DtH1Ugwo7WxdCzl8="
}
multi_step: {
hash: "1DE0U0BJVH0AIG8PBUF44NKCQC4GS1OM1G08S58CNQ3TUQ0KHM4G===="
scriptHash: "3S2NSE10ODTS7RUIO4HH6AJ2FNNJ5GPL1MQO8322VK0U5DN4QCUG===="
hash: "1IDAPD6OR11PR9O62REVB4P8R0U7PJ4IVBL79K13OCLNCVCD7P3G===="
scriptHash: "IVS5FP8VISFOJ2PF93OMKF2470LMT73GR58B5A29UT9N93GFK4OG===="
steps: [{
doc: """
# Required because v0.10.0 suffers from https://cuelang.org/issue/3462, which
Expand Down Expand Up @@ -144,7 +144,7 @@ package site
output: ""
}, {
doc: ""
cmd: "cue import jsonschema+strictFeatures=0: internal/ci/gitlab/gitlab.cicd.pipeline.schema.json -p gitlab -l '#Pipeline:'"
cmd: "cue import -p gitlab -l '#Pipeline:' internal/ci/gitlab/gitlab.cicd.pipeline.schema.json"
exitCode: 0
output: ""
}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ mv ./.buildkite/*.cue internal/ci/buildkite
### Validate workflows

<!-- TODO: upstream JSONSchema isn't usable
cf. https://github.com/cue-lang/cue/issues/2698
cf. https://github.com/cue-lang/cue/issues/2699
#### :arrow_right: Fetch a pipeline schema
Expand All @@ -191,7 +190,8 @@ place it in the `internal/ci/buildkite` directory:
:computer: `terminal`
```sh
curl -o internal/ci/buildkite/buildkite.pipeline.schema.json https://raw.githubusercontent.com/buildkite/pipeline-schema/6396f68d5e983e0d2acbf829c565027a4cfd69bc/schema.json
curl -o internal/ci/buildkite/buildkite.pipeline.schema.json \
https://raw.githubusercontent.com/buildkite/pipeline-schema/6396f68d5e983e0d2acbf829c565027a4cfd69bc/schema.json
```
We use a specific commit from the upstream repository to make sure that this
Expand Down Expand Up @@ -230,7 +230,7 @@ package buildkite

| :grey_exclamation: Info :grey_exclamation: |
|:------------------------------------------- |
| It would be great if we could use [Buildkite's authoritative pipeline schema](https://github.com/buildkite/pipeline-schema) here. Unfortunately, CUE's JSONSchema support can't currently import it. This is being tracked in CUE Issues [#2698](https://github.com/cue-lang/cue/issues/2698) and [#2699](https://github.com/cue-lang/cue/issues/2699), and this guide should be updated once the schema is useable.
| It would be great if we could use [Buildkite's authoritative pipeline schema](https://github.com/buildkite/pipeline-schema) here. Unfortunately, CUE's JSONSchema support can't currently import it. This is being tracked in issue [#2699](https://github.com/cue-lang/cue/issues/2699), and this guide will be updated when the upstream schema can be used.

#### :arrow_right: Apply the schema

Expand Down
8 changes: 4 additions & 4 deletions hugo/content/en/docs/draft/cbe-005_gitlab_ci/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ know you're managing your pipelines with CUE.

| :exclamation: WARNING :exclamation: |
|:--------------------------------------- |
| This guide requires that you use `cue` version `v0.11.0-alpha.2` or later. **The process described below won't work with earlier versions**. Check the version of your `cue` command by running `cue version`, and [upgrade it](https://cuelang.org/dl) if needed.
| This guide requires that you use `cue` version `v0.11.0-alpha.4` or later. **The process described below won't work with earlier versions**. Check the version of your `cue` command by running `cue version`, and [upgrade it](https://cuelang.org/dl) if needed.

## Prerequisites

Expand Down Expand Up @@ -157,8 +157,8 @@ process is reproducible.
Convert the GitLab schema from JSON Schema to CUE:

:computer: `terminal`
```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGltcG9ydCBqc29uc2NoZW1hK3N0cmljdEZlYXR1cmVzPTA6IGludGVybmFsL2NpL2dpdGxhYi9naXRsYWIuY2ljZC5waXBlbGluZS5zY2hlbWEuanNvbiAtcCBnaXRsYWIgLWwgJyNQaXBlbGluZTon" }
$ cue import jsonschema+strictFeatures=0: internal/ci/gitlab/gitlab.cicd.pipeline.schema.json -p gitlab -l '#Pipeline:'
```text { title="TERMINAL" type="terminal" codeToCopy="Y3VlIGltcG9ydCAtcCBnaXRsYWIgLWwgJyNQaXBlbGluZTonIGludGVybmFsL2NpL2dpdGxhYi9naXRsYWIuY2ljZC5waXBlbGluZS5zY2hlbWEuanNvbg==" }
$ cue import -p gitlab -l '#Pipeline:' internal/ci/gitlab/gitlab.cicd.pipeline.schema.json
```

This command will create the file `internal/ci/gitlab/gitlab.cicd.pipeline.schema.cue`
Expand Down Expand Up @@ -267,7 +267,7 @@ Usage:
{{< /code-tab >}}{{< /code-tabs >}}
| :exclamation: WARNING :exclamation: |
|:--------------------------------------- |
| If you *don't* see the usage explanation for the `regenerate` workflow command (or if you receive an error message) then **either** your workflow command isn't set up as CUE requires, **or** you're running a CUE version older than `v0.11.0-alpha.2`. If you've [upgraded to at least that version](https://cuelang.org/dl) but the usage explanation still isn't being displayed then: (1) double check the contents of the `ci_tool.cue` file and the modifications you made to it; (2) make sure its location in the repository is precisely as given in this guide; (3) ensure the filename is *exactly* `ci_tool.cue`; (4) run `cue vet ./internal/ci/gitlab` and check that your pipelines actually validate successfully - in other words: were they truly valid before you even started this process? Lastly, make sure you've followed all the steps in this guide, and that you invoked the `cue help` command from the repository's root directory. If you get really stuck, please come and join [the CUE community](https://cuelang.org/community/) and ask for some help!
| If you *don't* see the usage explanation for the `regenerate` workflow command (or if you receive an error message) then **either** your workflow command isn't set up as CUE requires, **or** you're running a CUE version older than `v0.11.0-alpha.4`. If you've [upgraded to at least that version](https://cuelang.org/dl) but the usage explanation still isn't being displayed then: (1) double check the contents of the `ci_tool.cue` file and the modifications you made to it; (2) make sure its location in the repository is precisely as given in this guide; (3) ensure the filename is *exactly* `ci_tool.cue`; (4) run `cue vet ./internal/ci/gitlab` and check that your pipelines actually validate successfully - in other words: were they truly valid before you even started this process? Lastly, make sure you've followed all the steps in this guide, and that you invoked the `cue help` command from the repository's root directory. If you get really stuck, please come and join [the CUE community](https://cuelang.org/community/) and ask for some help!

#### :arrow_right: Regenerate the YAML pipeline file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ $ mv ./.buildkite/*.cue internal/ci/buildkite
### Validate workflows

<!-- TODO: upstream JSONSchema isn't usable
cf. https://github.com/cue-lang/cue/issues/2698
cf. https://github.com/cue-lang/cue/issues/2699
#### :arrow_right: Fetch a pipeline schema
Expand All @@ -165,7 +164,8 @@ place it in the `internal/ci/buildkite` directory:
:computer: `terminal`
```sh
curl -o internal/ci/buildkite/buildkite.pipeline.schema.json https://raw.githubusercontent.com/buildkite/pipeline-schema/6396f68d5e983e0d2acbf829c565027a4cfd69bc/schema.json
curl -o internal/ci/buildkite/buildkite.pipeline.schema.json \
https://raw.githubusercontent.com/buildkite/pipeline-schema/6396f68d5e983e0d2acbf829c565027a4cfd69bc/schema.json
```
We use a specific commit from the upstream repository to make sure that this
Expand Down Expand Up @@ -204,7 +204,7 @@ package buildkite

| :grey_exclamation: Info :grey_exclamation: |
|:------------------------------------------- |
| It would be great if we could use [Buildkite's authoritative pipeline schema](https://github.com/buildkite/pipeline-schema) here. Unfortunately, CUE's JSONSchema support can't currently import it. This is being tracked in CUE Issues [#2698](https://github.com/cue-lang/cue/issues/2698) and [#2699](https://github.com/cue-lang/cue/issues/2699), and this guide should be updated once the schema is useable.
| It would be great if we could use [Buildkite's authoritative pipeline schema](https://github.com/buildkite/pipeline-schema) here. Unfortunately, CUE's JSONSchema support can't currently import it. This is being tracked in issue [#2699](https://github.com/cue-lang/cue/issues/2699), and this guide will be updated when the upstream schema can be used.

#### :arrow_right: Apply the schema

Expand Down

0 comments on commit 9e7d46a

Please sign in to comment.