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

feat(compute): clone starter kit source with init --from=serviceID #1213

Merged
merged 6 commits into from
May 31, 2024

Conversation

jsocol
Copy link
Member

@jsocol jsocol commented May 28, 2024

When we initialize an empty service with compute init --from=<serviceID>, we don't have the source code. This change attempts to look at the cloned_from metadata and use that to fetch the rest of the project.

When a service is created from a Starter Kit, running compute init
--from=serviceID gets the language and little else. This change fetches
the source code of the template that was used.
@jsocol jsocol marked this pull request as ready for review May 28, 2024 21:41
@jsocol jsocol requested a review from Integralist May 28, 2024 21:41
go.mod Outdated Show resolved Hide resolved
@kpfleming
Copy link
Contributor

The clone operation will pull the 'original' source directly from GitHub? Will it pull a specific commit hash to ensure that it gets the same thing that was used to initialize the service?

If it will be pulling directly from GitHub, the error handling will need to make that clear, since any failure on GitHub's part will make 'fastly compute init' fail and the user will assume it's a Fastly problem.

@fgsch fgsch changed the title feat(compute): clone starter kit source with init --from=serviceID feat(compute): clone starter kit source with init --from=FROM May 29, 2024
@fgsch fgsch changed the title feat(compute): clone starter kit source with init --from=FROM feat(compute): clone starter kit source with init --from=serviceID May 29, 2024
@fgsch
Copy link
Member

fgsch commented May 29, 2024

Sorry for changing the title of this PR. I should have looked a bit more but confused by the description (or lack of) for the --from parameter.

Could we mention the serviceID in here or this was omitted on purpose?

@Integralist Integralist added the enhancement New feature or request label May 29, 2024
Copy link
Collaborator

@Integralist Integralist left a comment

Choose a reason for hiding this comment

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

👋🏻

I feel like the --from=<ServiceID> feature is a bit misleading (dare I say... less than useful) or I guess I'm just generally a bit confused by its motivation/purpose 🤔

In my mind if I use --from=<ServiceID> then I'm expecting the code for that package to be made available to me so I can continuing developing the package. But from what I can tell this is just downloading the starter kit that the package was originally based on, and I'm not sure how that's useful.

Now if the original developer of the package had set --include-source as part of the fastly compute build subcommand, then I guess we might be able to extract the original source code from the uploaded package (e.g. download the package, and then extract code from the package.tar.gz file).

EDIT: I saw something internally that indicated this implementation might make sense when tied into something coming in the UI in the future.

@jsocol
Copy link
Member Author

jsocol commented May 29, 2024

Could we mention the serviceID in here or this was omitted on purpose?

Sorry, I'm not totally sure I follow. Mention it where, in the PR, or somewhere in code/messaging?

@fgsch
Copy link
Member

fgsch commented May 29, 2024

Could we mention the serviceID in here or this was omitted on purpose?

Sorry, I'm not totally sure I follow. Mention it where, in the PR, or somewhere in code/messaging?

In the help description:

  -f, --from=FROM            Local project directory, or Git repository URL,
                             or URL referencing a .zip/.tar.gz file, containing
                             a package template

Introduced two changes here, based on feedback and working with product:
1. Improved the wording of the messaging to stdout while fetching a
   package's starter kit source to make it clearer that's what's
   happening.
2. Only attempt to fetch the source if the service version is 1.
@jsocol jsocol requested review from Integralist and fgsch May 30, 2024 21:11
@jsocol
Copy link
Member Author

jsocol commented May 30, 2024

@Integralist @kpfleming @fgsch Updated with feedback addressed. After some internal discussions, there are three changes here:

  1. Messaging around fetching the starter kit source has changed to make it clearer that's what we're using
  2. Updated the logic to only fetch the source if the active version is 1
  3. Added details to the --help text that mention service IDs and the starter kits

Copy link
Collaborator

@Integralist Integralist left a comment

Choose a reason for hiding this comment

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

One small requested change, otherwise LGTM.

pkg/commands/compute/init.go Outdated Show resolved Hide resolved
@jsocol jsocol force-pushed the jsocol/PXENG-6448/clone-starter-kit-source branch from eb90f48 to da47c5f Compare May 31, 2024 13:49
@jsocol jsocol merged commit 6e24ef8 into main May 31, 2024
8 checks passed
@jsocol jsocol deleted the jsocol/PXENG-6448/clone-starter-kit-source branch May 31, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants