Skip to content

Instantly share code, notes, and snippets.

@munepom
Created December 9, 2016 09:12
Show Gist options
  • Save munepom/140a3d6ecfdf614f1ac4b6d2ca2a5740 to your computer and use it in GitHub Desktop.
Save munepom/140a3d6ecfdf614f1ac4b6d2ca2a5740 to your computer and use it in GitHub Desktop.
Jenkins のジョブをコピってくれるくん
#!/bin/bash
BASE_JOB_NAME=TestJob
NEW_JOB_NAME=TestJob
BASE_JOB_SERVER=http://base-jenkins.example.com
NEW_JOB_SERVER=http://new-jenkins.example.com
JENKINS_USER=${USER}
JENKINS_API_KEY=$(cat ~/.new_job_server_jenkins_api_key)
curl \
-s ${BASE_JOB_SERVER}/job/${BASE_JOB_NAME}/config.xml \
| curl \
--user "${JENKINS_USER}:${JENKINS_API_KEY}" \
-X POST "${NEW_JOB_SERVER}/createItem?name=${NEW_JOB_NAME}" \
--header "Content-Type: application/xml" \
--data-binary @-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment