How to update GitLab repository signing key

GitLab repository signing key was updated at the beginning of the April, so you can get an error during the signature verification.

This problem can be easily identified by NO_PUBKEY 3F01618A51312F3F message.

[email protected]:~$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                 
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic InRelease [23.3 kB]
Err:4 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic InRelease
  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
Fetched 201 kB in 2s (101 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
W: Failed to fetch https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/dists/bionic/InRelease  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3F01618A51312F3F
W: Some index files failed to download. They have been ignored, or old ones used instead.

Import missing public key using curl.

[email protected]:~$ curl --silent https://packages.gitlab.com/gpg.key | sudo apt-key add -
OK

Alternatively, import missing public key using gpg.

[email protected]$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
Executing: /tmp/apt-key-gpghome.d7F7ffwgwy/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 3F01618A51312F3F
gpg: key 3F01618A51312F3F: public key "GitLab B.V. (package repository signing key) " imported
gpg: Total number processed: 1
gpg:               imported: 1

Continue as usual.

[email protected]:~$ sudo apt update
Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]                                                               
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]                                                             
Get:4 https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu bionic InRelease [23.3 kB]                        
Fetched 201 kB in 2s (101 kB/s)     
Reading package lists... Done
Building dependency tree       
Reading state information... Done
5 packages can be upgraded. Run 'apt list --upgradable' to see them.

Additional information

Common installation problems

Cryptographic details related to `omnibus-gitlab` packages