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

breaking(compute/pack): use package name from manifest #1025

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

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Sep 29, 2023

The fastly compute deploy command expects the package file to be named the same as the name attribute in the fastly.toml manifest. The fastly compute pack command does not do this, it instead names the package file package.tar.gz and consequently this causes the deploy command to fail.

NOTE: It was probably assumed that if a user was using compute pack they might not be using the CLI for developing an application, so we shouldn't expect them to have a fastly.toml manifest present. In this PR we presume a manifest is present by default and fallback to using package.tar.gz otherwise.

@Integralist Integralist added the bug Something isn't working label Sep 29, 2023
@@ -44,8 +45,13 @@ func (c *PackCommand) Exec(_ io.Reader, out io.Writer) (err error) {
return err
}

filename := sanitize.BaseName(c.manifest.File.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: I think this is a breaking change as it changes what the default output destination is for this command

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would argue that because the existing behaviour doesn't work with fastly compute deploy (†) that this isn't a breaking change and is fixing broken behaviour.

† The reporter of the issue, an internal report, identified that the compute deploy command looks for the package to be named the same as the name field from the manifest (otherwise it returns an error).

@joeshaw would you concur or do you think this should be a new major release?

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong opinion. To what extent do we consider the directory and package names to be exported API? Do external tools consume this that we're aware of? That's the thing that'd be the determining factor to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Terraform configurations will need to be updated if they are relying on the default name -- https://github.com/JakeChampion/polyfill-service/blob/main/fastly/terraform/modules/service-compute/main.tf#L7

Copy link
Collaborator Author

@Integralist Integralist Oct 3, 2023

Choose a reason for hiding this comment

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

OK so that's a fair point from @JakeChampion

We have no way to tell if there are Terraform users who have used the compute pack command to create a custom language Wasm binary (and clearly we do have users taking that approach, as Jake explained: the polyfill.io service is one of them) and so we'd have to publish a new major release if we want this CLI fix rolled out.

My concern is that this is a bug fix for the CLI, but we're inadvertently causing a breaking feature change for Terraform, and yet we need to roll out this bug fix for the CLI still. So avoiding a new major version release isn't possible in this case (correct me if I'm wrong and there are other ways to make this work).

I was going to say if we need to roll out a new major release, then at least we have a couple of other 'breaking' items in the pipeline that can be included in that release.

The only problem with that idea, is that both those breaking items aren't ready yet to be released (not any time soon at least).

Meaning: this PR would either have to wait until that next major release (which could be a long time) or we have to make two major releases (one now to fix the bug in the CLI, and another one later on down the line for these other items).

I'm going to chat internally with @pabergman about this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

OK. I've spoken to Alexander and it sounds like this PR should be held off until we're ready to release a new major release (so I've marked this PR now as a 'breaking' change).

For @justinliew there is a workaround though. The compute deploy command provides a --package flag (docs) so that should let you point to a package generated by compute pack (e.g. compute deploy --package ./pkg/package.tar.gz).

@Integralist Integralist force-pushed the integralist/pack-name branch from 68fd062 to 062830a Compare October 2, 2023 16:44
@Integralist Integralist changed the title fix(compute/pack): use package name breaking(compute/pack): use package name from manifest Oct 3, 2023
@Integralist Integralist force-pushed the integralist/pack-name branch 4 times, most recently from 19f6b0b to a93fdbe Compare October 12, 2023 16:29
@Integralist Integralist force-pushed the integralist/pack-name branch 3 times, most recently from 794bc97 to c423a7e Compare October 18, 2023 11:54
@Integralist Integralist force-pushed the integralist/pack-name branch 2 times, most recently from ce6b9cc to a6d52a8 Compare October 25, 2023 13:17
@Integralist Integralist force-pushed the integralist/pack-name branch 4 times, most recently from 6de0e40 to 7caf5e7 Compare November 9, 2023 14:57
@Integralist Integralist force-pushed the integralist/pack-name branch 2 times, most recently from 9eb4f6a to e08bc8b Compare November 16, 2023 11:33
@Integralist Integralist force-pushed the integralist/pack-name branch from e08bc8b to b4ea655 Compare November 28, 2023 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants