Jenkins / LibVirt / Qemu / Fédora : Brouillon d’une tentative de mise en place …

!!! CECI EST UN BROUILLON !!!

Sur Jenkins j’ai mis le bon plugins : Libvirt Slaves

C’est pour l’instant en projet … mais j’essaye de faire une installation propre afin de facilité la validation automatique :

$ apt-get install qemu-kvm qemu virt-manager virt-viewer libvirt-bin

$ apt install libguestfs-tools

On télécharge pour une cible armhfp :

$ curl -O https://dl.fedoraproject.org/pub/fedora/linux/releases/30/Spins/armhfp/images/Fedora-Minimal-armhfp-30-1.2-sda.raw.xz
 
$ unxz Fedora-Minimal-armhfp-30-1.2-sda.raw.xz
 
$ sudo virt-builder -v -x --get-kernel Fedora-Minimal-armhfp-30-1.2-sda.raw
command line: virt-builder -v -x --get-kernel Fedora-Minimal-armhfp-30-1.2-sda.raw
virt-get-kernel --verbose -x --add 'Fedora-Minimal-armhfp-30-1.2-sda.raw'
libguestfs: trace: set_verbose true
libguestfs: trace: set_verbose = 0
libguestfs: trace: add_drive "Fedora-Minimal-armhfp-30-1.2-sda.raw" "readonly:true" "protocol:file"
libguestfs: creating COW overlay to protect original drive content
libguestfs: trace: get_tmpdir
libguestfs: trace: get_tmpdir = "/tmp"
libguestfs: trace: disk_create "/tmp/libguestfsEd6WdG/overlay1" "qcow2" -1 "backingfile:/home/farias/Fedora-Minimal-armhfp-30-1.2-sda.raw"
…
 
$ sudo mv Fedora-Minimal-armhfp-30-1.2-sda.raw initramfs-5.0.9-301.fc30.armv7hl.img vmlinuz-5.0.9-301.fc30.armv7hl /var/lib/libvirt/images/.
 
$ sudo virt-install -v --name Fedora-Minimal-armhfp-30-1.2-sda.raw --ram 4096 --arch armv7l --import --os-variant fedora22 \
                     --disk /var/lib/libvirt/images/Fedora-Minimal-armhfp-30-1.2-sda.raw \
                     --boot kernel=/var/lib/libvirt/images/vmlinuz-5.0.9-301.fc30.armv7hl,initrd=/var/lib/libvirt/images/initramfs-5.0.9-301.fc30.armv7hl.img,kernel_args="console=ttyAMA0 rw root=LABEL=_/ rootwait"

File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in 
SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

Pour fixer ce problème :

$ sudo rm -rf /usr/lib/python2.7/dist-packages/OpenSSL

$ sudo rm -rf /usr/lib/python2.7/dist-packages/pyOpenSSL-0.15.1.egg-info

$ sudo pip install pyopenssl

On reprends l’installation :

$ sudo virt-install -v --name Fedora-Minimal-armhfp-30-1.2-sda.raw --ram 4096 --arch armv7l --import --os-variant fedora22 \
                     --disk /var/lib/libvirt/images/Fedora-Minimal-armhfp-30-1.2-sda.raw \
                     --boot kernel=/var/lib/libvirt/images/vmlinuz-5.0.9-301.fc30.armv7hl,initrd=/var/lib/libvirt/images/initramfs-5.0.9-301.fc30.armv7hl.img,kernel_args="console=ttyAMA0 rw root=LABEL=_/ rootwait"

Pour l’instant j’ai un problème sur le lancement :

....
[  OK  ] Started udev Wait for Complete Device Initialization.
[  452.577419] audit: type=1130 audit(1568017972.419:65): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-udev-settle comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
         Starting Activation of DM RAID sets...
[  OK  ] Started Activation of DM RAID sets.
[  455.227583] audit: type=1130 audit(1568017975.069:66): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dmraid-activation comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  455.239316] audit: type=1131 audit(1568017975.081:67): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dmraid-activation comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Reached target Local Encrypted Volumes.
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /boot...
[  456.625813] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null)
[  OK  ] Mounted /boot.
         Mounting /boot/efi...
[  OK  ] Mounted /boot/efi.
[  OK  ] Reached target Local File Systems.
         Starting Tell Plymouth To Write Out Runtime Data...
         Starting Restore /run/initramfs on shutdown...
         Starting Create Volatile Files and Directories...
         Starting Rebuild Dynamic Linker Cache...
[  OK  ] Started Tell Plymouth To Write Out Runtime Data.
[  461.320751] audit: type=1130 audit(1568017981.162:68): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=plymouth-read-write comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  461.328420] audit: type=1131 audit(1568017981.170:69): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=plymouth-read-write comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Restore /run/initramfs on shutdown.[  461.762211] audit: type=1130 audit(1568017981.604:70): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=dracut-shutdown comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
 
[  OK  ] Started Rebuild Dynamic Linker Cache.
[  468.259621] audit: type=1130 audit(1568017988.101:71): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=ldconfig comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  OK  ] Started Create Volatile Files and Directories.
[  470.643545] audit: type=1130 audit(1568017990.485:72): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=systemd-tmpfiles-setup comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
         Starting Security Auditing Service...
         Starting Rebuild Journal Catalog...
[  473.210959] audit: type=1305 audit(1568017993.053:73): audit_enabled=1 old=1 auid=4294967295 ses=4294967295 subj=system_u:system_r:auditd_t:s0 res=1
[  OK  ] Started Rebuild Journal Catalog.
         Starting Update is Completed...
[  OK  ] Started Update is Completed.
[  OK  ] Started Security Auditing Service.
         Starting Update UTMP about System Boot/Shutdown...
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[  OK  ] Reached target System Initialization.
[  OK  ] Started daily update of the root trust anchor for DNSSEC.
[  OK  ] Listening on SSSD Kerberos…ache Manager responder socket.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Listening on D-Bus System Message Bus Socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
         Starting NTP client/server...
         Starting firewalld - dynamic firewall daemon...
         Starting OpenSSH ecdsa Server Key Generation...
         Starting OpenSSH rsa Server Key Generation...
         Starting Initial Setup configuration program...
         Starting System Security Services Daemon...
[  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
         Starting OpenSSH ed25519 Server Key Generation...
[  OK  ] Started dnf makecache --timer.
[  OK  ] Reached target Timers.
[ 2049.261075] fbcon: Taking over console
================================================================================
================================================================================
1) [x] Language settings                 2) [x] Time settings
       (English (United States))                (America/New_York timezone)
3) [x] Network configuration             4) [!] Root password
       (Wired (eth0) connected)                 (Password is not set.)
5) [!] User creation
       (No user will be created)

C’est super long pour avoir « fbcon » .

A suivre.

JENKINS : Mémo pour l’update (version 2.193)

En passant

Je me fais un petit mémo pour l’update de Jenkins :

jenkins:~$ sudo wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
--2019-09-04 08:08:33--  http://mirrors.jenkins-ci.org/war/latest/jenkins.war
Resolving mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)... 52.202.51.185
Connecting to mirrors.jenkins-ci.org (mirrors.jenkins-ci.org)|52.202.51.185|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://ftp-chi.osuosl.org/pub/jenkins/war/2.193/jenkins.war [following]
--2019-09-04 08:08:34--  http://ftp-chi.osuosl.org/pub/jenkins/war/2.193/jenkins.war
Resolving ftp-chi.osuosl.org (ftp-chi.osuosl.org)... 64.50.236.52, 2600:3402:200:227::2
Connecting to ftp-chi.osuosl.org (ftp-chi.osuosl.org)|64.50.236.52|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 78246752 (75M) [application/x-java-archive]
Saving to: ‘jenkins.war’
 
jenkins.war                               100%[=====================================================================================>]  74.62M  1.80MB/s    in 45s
 
2019-09-04 08:09:19 (1.66 MB/s) - ‘jenkins.war’ saved [78246752/78246752]
 
jenkins:~$ sudo systemctl stop jenkins
jenkins:~$ cp /usr/share/jenkins/jenkins.war jenkins.war.old
jenkins:~$ sudo mv jenkins.war /usr/share/jenkins/jenkins.war
jenkins:~$ sudo systemctl start jenkins

J’adore Jenkins 🙂

Jenkins & Confluence : Pour l’instant cela ne fonctionne pas

Ce qui est dommage c’est que le plugin n’indique pas quel est l’erreur … il y a seulement une exception sur un pointeur NULL. ( https://wiki.jenkins.io/display/JENKINS/Confluence+Publisher+Plugin )

ERROR: Build step failed with exception
java.lang.NullPointerException
       at rocks.inspectit.releaseplugin.releasenotes.ConfluenceReleaseNotesPublisher.perform(ConfluenceReleaseNotesPublisher.java:99)
       at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:45)
       at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
       at hudson.model.Build$BuildExecution.build(Build.java:206)
       at hudson.model.Build$BuildExecution.doRun(Build.java:163)
       at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
       at hudson.model.Run.execute(Run.java:1818)
       at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
       at hudson.model.ResourceController.execute(ResourceController.java:97)
       at hudson.model.Executor.run(Executor.java:429)
Build step 'Publish Release Notes on Confluence' marked build as failure

Misère.

Jenkins & Docker : /usr/bin/cat: cannot execute binary file

J’ai donc eu l’erreur : « /usr/bin/cat: cannot execute binary file » , pour voir l’erreur j’ai demandé les logs sur le container lancé par Jenkins.

$ docker logs f5e6fcc16971b888f8609f6436e18fbb8e313114878a15b916eeedd6b780f979
/usr/bin/cat: /usr/bin/cat: cannot execute binary file

Ensuite j’ai essayé de comprendre le problème dans ma pipeline ….

A la base j’avais :

pipeline {
   agent {
       docker {
           image 'my_image'
           args ' --name jenkins_my_image -u root --privileged=true -v /home/BUILD:/root/BUILD'
       }
   }
   ....

Et il fallait mettre :

pipeline {
   agent {
       docker {
           image 'my_image'
           args '--entrypoint="" --name jenkins_my_image -u root --privileged=true -v /home/BUILD:/root/BUILD'
       }
   }
   ....

Sachant que cela ne fonctionnait pas avec :

pipeline {
   agent {
       docker {
           image 'my_image'
           args '--entrypoint="/sbin/bash" --name jenkins_my_image -u root --privileged=true -v /home/BUILD:/root/BUILD'
       }
   }
   ....

Suivant les OS des containers le problème n’est pas visible, le problème est visible avec des anciens OS.

A suivre.