jenkins推送代码到aws的s3存储桶
1.aws创建用户
2.服务器配置安装aws
pip3.6 install awscli
AWS Access Key ID [None]: 公钥
AWS Secret Access Key [None]: 私钥
Default region name [None]: 地域
Default output format [None]: json
3.s3存储桶要提前建好
4.pipline
pipeline {
environment {
APPNAME = sh(script: "echo ${env.JOB_NAME}|awk -F_ '{print \$NF}'", returnStdout: true).trim()
}
stages {
stage('拉取代码'){
steps{
git branch: 'test', credentialsId: '417948ae-4050fca40c9', url: '${GITURL}'
}
}
stage('构建代码') {
steps {
sh " npm config -g set registry https://registry.npmmirror.com/ "
sh " npm install && npm run build "
}
}
stage('发布代码'){
steps{
sh """ aws s3 cp ./dist/cloud-computer-custom.umd.min.js s3://cdndeve.baidu.com/test/cloudComputerComponent/ """
}
}
}
}
本文来自博客园,作者:六月OvO,转载请注明原文链接:https://www.cnblogs.com/chenlifan/p/18363362