{"id":12351,"date":"2018-12-26T17:24:27","date_gmt":"2018-12-26T16:24:27","guid":{"rendered":"http:\/\/blog.wenzlaff.de\/?p=12351"},"modified":"2021-11-22T17:14:08","modified_gmt":"2021-11-22T16:14:08","slug":"wie-kann-von-einem-raspberry-pi-eine-buildpipeline-eines-gitlab-projekt-automatisch-antriggert-werden","status":"publish","type":"post","link":"http:\/\/blog.wenzlaff.de\/?p=12351","title":{"rendered":"Wie kann von einem Raspberry Pi eine Buildpipeline eines GitLab Projekt automatisch antriggert werden?"},"content":{"rendered":"<p>Zuerst muss f\u00fcr das GitLab Projekt ein Trigger eingerichtet werden. Das geht auf GitLab hier:<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.25.21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12355\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.25.21.png\" alt=\"\" width=\"1634\" height=\"1038\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.25.21.png 1634w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.25.21-300x191.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.25.21-768x488.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.25.21-1024x650.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Dann erscheint dieser Dialog, mit dem TOKEN:<!--more--><\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.26.07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12356\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.26.07.png\" alt=\"\" width=\"1566\" height=\"1119\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.26.07.png 1566w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.26.07-300x214.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.26.07-768x549.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-19.26.07-1024x732.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Dann kann der dort angegebene Token f\u00fcr ein antriggern mit <strong>curl<\/strong> verwendet werden. Es muss nur noch die <strong>ref<\/strong> angegeben werden, z.B. wenn der <strong>master<\/strong> angetriggert werden soll, oder ein Tag z.B. <strong>V1.0.0<\/strong><\/p>\n<p>Ich lasse den Trigger meines Testprojektes <strong>TWKaffee<\/strong> mal f\u00fcr einige Zeit aktiv, wer es ausprobieren will, kann diesen Befehl auf der Konsole des Raspberry Pi testweise angeben und hier<\/p>\n<p><a href=\"https:\/\/gitlab.com\/IT-Berater\/twkaffee\/-\/pipelines\" target=\"_blank\" rel=\"noopener\">https:\/\/gitlab.com\/IT-Berater\/twkaffee\/pipelines<\/a><\/p>\n<p>schauen, wie der automatische Build in der Pipeline l\u00e4uft &#8230;<\/p>\n<pre class=\"lang:default decode:true \">\r\n# den Tag \r\ncurl -X POST \\\r\n     -F token=cc9587aa44c37a91472c32622c91c1 \\\r\n     -F ref=V1.0.0 \\\r\n     https:\/\/gitlab.com\/api\/v4\/projects\/9920018\/trigger\/pipeline\r\n\r\n# oder den Master\r\n\r\ncurl -X POST \\\r\n     -F token=cc9587aa44c37a91472c32622c91c1 \\\r\n     -F ref=master \\\r\n     https:\/\/gitlab.com\/api\/v4\/projects\/9920018\/trigger\/pipeline\r\n<\/pre>\n<p>Liefert dann das Ergebnis:<\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.45.27.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12359\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.45.27.png\" alt=\"\" width=\"1484\" height=\"224\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.45.27.png 1484w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.45.27-300x45.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.45.27-768x116.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.45.27-1024x155.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n<p>Und hier l\u00e4uft die Pipeline &#8230;<\/p>\n<p><a href=\"https:\/\/gitlab.com\/IT-Berater\/twkaffee\/-\/pipelines\" target=\"_blank\" rel=\"noopener\"> https:\/\/gitlab.com\/IT-Berater\/twkaffee\/pipelines<\/a><\/p>\n<p><a href=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.47.00.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-12360\" src=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.47.00.png\" alt=\"\" width=\"1702\" height=\"426\" srcset=\"http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.47.00.png 1702w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.47.00-300x75.png 300w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.47.00-768x192.png 768w, http:\/\/blog.wenzlaff.de\/wp-content\/uploads\/2018\/12\/Bildschirmfoto-2018-12-20-um-20.47.00-1024x256.png 1024w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Zuerst muss f\u00fcr das GitLab Projekt ein Trigger eingerichtet werden. Das geht auf GitLab hier: Dann erscheint dieser Dialog, mit dem TOKEN:<\/p>\n","protected":false},"author":2,"featured_media":12349,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[220,852,2983,1023,2752,7],"tags":[377,3479,1603,325,3425,231,2970,3480],"class_list":["post-12351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-anleitung","category-heimautomatisierung","category-jenkins","category-raspberry-pi","category-raspberry-pi-zero-w","category-tools","tag-build","tag-build-pipeline","tag-curl","tag-git","tag-gitlab","tag-jenkins","tag-pipeline","tag-post"],"_links":{"self":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/12351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12351"}],"version-history":[{"count":0,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/posts\/12351\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=\/wp\/v2\/media\/12349"}],"wp:attachment":[{"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12351"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.wenzlaff.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}