Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(yaml): allow for users to parse pipelines using old library #1220

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ecrupper
Copy link
Contributor

@ecrupper ecrupper commented Nov 5, 2024

Background

It is imperative that the platform moves away from the buildkite YAML library, as it is archived.

This has been attempted and reverted a couple times:

(2024, go-yaml v3) go-vela/types#386 —> go-vela/types#392

(2020, goccy) go-vela/types#118 —> go-vela/types#144

This PR ensures that we will not have to revert this important change, as it will allow for users to immediately set

version: "legacy"

At the top level of their pipeline file (or template file) if they are encountering unexpected YAML issues.

This will also allow for troubleshooting / triaging for the Vela admins to cover all of our bases when shifting to this new library while having low impact.

The goal is to revert this change in a later release so that the entire platform uses only one YAML parser throughout the code base.

What's in the PR

  • new packages compiler/types/yaml/yaml and compiler/types/yaml/buildkite in place of the single compiler/types/yaml
  • all the buildkite YAML types have a ToYAML() method that will convert to the go-yaml version. Once the pipelines have been unmarshaled, these two objects should be identical sans their type.
  • an internal/yaml.go file that grabs the version from the pipeline file and verifies the library we should use.

@ecrupper ecrupper marked this pull request as ready for review November 5, 2024 22:05
@ecrupper ecrupper requested a review from a team as a code owner November 5, 2024 22:05
Copy link

codecov bot commented Nov 5, 2024

Codecov Report

Attention: Patch coverage is 72.95308% with 294 lines in your changes missing coverage. Please review.

Project coverage is 57.37%. Comparing base (9a4003b) to head (23205cd).

Files with missing lines Patch % Lines
compiler/types/yaml/buildkite/secret.go 72.72% 49 Missing and 2 partials ⚠️
compiler/types/yaml/buildkite/template.go 43.75% 36 Missing ⚠️
compiler/types/yaml/buildkite/step.go 65.68% 34 Missing and 1 partial ⚠️
compiler/types/yaml/buildkite/service.go 65.90% 28 Missing and 2 partials ⚠️
compiler/types/yaml/buildkite/ruleset.go 81.81% 28 Missing ⚠️
compiler/types/yaml/buildkite/stage.go 19.23% 21 Missing ⚠️
compiler/types/yaml/buildkite/metadata.go 66.10% 20 Missing ⚠️
compiler/types/yaml/buildkite/ulimit.go 80.61% 19 Missing ⚠️
compiler/types/yaml/buildkite/volume.go 79.78% 19 Missing ⚠️
compiler/types/yaml/buildkite/build.go 76.62% 16 Missing and 2 partials ⚠️
... and 3 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1220      +/-   ##
==========================================
+ Coverage   56.87%   57.37%   +0.49%     
==========================================
  Files         599      611      +12     
  Lines       32869    33936    +1067     
==========================================
+ Hits        18695    19471     +776     
- Misses      13538    13819     +281     
- Partials      636      646      +10     
Files with missing lines Coverage Δ
api/pipeline/template.go 0.00% <ø> (ø)
api/types/string.go 80.64% <ø> (ø)
compiler/native/clone.go 100.00% <ø> (ø)
compiler/native/compile.go 71.39% <ø> (+0.73%) ⬆️
compiler/native/environment.go 86.75% <ø> (ø)
compiler/native/expand.go 69.20% <ø> (ø)
compiler/native/initialize.go 100.00% <ø> (ø)
compiler/native/parse.go 85.00% <100.00%> (-0.37%) ⬇️
compiler/native/script.go 95.23% <ø> (ø)
compiler/native/substitute.go 70.00% <ø> (ø)
... and 29 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant