Combine step and definition structures
This change combines the Step and StepDefinition structures.
In order to combine these structures, we also needed to generate the Go types from the JSON Schema (instead of the other way around). The schema generation library we were using couldn't hand recursion. And the schema is a better single source-of-truth anyway, so we want to write that by hand.
The first commit creates the new schema from scratch in the schema/v0
folder.
The second commit replaces schema/v1
with v0
so you can see how they relate to each other.
You can review it commit-wise for all together, whatever is the most clear for you.
Note this replaces the schema without breaking changes. So all existing tests pass. However it also allows us to expand easily into a few additional valid usecases. See the issue for details.
Fixes #103 (closed)
Merge request reports
Activity
assigned to @josephburnett
requested review from @cam_swords
added Category:Runner Core grouprunner labels
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
- Resolved by Joe Burnett
The file
schema/v1/constants.go
is as follows:package schema const ( yamlStringTag = "!!str" yamlMapTag = "!!map" delegate = "delegate" scriptStep = "https://gitlab.com/components/script@main" actionStep = "https://gitlab.com/components/action-runner@main" )
yamlStringTag
,yamlMapTag
, anddelegate
are no longer used.scriptStep
andactionStep
are only used in one place, I'd recommend inlining them and removingconstants.go
.- Resolved by Joe Burnett
- Resolved by Cameron Swords
- Resolved by Joe Burnett
- Resolved by Cameron Swords
- Resolved by Cameron Swords
@josephburnett, there's so much change here that I can't be sure if this is a breaking change or not. I'm not too worried though, Steps is barely experimental. It would have been easier for me to review this MR if it were split into multiple MRs, one to change how the JSON files are created, another to make the changes you want to the schema. All good, and maybe that's what you intended with the different commits anyway.
Breaking changes aside, I think the changes to the JSON spec are too permissive. That is, it allows too many invalid definitions. Could you please clarify exactly what use-cases you're trying to support?
added devopsverify sectionci labels
added 14 commits
- 8e1d5637...62e89609 - 4 earlier commits
- b18dc8a3 - Validate usecases recursively
- 4dcd1b9d - Usecase required properties
- 8b7bb120 - Rename CompileDefinition as Compile
- c8483e2b - Rename Makefile V0 as V1
- a4612f40 - Drop unused dir parameter
- 1822f2a5 - Remove and inline constants
- 02fd2ca3 - Delete unused SCHEMA_GEN and SCHEMA_SRC
- a0729136 - Update generated files
- c83caf4d - Add cmd and main.go to make go-fmt
- 4920dc24 - Go fmt after schema generate
Toggle commit list- Resolved by Cameron Swords
Thanks @josephburnett, a few more conversation topics
added 2 commits
requested review from @cam_swords
enabled an automatic merge when all merge checks for 1b1c75cb pass
Looks good, thanks @josephburnett
mentioned in commit 87bc52df
mentioned in merge request !119 (merged)