Jenkins Pipeline Utility Steps - zip zipFile

前端 未结 4 577
没有蜡笔的小新
没有蜡笔的小新 2021-01-11 15:30

I am trying to zip the folders which are created as output of my jenkins pipeline job using pipeline script. By googling i came to know the Jenkins

P

4条回答
  •  粉色の甜心
    2021-01-11 16:02

    you can just use sh (jenkins server need install zip);

     sh '''
                zip -r  algo.zip algo
     '''
    

    pipeline script like this

    node {
        stage('Clean'){
            cleanWs()
        }
        stage('Checkout') {
           git branch: 'develop', url: 'ssh://user@ip:29418/prj.git'
        }
        stage('Zip') {
            dir('algo-python') {
                sh '''
                zip -r  algo.zip algo
                '''
           }
        }
        stage('Upload zip'){
            dir('algo-python') {
                sh '''
                    source /etc/profile
                    export HADOOP_USER_NAME=dev
                    hdfs dfs -put -f algo.zip /user/dev/zipfile/
                '''
            }
        }
    }
    

提交回复
热议问题