Plugins for deployment package on Alibaba Cloud.
- The plugin provides a post-build step:upon a successful build,it will compress the specified working directory, upload it to OSS, and then download OSS files to ECS through OOS for deployment
- This plugins adds Jenkins pipeline steps to interact with the Aliyun API.
After building and installing the plugin, some simple configuration is needed for your project.Please set global configuration of Aliyun Ak/Sk.
- Open up your project configuration
- In the
Post-build Actions
section, select "Alibabacloud Automatic Package Deployment" - ResourceType,ResourceId, objectName, bucket, and region are so on all required options.
- Temporary access keys. These will use the global keys from the Jenkins instance.
- Create a Jenkins Pipeline project
- Use the Pipeline Snippet Generator
- For 'Sample Step', choose 'step: General Build Step'
- For 'Build Step', choose 'Alibabacloud Automatic Package Deployment'
- populate variables and then 'Generate Groovy'
Here is a rather blank example:
step([$class: 'AliyunEcsOpsByOssFilePublisher', region: 'cn-hangzhou', resourceType: 'ESS', resourceId: '', bucket: '', objectName: '', localPath: '', destinationDir: '', batchNumber: 1, invokeScript: ''])
Upload built project to OSS and execution OOS template download OSS file to smartly deploy on ECS instances.
executeId = ossUploadAndOosExec(batchNumber: 3, mode: 'FailurePause', bucket: 'testBucket', destinationDir: '/root/test.zip', invokeScript: '', localPath: '/', objectName: 'test.zip', pausePolicy: 'EveryBatchPause', region: 'cn-hangzhou', resourceId: 'asg-bp15XXXXX', resourceType: 'ESS')
Query OOS template task status by OSS template task id.
oosStatusQuery(executeId: "exec-XXXXXXXXX", region: 'cn-hangzhou')
Oos template pause task execution next step,like Approve or Cancelled.
oosExecuteNotify(executeId: "exec-XXXXXXXXX", region: 'cn-hangzhou', notifyType: "Approve")