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: List deployments sub-command for deploy plugin #176

Merged
merged 5 commits into from
Jun 21, 2019

Conversation

tbarlow12
Copy link
Contributor

Resolves [AB#352]

Copy link
Contributor

@wbreza wbreza left a comment

Choose a reason for hiding this comment

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

Left some minor feedback, but looks good overall.

};

this.commands = {
deploy: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does defining these commands mess with the top level core plugin on the CLI ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was concerned about that, which is why I left out the lifecycleEvents (I defined them at first, which caused deploy to be triggered twice). I set the plugin to log this.commands to see what the object looks like by default, and itame back undefined. In my manual testing, the deployment still works fine. Feel free to double check me on that though.

const resourceService = new ResourceService(this.serverless, this.options);
const deployments = await resourceService.listDeployments();
let stringDeployments = "\n\nDeployments";
for (const dep of deployments) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If no deployments exist consider adding a line that says "No deployments found for resource group" or similar.

@@ -11,6 +11,11 @@ export class ResourceService extends BaseService {
this.resourceClient = new ResourceManagementClient(this.credentials, this.subscriptionId);
}

public async listDeployments() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is more of a "get" operation and think we should rename to getDeployments. The listing/writing is happening in the plugin.

Copy link
Contributor

@mydiemho mydiemho left a comment

Choose a reason for hiding this comment

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

looks good. I suggest adding one more tests for empty deployments

@@ -70,4 +72,15 @@ describe("Resource Service", () => {
expect(ResourceManagementClient.prototype.resourceGroups.deleteMethod)
.toBeCalledWith(resourceGroup);
});

it("lists deployments", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

another to test when deployments are empty

@tbarlow12 tbarlow12 merged commit 34db630 into dev Jun 21, 2019
@tbarlow12 tbarlow12 deleted the tabarlow/list-deploy branch June 21, 2019 20:27
tbarlow12 added a commit that referenced this pull request Sep 13, 2019
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.

3 participants