GitLab retry all failed jobs

Sometimes maybe you have a problem with the runner configuration or the test docker image and then all jobs will fail. Its really hard to retry all jobs manually and in GitLab there is no build in future to do this over the web interface. There is a easy way in GitLab retry all failed jobs.

First you must open the gitlab rails console:

If you using the docker image from gitlab:

sudo docker ps
CONTAINER ID        IMAGE                     COMMAND                  CREATED             STATUS                    PORTS                                                                                                                  NAMES
c21d357eeca6        gitlab/gitlab-ee:latest   "/assets/wrapper"        32 minutes ago      Up 32 minutes (healthy)   159.168.170.154:22->22/tcp, 159.168.170.154:80->80/tcp, 159.168.170.154:443->443/tcp, 159.168.170.154:4567->4567/tcp   gitlab

docker exec -it c21d357eeca6 gitlab-rails console

Or if you using the package installation:

sudo gitlab-rails console

In the gitlab-rails console now you can write ruby code and talk to the system:

If you like to retry all jobs from all projects you can run this:

# First assign a user to user variable
user = User.find_by(username: 'your username here')

# Find all failed jobs
job = Ci::Build.find_by_sql("select * from ci_builds where status = 'failed'")

job.each { |j| Ci::Build.retry(j, user) }

If you like to retry only all jobs from a specific project:

Find the project_id with the url:

https://git.safematix.com/api/v4/projects/safematix%2Ftomcat_databag

After projects its group/project_name. 🙂

Now copy the id and use this for the db search string!

#First assign a user to user variable
user = User.find_by(username: 'your username here')

# Find all failed jobs for the project with the id 62
job = Ci::Build.find_by_sql("select * from ci_builds where status = 'failed' and project_id = '62'")

job.each { |j| Ci::Build.retry(j, user) }

Import and rename duplicated volume group

If you like to use a cloned volume with a volume group on it, then normally you will have a problem with the VG UUID and the VG Name. The good answer there is a nice solution for the problem and you can import and rename duplicated volume groups.

To rename and generate a new UUID for the volume group on the volume use the program vgimportclone.

sudo gimportclone -n old /dev/sdb1
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: Activation disabled. No device-mapper interaction will be attempted.
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
Physical volume "/tmp/snap.cozRdFdC/vgimport0" changed
1 physical volume changed / 0 physical volumes not changed
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: Activation disabled. No device-mapper interaction will be attempted.
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
Volume group "system" successfully changed
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it!
Volume group "system" successfully renamed to "old"
Reading all physical volumes. This may take a while...
Found volume group "system" using metadata type lvm2

After the successfully rename of the volume group activate it.

sudo vgchange -a y

Now you can use the renamed volume group old normally as other volume groups.

xfs filesystem duplicate UUID

If you clone a volume with xfs filesystem on it and you try to mount this on the same node, than normally you will receive error messages, like wrong fs type, bas superblock,… you have the problem with xfs filesystem duplicate UUID.

In the dmesg you should file a message like:

XFS: Filesystem sdb1 has duplicate UUID - can't mount.

If its a one time mount you can do it with:

sudo mount -o nouuid /dev/sdb1 /mnt

But the better solution is to generate a new uuid for the filesystem, because its clean and you can mount it easy without problems:

sudo xfs_admin -U generate /dev/sdb1
Clearing log and setting UUID
writing all SBs
new UUID = 01fbb4f2-1ers0-4dde-94fc-024efb3cd2a4
after that, you can mount this XFS partition regularly.

Then mount the volume normally with mount:

sudo mount /dev/sdb1 /mnt

sudo with Touch ID on macOS

Apple Touch ID with sudo in macOS

If you like to integrate Touch ID in sudo, you can do this easily in macOS and use the fingerprint.

Integration in sudo

Just edit the /private/etc/pam.d/sudo file and put a line inside.

sudo -e /private/etc/pam.d/sudo

Put the following information inside:

auth       sufficient     pam_tid.so

The file should look like:

# sudo: auth account password session
auth       sufficient     pam_tid.so
auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

Testing

To test the integration, just echo with sudo.

sudo echo "test"
sudo with Touch ID
sudo with Touch ID

Macbook delete fingerprint information

Apple fingerprint information clear

If you want to return, repair or sell your Apple device. Then you should make sure that all data is deleted. This way the fingerprint information should also be deleted.

Clear Touch Bar information

To delete the fingerprint information, the Apple device must be set to Recorvery mode and open the Terminal.

  1. Restart
  2. Hold down Command-R
  3. Utilities -> Terminal
xartutil –erase-all

You get the question if you are sure, you have to confirm this with “yes” and press Return.

Checking

After rebooting, you can easily check the settings to see if it worked.

no fingerprint

git commit forget Signed-off-by

If you forget to set “Signed-off-by” in the commit. This is now problem, you can still do it afterwards.

To sign-off the last two commits:

git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: Your Name '" HEAD~2..HEAD

Then force to push them to the remote repo with the -f option:

git push -f

macOS Sierra – [warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

If you have problems, when you update to macOS Sierra and receive this message:

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0

Reinstall with brew libevent package:

brew reinstall libevent
==> Reinstalling libevent
==> Downloading https://homebrew.bintray.com/bottles/libevent-2.0.22.sierra.bottle.1.tar.gz
######################################################################## 100,0%
==> Pouring libevent-2.0.22.sierra.bottle.1.tar.gz
🍺  /usr/local/Cellar/libevent/2.0.22: 734 files, 2.0M

Linux, BSD, Unix and Security tips