User Tools

Site Tools


инструмент_jenkins

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
инструмент_jenkins [2024/03/13 15:33]
val [Подключение агента]
инструмент_jenkins [2024/09/19 08:20] (current)
val [Запуск агента через SSH]
Line 1: Line 1:
 ====== Инструмент Jenkins ====== ====== Инструмент Jenkins ======
  
-  * [[https://hevodata.com/learn/gitlab-webhook-jenkins-integration/​|GitLab Webhook Jenkins Integration:​ Automating Jobs Simplified 101]] +  * [[https://www.jenkins.io/doc/book/system-administration/​admin-password-reset-instructions/|Reset the administrator password]]
-  * [[https://​gcube.wiki.gcube-system.org/gcube/​Gitea/​Jenkins:​_Setting_up_Webhooks|Gitea/​Jenkins:​ Setting up Webhooks]]+
  
  
 ===== Установка ===== ===== Установка =====
  
-  * [[Сервис JRE]]+  * [[Сервис JRE]]  
   * [[https://​www.jenkins.io/​doc/​book/​installing/​linux/​|Debian/​Ubuntu Long Term Support release]]   * [[https://​www.jenkins.io/​doc/​book/​installing/​linux/​|Debian/​Ubuntu Long Term Support release]]
   * [[https://​pkg.jenkins.io/​debian-stable/​]]   * [[https://​pkg.jenkins.io/​debian-stable/​]]
  
-  * !!! В текущей версии устанавливается так:+==== !!! Обратитесь к преподавателю !!! ==== 
 +  * В текущей версии устанавливается так:
 <​code>​ <​code>​
 # wget -O /​usr/​share/​keyrings/​jenkins-keyring.asc https://​pkg.jenkins.io/​debian-stable/​jenkins.io-2023.key # wget -O /​usr/​share/​keyrings/​jenkins-keyring.asc https://​pkg.jenkins.io/​debian-stable/​jenkins.io-2023.key
Line 21: Line 21:
 # apt-get update # apt-get update
  
-sudo apt-get install fontconfig openjdk-17-jre+# apt-get install fontconfig openjdk-17-jre
  
-sudo apt-get install jenkins+# apt-get install jenkins
 </​code>​ </​code>​
 ==== Смена порта ==== ==== Смена порта ====
Line 51: Line 51:
  
   * [[https://​medium.com/​@med446/​setting-up-a-jenkins-slave-a7000358c557|Setting up a Jenkins Agent]]   * [[https://​medium.com/​@med446/​setting-up-a-jenkins-slave-a7000358c557|Setting up a Jenkins Agent]]
-  * [[https://​www.jenkins.io/​blog/​2022/​12/​27/​run-jenkins-agent-as-a-service/​|Create a new Jenkins node, and run your Jenkins agent as a service]]+
   * [[Сервис JRE]]   * [[Сервис JRE]]
- 
-  * !!! В текущей версии надо: Agents Dashboard -> Manage Jenkins -> Security -> TCP port for inbound agents: Random 
  
 <​code>​ <​code>​
Line 60: Line 58:
 </​code>​ </​code>​
   * [[Пакет sudo]]   * [[Пакет sudo]]
 +==== Агент подключается к контроллеру ====
 +
 +  * !!! В текущей версии нужно: Dashboard -> Manage Jenkins -> Security -> TCP port for inbound agents: Random
 +  * Требуется [[https://​plugins.jenkins.io/​instance-identity/​|Instance Identity]] plugin
 +
 +
 <​code>​ <​code>​
 Dashboard->​Set up an agent->​Create a new node  Dashboard->​Set up an agent->​Create a new node 
Line 67: Line 71:
   Remote root directory: /​home/​jenkins/​   Remote root directory: /​home/​jenkins/​
   ...   ...
-  ​Use WebSocket: yes   !!! В текущей версии не нужно+  ​Способ запуска 
 +    Запустить агент, подключив ​его к контроллеру
   ...   ...
 </​code><​code>​ </​code><​code>​
Line 77: Line 82:
  
 jenkins@gate:​~$ java -jar agent.jar -jnlpUrl http://​server.corpX.un:​8081/​computer/​gate/​jenkins-agent.jnlp -secret NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -workDir "/​home/​jenkins/"​ jenkins@gate:​~$ java -jar agent.jar -jnlpUrl http://​server.corpX.un:​8081/​computer/​gate/​jenkins-agent.jnlp -secret NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN -workDir "/​home/​jenkins/"​
 +...
 +INFO: Connected
 +</​code>​
 +
 +  * [[https://​www.jenkins.io/​blog/​2022/​12/​27/​run-jenkins-agent-as-a-service/​|Create a new Jenkins node, and run your Jenkins agent as a service]]
 +  * [[Управление сервисами в Linux#​Система загрузки Systemd]]
 +
 +==== Запуск агента через SSH ====
 +
 +  * Требуется [[https://​plugins.jenkins.io/​ssh-slaves/​|SSH Build Agents]] plugin
 +
 +<​code>​
 +gate# passwd jenkins
 +</​code>​
 +<​code>​
 +Dashboard->​Set up an agent->​Create a new node 
 +  Node name: gate
 +  Type: Permanent Agent
 +  ...
 +  Remote root directory: /​home/​jenkins/​
 +  ...
 +  Способ запуска
 +    Launch Agent via SSH
 +  ...
 +  Host: gate
 +  Credentials ...
 +  Host Key Verification Strategy: Non ...
 +  ...
 </​code>​ </​code>​
  
Line 92: Line 125:
   Git:   Git:
     Repository URL: http://​server.corpX.un:​3000/​student/​dhcp.git     Repository URL: http://​server.corpX.un:​3000/​student/​dhcp.git
-...    +... 
 +  Branch Specifier: */* 
 +...
 Build Steps Build Steps
   Execute shell:   Execute shell:
Line 115: Line 150:
   Pipeline script from SCM   Pipeline script from SCM
     Repository URL: http://​server.corpX.un:​3000/​student/​dhcp.git     Repository URL: http://​server.corpX.un:​3000/​student/​dhcp.git
 +    ​
 +  Branches to build: */*
 </​code>​ </​code>​
  
Line 147: Line 184:
 ==== Webhooks ==== ==== Webhooks ====
  
 +  * [[https://​hevodata.com/​learn/​gitlab-webhook-jenkins-integration/​|GitLab Webhook Jenkins Integration:​ Automating Jobs Simplified 101]]
   * [[https://​gcube.wiki.gcube-system.org/​gcube/​Gitea/​Jenkins:​_Setting_up_Webhooks|Gitea/​Jenkins:​ Setting up Webhooks]]   * [[https://​gcube.wiki.gcube-system.org/​gcube/​Gitea/​Jenkins:​_Setting_up_Webhooks|Gitea/​Jenkins:​ Setting up Webhooks]]
 +
  
 <​code>​ <​code>​
инструмент_jenkins.1710333207.txt.gz · Last modified: 2024/03/13 15:33 by val