-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Updates - Adds new `rollback` plugin - Fixes `deploy list` to show actual timestamp from name, which is used for rollback - Adds required functionality to `AzureBlobStorageService` and `ArmService` - Adds previously missing tests of required functionality ## How to Use 1. Get a timestamp. Use ``` sls deploy list ``` to retrieve one. 2. Roll back function app to timestamp ``` sls rollback -t <timestamp> ``` ## Options In `deploy` section of `serverless.yml`, you can specify whether to run from a blob URL or deploy the package directly to the function app by setting: ```yaml deploy: # Default is false runFromBlobUrl: true|false ``` Resolves [AB#317]
- Loading branch information
Showing
23 changed files
with
632 additions
and
120 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { MockFactory } from "../../test/mockFactory"; | ||
import { invokeHook } from "../../test/utils"; | ||
import { AzureRollbackPlugin } from "./azureRollbackPlugin"; | ||
|
||
jest.mock("../../services/rollbackService"); | ||
import { RollbackService } from "../../services/rollbackService"; | ||
|
||
describe("Rollback Plugin", () => { | ||
it("should call rollback service", async () => { | ||
const plugin = new AzureRollbackPlugin( | ||
MockFactory.createTestServerless(), | ||
MockFactory.createTestServerlessOptions(), | ||
); | ||
await invokeHook(plugin, "rollback:rollback"); | ||
expect(RollbackService.prototype.rollback).toBeCalled(); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Serverless from "serverless"; | ||
import { RollbackService } from "../../services/rollbackService"; | ||
|
||
/** | ||
* Plugin for rolling back Function App Service to previous deployment | ||
*/ | ||
export class AzureRollbackPlugin { | ||
public hooks: { [eventName: string]: Promise<any> }; | ||
|
||
public constructor(private serverless: Serverless, private options: Serverless.Options) { | ||
this.hooks = { | ||
"rollback:rollback": this.rollback.bind(this) | ||
}; | ||
} | ||
|
||
private async rollback() { | ||
const service = new RollbackService(this.serverless, this.options); | ||
await service.rollback(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.