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

Abstraction layer for [setup.backends] #421

Merged
merged 28 commits into from
Oct 6, 2021
Merged

Conversation

Integralist
Copy link
Collaborator

@Integralist Integralist commented Sep 28, 2021

NOTE: The below screenshots aren't the final product. For example they will include language in the displayed user messages that will likely have been updated as part of a code review.

Scenario: existing service

If you set a Service ID into the fastly.toml file, we will not validate the service for missing backends, nor will we prompt the user to create any backends...

Screenshot 2021-09-29 at 16 15 49

Scenario: new service

If no Service ID, then we'll prompt the user to create a service, including any backend resources required.

In the case of [setup] the user will be prompted for backends to be created that align with that configuration...

Screenshot 2021-09-29 at 16 40 59

If there is no [setup] configuration, then the user will be prompted for at least one backend (more can be added)...

Screenshot 2021-09-29 at 16 42 56

Lastly, if the user doesn't enter any information, then an originless backend will be created...

Screenshot 2021-09-29 at 16 44 38

@Integralist Integralist added the enhancement New feature or request label Sep 28, 2021
@triblondon
Copy link
Contributor

Where you have [setup] information, could you say:

Creating a backend called 'backend_name' (backend able to serve /articles path):
Hostname or IP address: [reqbin.com]
Port: [443]

Creating a backend called 'other_backend_name' (backend able to serve /anything path):
Hostname or IP address: [httpbin.org]
Port: [443]

Because the prompt property for the backend in the [setup] data doesn't relate specifically to the hostname.

@Integralist Integralist force-pushed the integralist/setup-backends branch 3 times, most recently from dd222e4 to a0777e3 Compare October 1, 2021 11:16
@Integralist
Copy link
Collaborator Author

Integralist commented Oct 1, 2021

@triblondon updated output.

A couple of things to note:

  1. The 'prompt' value (e.g. 'Backend able to serve...') is on a separate line from the 'Configure a backend called...' line because it gets wrapped and looked a bit weird in some cases. I can put it back onto one line if you prefer.
  2. The 'prompt' field I'm going to update in the fastly.toml to be 'description' because it's no longer used as part of the prompt to the user and is only being used to describe the backend that needs to be created.

Screenshot 2021-10-01 at 12 20 55

Integralist added a commit to fastly/compute-starter-kit-rust-default that referenced this pull request Oct 1, 2021
@triblondon
Copy link
Contributor

👍

@Integralist Integralist marked this pull request as ready for review October 1, 2021 13:27
@Integralist
Copy link
Collaborator Author

@triblondon this is ready for review now.

@@ -21,6 +22,10 @@ func TestInit(t *testing.T) {
t.Skip("Set TEST_COMPUTE_INIT to run this test")
}

// TODO: Change back to "main" before merging PR.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@triblondon in order for the tests to show as passing I needed to use a PR branch for each of the starter kits we pull in.

So basically once this PR is approved, and all the starter kit PRs are approved (see: links below), then I'll need to coordinate merging both this PR and cut a new CLI release as quickly as possible after the fact.

NOTE: with the exception of the rust starter kit they're all one line changes, so if you could also take a moment to approve those (when you have a chance).

@Integralist
Copy link
Collaborator Author

@kailan adding you to the reviews in case Andrew is busy.

Copy link
Contributor

@triblondon triblondon left a comment

Choose a reason for hiding this comment

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

I'm happy with the UX here.

// longer compatible with the current CLI version.
var ErrIncompatibleManifestVersion = RemediationError{
Inner: fmt.Errorf("the fastly.toml contains an incompatible manifest_version number"),
Remediation: "Update the `manifest_version` in the fastly.toml and refer to https://developer.fastly.com/reference/fastly-toml/#setup-information",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Integralist I need to update this message so it points to the next CLI changelog that this code will be released under.

This is actually a complex change because we need to do a bunch of work
that is done by the custom Version type when calling toml.Unmarshal().

The reason we have to duplicate that work is because we can find
ourselves in a position where toml.Unmarshal will error if given a toml
file with a structure not supported by the CLI code, and so in order to
provide a good remediation to the user we need to first identify the
manifest_version separate from a full unmarshal of the data.
Integralist added a commit to fastly/compute-starter-kit-rust-default that referenced this pull request Oct 6, 2021
* update the [setup] structure to reflect latest interface

Latest interface: fastly/Developer-Portal#852

* update `manifest_version` to what will become the latest

* Switched from 'prompt' to 'description' as per the CLI implementation

i.e. fastly/cli#421 (comment)
@Integralist Integralist merged commit e90e06e into main Oct 6, 2021
@Integralist Integralist deleted the integralist/setup-backends branch October 6, 2021 16:09
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.

2 participants