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

Adding Extension config #489

Merged

Conversation

pacostas
Copy link
Contributor

@pacostas pacostas commented Apr 27, 2023

Summary

This PR adds the Extension Config structure similar to what is for Buildpack Config structure https://github.com/paketo-buildpacks/packit/blob/v2/cargo/config.go , but for extensions.

Use Cases

With these changes someone can use the extension config to parse and manipulate extension.toml files. For example the developer can use the NewExtensionParser from the cargo repo to create an ExtensionParser, parse an extension.toml file and manipulate it.

	extensionConfigParser := cargo.NewExtensionParser()
	config, err := extensionConfigParser.Parse(extensionTOMLPath)
	if err != nil {
		return fmt.Errorf("failed to parse extension.toml file : %s", err)
	}

	config.Extension.Version = flags.version

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@pacostas pacostas marked this pull request as ready for review May 2, 2023 12:06
@pacostas pacostas requested a review from a team as a code owner May 2, 2023 12:06
@pacostas
Copy link
Contributor Author

pacostas commented May 2, 2023

I havent added the MarshalJSON and the UnmarshalJSON as I cant see these methods being used somewhere. If that's not the case, let me know to add them with a further commit :)

@robdimsdale robdimsdale force-pushed the parsing-extension-config branch from b160984 to 055457f Compare May 2, 2023 19:00
@robdimsdale robdimsdale added the semver:minor A change requiring a minor version bump label May 2, 2023
@robdimsdale
Copy link
Member

This looks good to me. I'd like one more tooling maintainer to take a look and if they're happy with it this can be merged.

For posterity: I was initially unsure of the value of creating a separate config, but I do see that some fields are different (e.g. there's the top-level [extension] object) so I think this change makes sense. I don't think it's valuable to try to use generics for this - they're separate objects with separate fields. If we find there is complex behavioral overlap in the future we can explore generics.

@sophiewigmore sophiewigmore merged commit 1dd83ed into paketo-buildpacks:v2 May 2, 2023
@pacostas pacostas deleted the parsing-extension-config branch June 14, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:minor A change requiring a minor version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants