尊龙凯时人生就是博

gitlabÔõôָ¶¨Îļþ¼Ð²»ÔÊÐíͬ²½

ÔÚgitlabÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃgitlab ci/cdÀ´×Ô¶¯»¯¹¹½¨¡¢²âÊԺͰ²ÅÅ´úÂ롣ͨ³£ÇéÐÎÏ£¬ÎÒÃÇ»áÏ£Íû½«ËùÓеÄÎļþ¶¼Í¬²½µ½gitlab ci/cdÖУ¬ÒÔ±ã¿ÉÒÔ¾ÙÐвâÊԺͰ²ÅÅ¡£

È»¶ø£¬ÔÚijЩÇéÐÎÏ£¬Äú¿ÉÄÜ»áÏ£Íûեȡͬ²½Ä³Ð©Îļþ¼Ð»òÎļþ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚGitLabÖÐÖ¸¶¨Îļþ¼Ð²»ÔÊÐíͬ²½¡£

Ê×ÏÈ£¬ÄúÐèÒªÔÚGitLabÖн¨ÉèÒ»¸öÃûΪ¡°.gitlab-ci.yml¡±µÄÎļþ¡£¸ÃÎļþÈÏÕæ½ç˵ÏîÄ¿µÄCI/CD¹ÜµÀ£¬²¢Ö¸¶¨ÔõÑù¹¹½¨¡¢²âÊԺͰ²ÅÅÄúµÄ´úÂë¡£

½ÓÏÂÀ´£¬ÄúÐèÒªÔÚ¡°.gitlab-ci.yml¡±ÎļþÖÐʹÓá°ignore¡±Òªº¦×ÖÖ¸¶¨²»ÐèҪͬ²½µÄÎļþ¼Ð¡£ÀýÈ磬ÈôÊÇÄúÏ£Íûեȡͬ²½ÃûΪ¡°docs¡±µÄÎļþ¼Ð£¬Äú¿ÉÒÔÔÚ¡°.gitlab-ci.yml¡±ÎļþÖÐÌí¼ÓÒÔÏ´úÂ룺

rsync:
  script:
    - rsync -avz --exclude 'docs/' $CI_PROJECT_DIR/ user@example.com:/var/www/html/

µÇ¼ºó¸´ÖÆ

ÔÚ´Ë´úÂëÖУ¬¡°rsync¡±ÊÇÒ»¸öÓÃÓÚͬ²½ÎļþµÄÏÂÁ¡°$ CI_PROJECT_DIR¡±Ö¸ÏòÏîÄ¿µÄ¸ùĿ¼£¬¡°user@example.com¡±ÊÇÄúµÄЧÀÍÆ÷µØµã£¬¡°/var/www/html/¡±ÊÇÄúҪͬ²½µ½µÄÄ¿µÄÎļþ¼Ð¡£ÆäÖУ¬¡°–exclude’ docs/’¡±Ö¸Ê¾É¨³ý¡°docs¡±Îļþ¼ÐµÄËùÓÐÎļþ¡£

³ýÁËʹÓá°ignore¡±Òªº¦×Ö£¬Äú»¹¿ÉÒÔʹÓÃÆäËûһЩѡÏîÀ´Ö¸¶¨²»ÐèҪͬ²½µÄÎļþ»òÎļþ¼Ð¡£ÀýÈ磬¡°exclude_files¡±Òªº¦×Ö¿ÉÒÔÓÃÓÚÖ¸¶¨ÒªÉ¨³ýµÄÎļþÁÐ±í£º

rsync:
  script:
    - rsync -avz --exclude-from 'exclude_list.txt' $CI_PROJECT_DIR/ user@example.com:/var/www/html/

µÇ¼ºó¸´ÖÆ

ÔÚ´Ë´úÂëÖУ¬¡°–exclude-from¡±Ö¸Ê¾Ê¹ÓÃÃûΪ¡°exclude_list.txt¡±µÄÎļþ×÷Ϊɨ³ýÁбí¡£

±ðµÄ£¬Äú»¹¿ÉÒÔʹÓÃGitLab CI/CDµÄÎļþ¹ýÂËÆ÷À´É¨³ý²»ÐèҪͬ²½µÄÎļþ¡£ÀýÈ磬ÈôÊÇÄúÏ£Íûɨ³ýËùÓÐÀ©Õ¹ÃûΪ¡°.tmp¡±ºÍ¡°.log¡±µÄÎļþ£¬Äú¿ÉÒÔÔÚ¡°.gitlab-ci.yml¡±ÎļþÖÐÌí¼ÓÒÔÏ´úÂ룺

rsync:
  script:
    - rsync -avz $CI_PROJECT_DIR/ user@example.com:/var/www/html/ | grep -vE '\.(tmp|log)$' | tee /tmp/rsync.log

µÇ¼ºó¸´ÖÆ

ÔÚÕâ¸öÀý×ÓÖУ¬¡°grep¡±ÏÂÁîÓÃÓÚ¹ýÂËËùÓÐÀ©Õ¹ÃûΪ¡°.tmp¡±ºÍ¡°.log¡±µÄÎļþ£¬¡°tee¡±ÏÂÁîÓÃÓÚ½«¹ýÂ˺óµÄÊä³öͬʱÊä³öµ½ÆÁÄ»ºÍ/tmp/rsync.logÎļþÖС£

×ÜÖ®£¬ÔÚGitLabÖÐÖ¸¶¨²»ÐèҪͬ²½µÄÎļþ¼Ð»òÎļþºÜÊǼòÆÓ¡£Äú¿ÉÒÔʹÓá°ignore¡±Òªº¦×Ö¡¢Îļþ¹ýÂËÆ÷»òɨ³ýÁбíÀ´ÊµÏÖ¡£ÎÞÂÛÄúÑ¡ÔñÄÄÖÖÒªÁ죬¶¼¿ÉÒÔÇáËɵؿØÖÆҪͬ²½µÄÎļþºÍÎļþ¼Ð£¬´Ó¶øÓÅ»¯ÄúµÄCI/CD¹ÜµÀµÄЧÂÊ¡£

ÒÔÉϾÍÊÇgitlabÔõôָ¶¨Îļþ¼Ð²»ÔÊÐíͬ²½µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ