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/ """
            }
        }
    }
}

posted @ 2024-08-16 17:44  六月OvO  阅读(20)  评论(0编辑  收藏  举报