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