Skip to content

jenkins_restapi

choisungwook edited this page May 28, 2021 · 6 revisions

폴더 생성

reference: https://stackoverflow.com/questions/50408059/create-folder-in-jenkins-ui-using-curl/50413959

curl -XPOST -k \
'https://choilab.com/jenkins1/createItem?name=test1&mode=com.cloudbees.hudson.plugins.folder.Folder&from=&json={"name":"test1","mode":"com.cloudbees.hudson.plugins.folder.Folder","from":"","Submit":"OK"}&Submit=OK' \
--user admin:1192f220a80306dbe4a07fe4d9d133dc2f \
-H "Content-Type:application/x-www-form-urlencoded"

잡 생성

폴더에 파이프라인 유형 잡 생성

reference: https://gist.github.com/stuart-warren/7786892

  • 을 잡이름으로 수정
curl -k -XPOST \
'http://choilab.com/jenkins1/job/<foldername>/createItem?name=<jobname>' \
--data-binary @config.xml \
-H "Content-Type:text/xml" \
--user admin:<access token>
  • config.xml은 url, name
<?xml version='1.1' encoding='UTF-8'?>
<flow-definition plugin="[email protected]">
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties/>
  <definition class="org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition" plugin="[email protected]">
    <scm class="hudson.plugins.git.GitSCM" plugin="[email protected]">
      <configVersion>2</configVersion>
      <userRemoteConfigs>
        <hudson.plugins.git.UserRemoteConfig>
          <url>https://github.com/choisungwookDevops/jenkins-podtemplate-springboot.git</url> <!-- git repo url -->
        </hudson.plugins.git.UserRemoteConfig>
      </userRemoteConfigs>
      <branches>
        <hudson.plugins.git.BranchSpec>
          <name>*/main</name>  <!-- 브랜치 -->
        </hudson.plugins.git.BranchSpec>
      </branches>
      <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
      <submoduleCfg class="empty-list"/>
      <extensions/>
    </scm>
    <scriptPath>Jenkinsfile</scriptPath> <!-- jenkinsfile 이름 -->
    <lightweight>true</lightweight>
  </definition>
  <triggers/>
  <disabled>false</disabled>
</flow-definition>
쿠버네티스
도커
aws
리눅스
개발

파이썬

테라폼
기타
Clone this wiki locally