Created
October 11, 2018 08:34
-
-
Save munepom/9dd8c51a6fa5301e199cf9dc5c0df446 to your computer and use it in GitHub Desktop.
Jenkins Job を別 Jenkins へコピーできるくん
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ORG_ADDRESS= | |
ORG_PORT= | |
TARGET_ADDRESS= | |
TARGET_PORT= | |
ORG_USER=hogehoge | |
ORG_PASSWORD=secret | |
ORG_APIKEY=yourkey | |
TARGET_USER= | |
TARGET_PASSWORD= | |
TARGET_APIKEY= | |
JOB_NAME_ORG= | |
JOB_NAME_TARGET=${JOB_NAME_ORG} | |
curl -s "http://${ORG_USER}:${ORG_PASSWORD}@${ORG_ADDRESS}:${ORG_PORT}/job/${JOB_NAME_ORG}/config.xml" \ | |
| curl \ | |
--user "${TARGET_USER}:${TARGET_APIKEY}" \ | |
-X POST "http://${TARGET_ADDRESS}:${TARGET_PORT}/createItem?name=${JOB_NAME_TARGET}" \ | |
--header "Content-Type: application/xml" \ | |
--header "$(curl -s \"http://${TARGET_ADDRESS}:${TARGET_PASSWORD}@${TARGET_ADDRESS}:${TARGET_PORT}/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)\")" \ | |
--data-binary @- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment