mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
Persist artifact in saved state
The `service.package.artifact` property was missing in the saveState function, so it was not available in the deploy phase. This PR saves and restores the property correctly, and for AWS additionally sets it during packaging. For AWS the initialization of the property also was missing, possibly due to a merge conflict. Combination of the following commits: Re-revert changes for saveServiceState and extendedValidate Revert most recent changes Update package artifact to include path and .zip name Update artifact file path for packaging and name for service state Update tests for saveServiceState Do not persist artifacts as it is not needed Persist package.artifact correctly
This commit is contained in:
parent
73cdeb96cb
commit
aa29c9632e
@ -19,6 +19,8 @@ module.exports = {
|
||||
.utils.readFileSync(serviceStateFilePath);
|
||||
_.assign(this.serverless.service, state.service);
|
||||
this.serverless.service.package.artifactDirectoryName = state.package.artifactDirectoryName;
|
||||
this.serverless.service.package.artifact = path
|
||||
.join(this.serverless.config.servicePath, '.serverless', state.package.artifact);
|
||||
|
||||
if (this.serverless.service.package.individually) {
|
||||
// artifact file validation (multiple function artifacts)
|
||||
|
||||
@ -14,11 +14,14 @@ module.exports = {
|
||||
serviceStateFileName
|
||||
);
|
||||
|
||||
const artifact = this.serverless.service.package.artifact.split(path.sep).pop();
|
||||
|
||||
const state = {
|
||||
service: _.assign({}, _.omit(this.serverless.service, ['serverless', 'package'])),
|
||||
package: {
|
||||
individually: this.serverless.service.package.individually,
|
||||
artifactDirectoryName: this.serverless.service.package.artifactDirectoryName,
|
||||
artifact,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@ describe('#saveServiceState()', () => {
|
||||
package: {
|
||||
individually: false,
|
||||
artifactDirectoryName: 'artifact-directory',
|
||||
artifact: 'service.zip',
|
||||
},
|
||||
};
|
||||
getServiceStateFileNameStub = sinon
|
||||
@ -56,6 +57,7 @@ describe('#saveServiceState()', () => {
|
||||
package: {
|
||||
individually: false,
|
||||
artifactDirectoryName: 'artifact-directory',
|
||||
artifact: 'service.zip',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ module.exports = {
|
||||
|
||||
packageService() {
|
||||
this.serverless.cli.log('Packaging service...');
|
||||
_.set(this.serverless.service, 'package.artifacts', {});
|
||||
let shouldPackageService = false;
|
||||
const allFunctions = this.serverless.service.getAllFunctions();
|
||||
const packagePromises = _.map(allFunctions, functionName => {
|
||||
@ -35,6 +36,8 @@ module.exports = {
|
||||
functionObject.package = functionObject.package || {};
|
||||
if (functionObject.package.individually || this.serverless.service
|
||||
.package.individually) {
|
||||
this.serverless.service.package.artifacts[functionName] =
|
||||
this.provider.naming.getFunctionArtifactName(functionName);
|
||||
return this.packageFunction(functionName);
|
||||
}
|
||||
shouldPackageService = true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user