serverless-ccplat-plugin v0.5.0
This project contains serverless plugin for cloud common platform More info about the plugin can be found at the following page: https://confluence-tools.swacorp.com/display/EC/Serverless+Plugin+for+the+Serverless+Modules
##Sample config
serverless.yaml
custom:
hooks:
preDeploy:
- publish_params:
config:
var1: 'value1'
- sample_hook2
postDeploy:
- sample_hook1
- sample_hook2
preDestroy:
- sample_hook1
- sample_hook2
postDestroy:
- clean_up_params
custom:
hooks:
postDeploy:
- publish_params
postDestroy:
- clean_up_params
For this config to work, we must have corresponding sample_hooks1.js etc. file(s) under src/hooks directory.
###How to develop plugins 1. Create a new javascript file under src/hooks directory. 2. Create a test for the newly created file. 3. Run 'npm run test' for linting, unit testing and code coverage.
##How to test plugin with the serverless module. 1. Push all of your changes to your feature branch, after the "npm run test" command is happy. 2. Monitor that the Jenkins has created a test version for your changes by looking at the console log output of the branch run on Jenkins. 3. Take note of the version created by the job. 4. Go to the serverless module that you want to test the hook and update its package.json file with the test version created by Jenkins. It would be something like "0.0.1-feature-XXXXX". 5. Update Dockerfile with "RUN npm install" in the serverless module so that you can force the pull of newly created version. 6. Run "docker-compose build serverless && docker-compose run serverless" to test the hook. 7. You may have to do this multiple times since we run serverless inside docker.
#####In case if you have created a new hook, then you will have to add it to the serverless.yml file for the appropriate stage as described in the "Sample Config" above.
2 years ago