You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to get reusable artifacts for different environments. They all use the same stage, but i'd like to be able to deploy all my zip files as the same generated versions to different dev environments.
I can use sls package to generate everything, then manually upload the zips to an s3 bucket.
Then in CI, I can copy those zips down into their correct locations, and do sls deploy --package $(pwd)/.serverless to deploy those zips to different environments.
However, in order to do that, I need cloudformation-template-update-stack.json and serverless-state.json files to exist, and they need to be generated per environment it seems.
So far, the only way i've been able to do that is by running another sls package, then deleting the resulting zips, which means I need to rebuild 5 times for 5 different environments, then delete them, then download the s3 versioned zips I want. This isn't great for speed, and is pretty hacky.
I was able to find that the package command has these LifecycleEvents:
Is there perhaps a way to skip the createDeploymentArtifacts or something similar, so I can just output those json files? I know I can do sls deploy function -f to simply swap the zips, but I do want the cloudformation to be updated if needed.
I was attempting a custom plugin like
classCustomPackagePlugin{constructor(serverless,options){this.serverless=serverless;this.options=options;this.commands={prepackage: {usage: 'Runs prepackage logic',lifecycleEvents: ['runPrepackage'],},};this.hooks={'prepackage:runPrepackage': this.runPrepackage.bind(this),'before:package:initialize': this.beforePackageInitialize.bind(this),};}asyncrunPrepackage(){// Log that the custom plugin is running prepackage logicthis.serverless.cli.log('Running prepackage logic');}asyncbeforePackageInitialize(){// Perform setup-related logic herethis.serverless.cli.log('Running setupProviderConfiguration logic');// This is where you can add logic similar to setupProviderConfiguration}}module.exports=CustomPackagePlugin;
But i haven't had luck tapping into the right hooks so it goes through the package setup, but just skips compiling the zip artifacts
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am attempting to get reusable artifacts for different environments. They all use the same stage, but i'd like to be able to deploy all my zip files as the same generated versions to different dev environments.
I can use
sls package
to generate everything, then manually upload the zips to an s3 bucket.Then in CI, I can copy those zips down into their correct locations, and do
sls deploy --package $(pwd)/.serverless
to deploy those zips to different environments.However, in order to do that, I need
cloudformation-template-update-stack.json
andserverless-state.json
files to exist, and they need to be generated per environment it seems.So far, the only way i've been able to do that is by running another
sls package
, then deleting the resulting zips, which means I need to rebuild 5 times for 5 different environments, then delete them, then download the s3 versioned zips I want. This isn't great for speed, and is pretty hacky.I was able to find that the
package
command has these LifecycleEvents:Is there perhaps a way to skip the
createDeploymentArtifacts
or something similar, so I can just output those json files? I know I can dosls deploy function -f
to simply swap the zips, but I do want the cloudformation to be updated if needed.I was attempting a custom plugin like
But i haven't had luck tapping into the right hooks so it goes through the
package
setup, but just skips compiling the zip artifactsBeta Was this translation helpful? Give feedback.
All reactions