Skip to content

Feat/image builder api - #614

Merged
mohammad-alisafaee merged 27 commits into
kpack-resourcesfrom
feat/image-builder-api
Feb 18, 2025
Merged

mohammad-alisafaee merged 27 commits into
kpack-resourcesfrom
feat/image-builder-api

Conversation

@SalimKayal

@SalimKayal SalimKayal commented Jan 21, 2025 •

Copy link
Copy Markdown
Collaborator

Implementation for the new custom environments with build parameters.

TODO:

  • Connect to ShipWright
  • Clean up validation code to be in the same place

Comment on lines +355 to +357
$ref: "#/components/schemas/ContainerImage"
builder_id:
$ref: "#/components/schemas/ULID"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want a separate endpoint for creating builders and then have image and builder_id as properties here, or should they just be POST on this endpoint with a oneOf: body?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was one of the main questions. I am open to both. Waiting for input.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indirection adds complexity for clients. I do not think that we have an expectation of the relation going from {0,1}:1 to 1:N at any time. A "builder" belongs to a single session launcher.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it ? I'm currently unsure about all the implications. Let's discuss this in a technical meeting.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these endpoints. Now, BuildParameter is part of session launcher API.

@leafty leafty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments about the API spec:

Comment on lines +355 to +357
$ref: "#/components/schemas/ContainerImage"
builder_id:
$ref: "#/components/schemas/ULID"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indirection adds complexity for clients. I do not think that we have an expectation of the relation going from {0,1}:1 to 1:N at any time. A "builder" belongs to a single session launcher.

@leafty

leafty commented Jan 30, 2025

Copy link
Copy Markdown
Member

@m-alisafaee Can you fix the commit list? This PR is against kpack-resources, so either rebase from there or update the kpack-resources branch first. The changeset is not readable at the moment.

@mohammad-alisafaee
mohammad-alisafaee changed the base branch from kpack-resources to main January 30, 2025 08:37
@mohammad-alisafaee
mohammad-alisafaee changed the base branch from main to kpack-resources January 30, 2025 08:55

@leafty leafty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type union on EnvironmentPostInLauncher is nice 👍

I think the same should be done to Environment and EnvironmentPatchInLauncher because non-sensical values would be allowed.

@leafty leafty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 OK for api.spec.yaml 🙌

@mohammad-alisafaee
mohammad-alisafaee marked this pull request as ready for review February 12, 2025 08:23
@mohammad-alisafaee
mohammad-alisafaee requested a review from a team as a code owner February 12, 2025 08:23

@leafty leafty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment about the parameters 👇

@olevski olevski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor comments and questions.

)


def validate_build_parameters_patch(environment: apispec.BuildParametersPatch) -> models.BuildParametersPatch:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion(non-blocking): We do zero validation of the repository url. We can skip this in the interest of time but we should add something later on. Ideally it would be nice if we can validate if the repo exists. But if we dont go that far then it would be nice to validate if the shape of it is sensible.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, the UI validates the choices (needs to be a repository which responds to the probe API). We can at least validate that the repository is listed in the project in the backend here.

@leafty leafty left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[can be solved later] Sending a PATCH request to modify the description of the session launcher resets the session environment fields which is not desirable (the session cannot be launched).

@olevski
olevski self-requested a review February 17, 2025 10:49
@mohammad-alisafaee
mohammad-alisafaee merged commit 5752529 into kpack-resources Feb 18, 2025
@mohammad-alisafaee
mohammad-alisafaee deleted the feat/image-builder-api branch February 18, 2025 09:54
Panaetius pushed a commit that referenced this pull request Feb 19, 2025
Panaetius pushed a commit that referenced this pull request Feb 24, 2025
Panaetius pushed a commit that referenced this pull request Feb 28, 2025
Panaetius pushed a commit that referenced this pull request Mar 3, 2025
Panaetius pushed a commit that referenced this pull request Mar 5, 2025
leafty pushed a commit that referenced this pull request Mar 5, 2025
Panaetius pushed a commit that referenced this pull request Mar 6, 2025
leafty pushed a commit that referenced this pull request Mar 6, 2025
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.

5 participants