×ðÁú¿­Ê±¹ÙÍøµÇ¼

Ôõô²»ÐèÒªÓû§ÃÜÂë¹¹½¨gitlab

ÔÚÈí¼þ¿ª·¢ºÍЭ×÷ÖУ¬gitlabÊÇÒ»¸öºÜÊÇÊܽӴýµÄ´úÂëÖÎÀíƽ̨¡£Í¨¹ýÔÚgitlabÖÐÉèÖÃgit²Ù×÷£¬ÔÚ´úÂëµÄ²î±ðÍ°ÖоÙÐÐÊÂÇ飬ÒÔ¼°ÔÚЭ×÷Àú³ÌÖоÙÐа汾¿ØÖƺÍЭ×÷±äµÃÔ½·¢ÈÝÒס£

È»¶ø£¬ÔÚGitLabÖУ¬Í¨³£ÐèҪΪÿ¸öÓû§ÉèÖÃÓû§ÃûºÍÃÜÂ룬ÒÔ±ã¾ÙÐÐÉí·ÝÑéÖ¤²¢»á¼û´æ´¢¿â¡£¿ÉÊÇ£¬ÓÐʱÄú¿ÉÄÜÏëÒª×èֹǿÖÆÓû§ÊäÈëÃÜÂë¡£ÔÚÕâÖÖÇéÐÎÏ£¬Äú¿ÉÒÔÉèÖÃGitLabÒÔʹ¹¹½¨²»ÐèÒªÓû§ÃÜÂë¡£

½ÓÏÂÀ´£¬ÈÃÎÒÃÇÒ»Æð̽ÌÖÔõÑùͨ¹ý¼òÆӵİ취ʵÏÖ²»ÐèÒªÓû§ÃÜÂëÀ´¹¹½¨GitLab¡£

°ì·¨1£ºÉèÖÃSSHÃÜÔ¿

Ê×ÏÈ£¬ÄúÐèÒªÌìÉúSSHÃÜÔ¿¡£ÈôÊÇÄú»¹Ã»ÓÐÌìÉúSSHÃÜÔ¿£¬ÔòÓ¦¸ÃÊ×ÏÈÌìÉú¡£Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÔÚLinuxϵͳÉÏÌìÉúÃÜÔ¿£º

ssh-keygen -t rsa -C ¡°your_email@example.com¡±

µÇ¼ºó¸´ÖÆ

Ö´ÐдËÏÂÁÌìÉúÒ»¸öеÄSSHÃÜÔ¿¶Ô£¬²¢Ñ¯ÎÊÄúÒªÉúÑĹ«Ô¿ºÍ˽ԿµÄλÖá£

½ÓÏÂÀ´£¬½«¹«Ô¿Ìí¼Óµ½Óû§µÄGitLabÕÊ»§ÖС£ÒªÖ´Ðд˲Ù×÷£¬Çëתµ½GitLabÖеġ°Ð¡ÎÒ˽ÈË×ÊÁÏÉèÖá±²¿·Ö£¬È»ºóµ¥»÷¡°SSHÃÜÔ¿¡±Ñ¡Ï¡£ÔÚ´Ë´¦£¬Äú¿ÉÒÔ½«¹«Ô¿Ìí¼Óµ½ÄúµÄÕÊ»§ÖС£

°ì·¨2£ºÉèÖÿÍջΪSSH

ÏÖÔÚ£¬ÄúÐèÒª½«´æ´¢¿âÉèÖÃΪʹÓÃSSH¡£Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Íê³É´Ë²Ù×÷£º

git remote set-url origin git@gitlab.example.com:your-username/your-repo.git

µÇ¼ºó¸´ÖÆ

Çë×¢ÖØ£¬´ËÏÂÁî¼Ù¶¨ÄúÒѽ«ËùÓÐÐëÒªÐÅÏ¢Ì滻Ϊ׼ȷµÄÖµ¡£

°ì·¨3£ºÉèÖÃGitLab CI / CD

ÏÖÔÚ£¬ÄúÐèÒªÉèÖÃGitLab CI / CDÒÔ±êʶÄúµÄ´æ´¢¿â¡£Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Íê³É´Ë²Ù×÷£º

variables:
   GIT_STRATEGY: clone
   GIT_CHECKOUT: "false"
   GIT_SUBMODULE_STRATEGY: none
   GIT_DEPTH: "1"

µÇ¼ºó¸´ÖÆ

Çë×¢ÖØ£¬ÕâÊDZêʶ´æ´¢¿âËùÐèµÄ×îС±äÁ¿¡£Äú»¹¿ÉÒÔƾ֤ÐèÒªÌí¼ÓÆäËû±äÁ¿¡£

°ì·¨4£ºÉèÖÃGitLab Runner

×îºó£¬ÄúÐèÒªÔÚGitLab RunnerÉÏÉèÖÃÄúµÄ¹¹½¨¡£Äú¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Íê³É´Ë²Ù×÷£º

stages:
   - build

variables:
   GIT_CLEAN_FLAGS: "-ffdx"

build:
   stage: build
   script:
      - git clean ${GIT_CLEAN_FLAGS}
      - git fetch --all
      - git checkout ${CI_COMMIT_SHA}

µÇ¼ºó¸´ÖÆ

Çë×¢ÖØ£¬ÕâÊDZêʶÔËÐй¹½¨ËùÐèµÄ×îСÉèÖá£Äú»¹¿ÉÒÔƾ֤ÐèÒªÌí¼ÓÆäËû¾ç±¾¡£

½áÂÛ

ͨ¹ý×ñÕÕÕâЩ¼òÆӵİ취£¬Äú¿ÉÒÔÔÚGitLabÖй¹½¨£¬¶øÎÞÐèÇ¿ÖÆÓû§ÊäÈëÃÜÂë¡£Õ⽫ʹ´úÂë¹¹½¨Àú³ÌÔ½·¢¼òÆÓ£¬Ô½·¢Çå¾²£¬²¢ÇÒÄܹ»×ÊÖúÄú¸üºÃµØÖÎÀíÄúµÄ´úÂë¿â¡£

ÒÔÉϾÍÊÇÔõô²»ÐèÒªÓû§ÃÜÂë¹¹½¨gitlabµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

13452372176

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

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

QR code
ÍøÕ¾µØͼ