root@easyformer:~# docker exec -it jenkins bash jenkins@192:/$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/var/jenkins_home/.ssh/id_rsa): Created directory '/var/jenkins_home/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /var/jenkins_home/.ssh/id_rsa Your public key has been saved in /var/jenkins_home/.ssh/id_rsa.pub The key fingerprint is: SHA256:sj/ft651tSyUKHnOZ2X8hVuInHBKSpcBjQdQ9A6Mzpo jenkins@192.168.0.24 The key's randomart image is: +---[RSA 3072]----+ | .+==. | | o..oo | | . +.* . | | o . *.=.ooo | | + Sooo+oo++| | o o = . +o=| | E . o +ooo| | .. .o.o. | | .o. o+o. | +----[SHA256]-----+ jenkins@192:/$ ls ~/.ssh id_rsa id_rsa.pub jenkins@192:/$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/eX95bkbtGwbm00kdDbYfK++iQRG+8Q1G1niJSOIv323vbl3vnbILPNvFqIC8tGzzT/JwfkQHwAm6cxNRlMDW6OOZauVgdarY5K5BTM51CvwYN9NiSYCEIVGIYgbRTayn6LFyv8cUIAmd26eUoCF32zjp/daQK+QhDlVAfu0d2BPU+CFpi9XHp679k/8RR3cunWHHTSbN8Xn9D8VxpWcdXpMnFTDCJkLqlGHWHP1Zlk1w2P50ejTCE1OsHkdUlEy3qBBbiojtTAkaIpAXOnIcUt4foTN5Gv51RJIIggN7g0DV/zjR2gXYeUu9ehJGFus6GqDMnNm/PoAlwBOlznzBreSWUMlm3L9dyDg+Ak9zv/6H+pJBYE037CIX42Iyf/Umn6RL3ozdcvWwdS8ReaU2+Y6npy9/LuEe2Zltska+pIJCye+rNiT6/aim6hq+SBwKULLclnlk5Xa79YTx4oOgOs/SOJgcx2Y265kNEfgUub4S0JgwpPgZSUoDaGPF7Dk= jenkins@192.168.0.24 *** Add the key to GitLab http://192.168.0.24:40080/-/profile/keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/eX95bkbtGwbm00kdDbYfK++iQRG+8Q1G1niJSOIv323vbl3vnbILPNvFqIC8tGzzT/JwfkQHwAm6cxNRlMDW6OOZauVgdarY5K5BTM51CvwYN9NiSYCEIVGIYgbRTayn6LFyv8cUIAmd26eUoCF32zjp/daQK+QhDlVAfu0d2BPU+CFpi9XHp679k/8RR3cunWHHTSbN8Xn9D8VxpWcdXpMnFTDCJkLqlGHWHP1Zlk1w2P50ejTCE1OsHkdUlEy3qBBbiojtTAkaIpAXOnIcUt4foTN5Gv51RJIIggN7g0DV/zjR2gXYeUu9ehJGFus6GqDMnNm/PoAlwBOlznzBreSWUMlm3L9dyDg+Ak9zv/6H+pJBYE037CIX42Iyf/Umn6RL3ozdcvWwdS8ReaU2+Y6npy9/LuEe2Zltska+pIJCye+rNiT6/aim6hq+SBwKULLclnlk5Xa79YTx4oOgOs/SOJgcx2Y265kNEfgUub4S0JgwpPgZSUoDaGPF7Dk= jenkins@192.168.0.24 *** New credential http://192.168.0.24:8080/manage/credentials/store/system/domain/_/newCredentials Type SSH Username with private key Scope (Global (Jenkins, agents, items, etc...) ID jenkinsgitlabssh Enter directly Key ### Dashboard -> Administer Jenkins -> Security http://192.168.0.24:8080/manage/configureSecurity/ Git Host Key Verification Configuration Host Key Verification Strategy Accept first connection ### Create a token in GitLab http://192.168.0.24:40080/-/user_settings/personal_access_tokens glpat-LpjdaKoJTAjMabWUC3yd ### In Jenkins New credentials http://192.168.0.24:8080/manage/credentials/store/system/domain/_/newCredentials Type Secret text ID Jenkinsgitlabaccesstoken ### Install the GitLab plugin http://192.168.0.24:8080/manage/pluginManager/available ### Dashboard -> Administer Jenkins -> System http://192.168.0.24:8080/manage/configure GitLab Enable authentication for '/project' end-point GitLab connections Connection name A name for the connection Jenkinsgitlabconnection GitLab host URL The complete URL to the GitLab server (e.g. http://gitlab.mydomain.com) http://192.168.0.24:40080 Credentials API Token for accessing GitLab jenkinsgitlabaccesstoken *** Connection test Success ### Test with curl root@easyformer:~# docker exec -it -uroot jenkins bash root@192:/# curl http://192.168.0.24:40080/ You are being redirected.root@192:/# ### Dashboard -> EasyFormerPipeline -> Configuration http://192.168.0.24:8080/job/EasyFormerPipeline/configure Build when a change is pushed to GitLab. GitLab webhook URL: http://192.168.0.24:8080/project/EasyFormerPipeline Configure GitLab to deliver a POST request to your Jenkins instance like GitLab CI. Secret token If this is configured only WebHooks that have configured the same token can trigger a build. 11b263dbb6e2a1f398bee5f391e98041a5 ### GitLab Log in as admin http://192.168.0.24:40080/admin/application_settings/network Outbound requests Allow requests to the local network from hooks and integrations. Check the following options:  Allow requests to the local network from webhooks and integrations  Allow requests to the local network from system hooks ### Webhooks http://192.168.0.24:40080/Berechit/easyformer/-/hooks Webhooks enable you to send notifications to web applications in response to events in a group or project. We recommend using an integration in preference to a webhook. URL http://192.168.0.24:8080/git/notifyCommit?url=http://192.168.0.24:40080/Berechit/easyformer.git&token=75a8746bcf9c658b08491f27860f356d SSL verification Uncheck Check Enable SSL verification Trigger Check Push events ### Manage Jenkins" -> "Security" -> "Git plugin notifyCommit access tokens Generate a token 1. From your Jenkins instance, go to Manage Jenkins → Configure Global Security. 2. Find the Git plugin notifyCommit access tokens section. 3. Click Add new access token. 4. Enter the token name and click Generate. 5. Jenkins generates the notifyCommit token required in the Bitbucket Jenkins Base dialog. http://192.168.0.24:8080/manage/configureSecurity/ Git plugin notifyCommit access tokens Current access tokens Nissan 75a8746bcf9c658b08491f27860f356d ### Test Push events Hook executed successfully: HTTP 200