目录

pipeline-huaweicloud-plugin

This plugins adds Jenkins pipeline steps to interact with the HuaweiCloud API.

How to build it

git clone https://github.com/huaweicloud/pipeline-huaweicloud-plugin
cd pipeline-huaweicloud-plugin
mvn package -DskipTests

Install pipeline-huaweicloud-plugin/target/pipeline-huaweicloud.hpi in jenkins (such as: http://127.0.0.1/pluginManager/advanced)

Usage / Steps

withOBS

the withOBS step provides authorization for the nested steps.

Set region, endpointUrl, credentials information:

 withOBS(endpointUrl:"https://obs.cn-north-1.myhuaweicloud.com",region:'cn-north-1',credentials:'ZJTEST') {
    // do something
}

When you use Jenkins Declarative Pipelines you can also use withOBS in an options block:

options {
    withOBS(endpointUrl:"https://obs.cn-north-1.myhuaweicloud.com",region:'cn-north-1',credentials:'ZJTEST')
}
stages {
    ...
}

obsUpload

Upload a file from the workspace (or a String) to an OBS bucket.

options {
  withOBS(endpointUrl:"https://obs.cn-north-1.myhuaweicloud.com",region:'cn-north-1',credentials:'ZJTEST')
}
steps {
  obsUpload(file:'ploaded5959630964693432219.jpi', bucket:'obs-test', path:'/')
}

invokeFunction

Invoke a function.

The step returns the object returned by the function.

steps {
  script {
    def result = invokeFunction(functionName: 'test002', payloadAsString: '{"key": "value"}')
    echo "Testing the ${result} browser"
 }
}
关于
90.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号