CURL | Upload multiple html files to confluence

半城伤御伤魂 提交于 2019-12-13 04:05:28

问题


I need to upload html files from Jenkins workspace to confluence via CURL command.

Script used:-

stage('Publish to Confluence') {
          steps {
          withCredentials([usernamePassword(credentialsId: 'confluence', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
          sh '''
          curl -v -S -u $USERNAME:$PASSWORD -X POST -H "X-Atlassian-Token: no-check" -F "file_0=@code/pydoc/manage_connections.html" "https://alm-group.atlassian.net/wiki/spaces/PROJECT/pages/830833705/PyDoc"
          '''
          }}}

Issue is- It is uploading single file as a attachment. I need to upload bunch of files but I am not able to do it.

I followed below link but unable to crack it. https://developer.atlassian.com/cloud/confluence/rest/#api-content-get


回答1:


I think it's not a Jenkins question at all.

This is actually a duplicate of this one.

For many files just duplicated the -F with @.

curl -F "image=@file1.gif" -F "image2=@file2.gif"  http://localhost:8888/web/Upload.php


来源:https://stackoverflow.com/questions/53860220/curl-upload-multiple-html-files-to-confluence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!