Skip to content

Commit

Permalink
docs/draft: change example in GitLab CBE guide
Browse files Browse the repository at this point in the history
This updates the draft GitLab CUE-By-Example guide so that the example
pipeline it imports/validates/regenerates is valid.

The previous example used by the guide, taken from the Flockademic
project, simply wasn't valid and wasn't a good choice of example. It was
originally selected from the set of examples mentioned in the GitLab CI
documentation because it was reasonably large, and therefore it was
likely to represent a superset of what most users would be doing in
their GitLab pipelines. Annoyingly, because of a typo noticed by
@unixsurfer in cue-labs/cue-by-example#39, the pipeline wasn't actually
being validated, so the example's inability to be validated wasn't
noticed before now. This didn't invalidate the guide for folks following
it with their own pipelines, it just meant that (a) the guide couldn't
be followed using the published example and (b) folks' own pipelines
wouldn't be validated against the upstream schema. Not great, of course,
but not technically /broken/ for real-world use.

The guide now uses GitLab's own pipeline file as its example:
https://gitlab.com/gitlab-org/gitlab/-/blob/3308936efcd70839cc61e0545dcb780756e4ec28/.gitlab-ci.yml

This example wasn't selected originally because (whilst it does exercise
a lot of different YAML syntaxes and GitLab features) it places most of
its job definitions behind "include" syntax which CUE doesn't support.
Thus the majority of the jobs mentioned in its preamble aren't vetted by
CUE. This doesn't feel signficant, as the validation that /is/ performed
is sufficient to prove that CUE can help users. Other examples linked to
by GitLab's documentation are extremely trivial, hence aren't useful.

Also:
- update upstream JSON Schema to its most recent definition;
- add an explicit cue-vet to help the user discover invalid pipelines
  earlier than a cue-cmd, which emits less useful diagnostics;
- re-enable the final diff check, so the entire guide is tested in CI.

The new state of the guide will be pushed upstream to CUE-By-Example
after this CL has been submitted.

Preview-Path: /docs/draft/cbe-005_gitlab_ci/
Signed-off-by: Jonathan Matthews <[email protected]>
Change-Id: I3ca61c12769d9d4b19da172d084eba244c654267
Dispatch-Trailer: {"type":"trybot","CL":1203460,"patchset":2,"ref":"refs/changes/60/1203460/2","targetBranch":"master"}
  • Loading branch information
jpluscplusm authored and cueckoo committed Nov 1, 2024
1 parent ae4479b commit 08cd40b
Show file tree
Hide file tree
Showing 5 changed files with 439 additions and 548 deletions.
Loading

0 comments on commit 08cd40b

Please sign in to comment.