ãã®åã¨ã³ããªã«ããã°æ¸ãã¦ãªããããããã12æã¯1人ã¢ããã³ãã«ã¬ã³ãã¼ãããã¼ã¨æ¸ãã¦ãæ°ä»ã㨠12/10 ã«ãªã£ã¦ãã¾ãããé²æå
¨ç¶ãã¡ã§ãã
æè¿ãæ
£ããªã Jenkins æ°ã¨ä¹
ãã¶ãã«æ¯ãã¦ããã®ã§ãããæ¨æ¥åå¼·ããã¡ã¢ã«ã¤ãã¦æ®ãã¦ããã¾ãã
ã¡ãªã¿ã«ç°å¢ã¯ã Jenkins 1.640 / Java 7 ã§ãããã¾ãã
åæ
åæã¨ãã¦ãJenkinsã®æ¤è¨¼ç°å¢ã§ã¯ãã¦ã¼ã¶åä½ã§ã®èªè¨¼ã«å ãã¦ãã¸ã§ãã«å¯¾ããèªå¯å¶å¾¡ãå ãã¦ãã¾ãã
éçºã¦ã¼ã¶ã¯ããã®ã¸ã§ã(ãã«ã)ãç·¨éãããå®è¡ã§ãããã©ããªãã¬ã¼ã¿ã¦ã¼ã¶ã¯å®è¡ããã§ããªããå¿åã¦ã¼ã¶ã¯ã¸ã§ãã®åå¨èªä½ãè¦ããªããã¨ããããããæãã
ã§ãããããç°å¢ã§ãJenkins CLIããã¸ã§ãã®æ´æ°ãªã©ãè¡ããã¨ããã¨ãæå®ããã¦ã¼ã¶ã®èªè¨¼ããã¾ãéã£ã¦ãããã«ãé¢ããããã¸ã§ããç¡ãã¨ã¨ã©ã¼ãè¿ãããã¨ããã±ã¼ã¹ã
ç¶æ³
å
·ä½çã«ã¯ä»¥ä¸ã®ãããªæãã
$ java -jar /usr/local/bin/jenkins-cli.jar -s http://localhost:8080/ list-jobs hudson.security.AccessDeniedException2: anonymous ã«ã¯ãå ¨ä½/Read ãã¼ããã·ã§ã³ãããã¾ããã
ã¸ã§ãä¸è¦§ãåå¾ããã¹ããä¸è¨ã®ããã«ã¦ã¼ã¶æ
å ±ãè¨è¿°ããªãã¨ãå¿åã¦ã¼ã¶ããã®ã¢ã¯ã»ã¹ã¨ãªã£ã¦ãæ
å ±ãåå¾ã§ããªãæããèªè¨¼ã»èªå¯ã®å¶å¾¡ãããã¦ããã®ã§ãããã¯æ³å®éãã
$ java -jar /usr/local/bin/jenkins-cli.jar -s http://localhost:8080/ list-jobs --username user --password pass test-job01 test-job02 test-job03
é©åãªã¦ã¼ã¶æ
å ±ããããªæãã§æå®ããã¨ãã¸ã§ãä¸è¦§ãåå¾ã§ããããã£ã¦èªè¨¼ã¯ãã¾ããã£ã¦ããããã«è¦ããã
ã§ãåé¡ã¯ããããã
$ java -jar /usr/local/bin/jenkins-cli.jar -s http://localhost:8080/ get-job test-job01 --username user --password pass No such job 'test-job01' java -jar jenkins-cli.jar get-job JOB [--username VAL] [--password VAL] [--password-file VAL] ã¸ã§ãå®ç¾©XMLãæ¨æºåºåã«åºåãã¾ãã JOB : Name of the job --username VAL : User name to authenticate yourself to Jenkins --password VAL : Password for authentication. Note that passing a password in arguments is insecure. --password-file VAL : File that contains the password
get-job ã update-job ãå®è¡ããã¨ããã®éãããããªã¸ã§ãã¯ç¡ãã¨æããããããããä¸è¨ã®ã¸ã§ãä¸è¦§ã§åå¾ããéããã¸ã§ãã¯ç¢ºãã«åå¨ããã
ã§ãåãåããã¹ãè²ã
ãã£ã¦ã¿ãã¨ãå¿åã¦ã¼ã¶(Anonymous)ã®èªå¯å¶å¾¡ã§ãã¸ã§ãã« "READ" ãã¼ããã·ã§ã³ãä»ãã¦ãããã¨ãä¸è¨ã®ããã«ã¸ã§ãå
容ãåºåãããã
$ java -jar /usr/local/bin/jenkins-cli.jar -s http://localhost:8080/ get-job test-job01 --username user --password pass <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description>ã¸ã§ãã®ãã¹ãã ã</description> ã»ã»ã»ã»ã» çç¥ ã»ã»ã»ã»ã»
ã¡ãªã¿ã«ãã¦ã¼ã¶æ
å ±ã渡ãã¦ãããªãã¨ãå¿åã¦ã¼ã¶æ±ãã¨ãªãããã¼ããã·ã§ã³ãç¡ãã¨ã¨ã©ã¼ã®æè¨ãå¤ããã¾ãã
ãã£ã¦ãget-jobãupdate-jobã¯ãèªè¨¼æ®µéã®åã«ãã¸ã§ããåå¨ãããã©ãããå¿åã¦ã¼ã¶(Anonymous)ã§äºåãã§ãã¯ãããããªæåã«ãªã£ã¦ããã¨æãããã(ã½ã¼ã¹ã³ã¼ãã¯èªãã§ããªãã®ã§æ¨æ¸¬)
解決
ã¯ããããã¥ã¡ã³ãã«ã¡ããã¨æ¸ãã¦ããã¾ããã
1.576 and later
Whenever the CLI tries to to connect to the Jenkins server, it offers the before mentioned SSH keys. When the user has those keys but don't want use them to authenticate, preventing being prompted by the key's password, it's possible to use the -noKeyAuth argument. This way the CLI will never try to use the SSH keys available.1.419 and later
If your Jenkins requires authentication, you should set up public key authentication. Login from the web UI and go to http://yourserver.com/me/configure, then set your public keys in the designated text area. When connecting to the server, the CLI will look for ~/.ssh/identity, ~/.ssh/id_dsa, ~/.ssh/id_rsa and use those to authenticate itself against the server. Alternatively, the -i option can be used to explicitly specify the location of the private key.
èªè¨¼ã使ãããå ´åã¯ãSSHéµã使ãã¾ããããã¨ã
ã¨ããããã§ãJenkinsã®ã¦ã¼ã¶ç®¡çç»é¢ã§ãå
¬ééµã®è¨å®ãè¡ã£ãä¸ã§ãä¸è¨ã®ãããªæã㧠"-i" ãªãã·ã§ã³ã§ç§å¯éµãæå®ãã¦å®è¡ããã¨ãä½ã®åé¡ããªã get-job ã update-job ãåºåããã¾ããã
$ java -jar /usr/local/bin/jenkins-cli.jar -s http://localhost:8080/ -i ~/.ssh/id_rsa get-job test-job01 <?xml version='1.0' encoding='UTF-8'?> <project> <actions/> <description>ã¸ã§ãã®ãã¹ãã ã</description> ã»ã»ã»ã»ã» çç¥ ã»ã»ã»ã»ã»
ã¡ãªã¿ã«ãå
¬ééµã®è¨å®ã¯ãJenkinsã® [Jenkinsã®ç®¡ç] â [ã¦ã¼ã¶ã®ç®¡ç] â [è¨å®ãããã¦ã¼ã¶] â [è¨å®] â [SSH Public Keys] ã®ã¨ããã§è¨å®ã§ãã¾ãã
ã¾ã¨ã
ããã¥ã¡ã³ãå«ã以ä¸ã
ããã§ã¯ï¼=͟͟͞͞(๑•̀=͟͟͞͞(๑•̀д•́=͟͟͞͞(๑•̀д•́๑)=͟͟͞͞(๑•̀д•́
- ä½è : ä½è¤èè¦,åç°è²´ä¹ ,æ²³æé 人,米沢å¼æ¨¹,山岸å,å·å£èä»
- åºç社/ã¡ã¼ã«ã¼: æè¡è©è«ç¤¾
- çºå£²æ¥: 2015/06/10
- ã¡ãã£ã¢: åè¡æ¬ï¼ã½ããã«ãã¼ï¼
- ãã®ååãå«ãããã° (3件) ãè¦ã