Blame view

README.md 3.44 KB
7dea088a   jenkins   complete first co...
1
2
3
4
5
6
7
  Explanation on usage:
  If ‘Type: ‘ is in front of it, that is a command that should be put on the commandline.
  
  OSDev Jenkins setup:
  
  192.168.1.220 (curie)
  Fedora 35 server
3293ce29   jenkins   updated README.md...
8
9
  Go to the directory where the Dockerfile is located (usually /root/docker_jenkins) as root or import from git.
  git clone git@gitlab.osdev.nl:jenkins/docker_jenkins.git
7dea088a   jenkins   complete first co...
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
  
  Dockerfile:
  FROM jenkins/jenkins:lts-jdk11
  USER root
  RUN apt update && \
      apt install -y --no-install-recommends openssh-client build-essential gnupg curl cmake libboost* libpaho* ca-certificates apt-transport-https && \
      curl -sSfL https://apt.octopus.com/public.key | apt-key add - && \
      sh -c "echo deb https://apt.octopus.com/ stable main > /etc/apt/sources.list.d/octopus.com.list" && \
      apt update && apt install -y octopuscli
  RUN echo "jenkins ALL=NOPASSWD: ALL" >> /etc/sudoers
  USER jenkins
  
  
  Setting up the docker image:
  Type: docker build .
  
  copy the hexstring behind “Succesfully built [hexstring]” and past the hexstring behind the following command:
  
  Type: docker run -d --name=osdev_jenkins -p 8080:8080 -p 50000:50000 --restart=on-failure [hexstring]
  
  type: docker ps -a
  to check if the docker container is made, up and running.
  
  Log into the docker container:
  Type: docker exec -it osdev_jenkins bash
  
  Type: cd
  Type: ssh-keygen (to create the private and public key pair for ssh connectivity)
  (choice to put in passphrase, up to you, but need to be remembered for the ssh connectivity of jenkins to other applications)
  
  copy the content of id_rsa.pub to gitlab user jenkins as public key.
  Now to establish a connection and verify the host key, do the following:
  Type: cd
  Type: git clone git@gitlab.osdev.nl:open_source/mqtt-cpp.git
  Type: yes
  Type: rm -rf mqtt-cpp
  
  Backend is now setup.
  Last thing to do is the following:
  Type: cat /var/jenkins_home/secrets/initialAdminPassword
  select and copy the result.
  
  ######################################################################################
  Setting up jenkins frontend:
  
  go to 192.168.1.220:8080 OR office.osdev.nl:18080
  and follow the next steps to setup jenkins.
  
  First paste the initialAdminPassword result into the textbox and accept.
  
  Create an admin user:
  name: jenkins
  password: *jenkins password* (remember this one!)
  email: jenkins@osdev.nl
  
  Then go for the "Select which plugins to install" option and search for gitlab.
  Select it and begin installation.
  
  Extra plugins to install:
  - generic-webhook-trigger (only available AFTER the initial setup, so install first, find the plugin through “manage plugins” later and install)
  
  
  SSH credentials in Jenkins:
  create a user “jenkins” and go to “users” "jenkins" “credentials”
  Option: SSH connection with private key
  Description: gitlab_ssh
  
  copy the private key from the container.
  
  How to copy the private file content to jenkins frontend:
  docker exec -it osdev_jenkins bash
  cd .ssh
  cat id_rsa
  copy ALL content of the file
  
  In the gitlab_ssh configuration, find the private key header, select "enter directly" and paste the contents of the private keyfile
  
  
  Add a job:
  Description: mqtt-cpp_build
  GitLab Connection:
  select your gitlab_ssh connection.
  
  Building steps:
  execute shell script
  
  add the cursive text (without asterixes) to the script frame:
  
  step 1:
  
  *cd /var/jenkins_home/workspace/mqtt-cpp_build
  rm -rf mqtt-cpp*
  
  
  Now add another buildstep with a shell script:
  
  step 2:
  
  *git clone git@gitlab.osdev.nl:open_source/mqtt-cpp.git
  cd mqtt-cpp
  scripts/setup_submodules -i
  mkdir build
  cd build
  cmake ../
  make*