Halo, kalau kamu merasa tulisan saya ngebantu kamu, kamu bisa ucapkan terima kasih lewat saweria .

If you feel this website help you, you can donate at saweria .



Setup Telegram Bot Gitlab Pipelines Paling Gampang

Cara yang di share blog sandeep.ramgolam.com ini udah yang paling gampang, banget…

Gampang Bingit Ini Mah..

Gampang Bingit Ini Mah..

Tapi ada aja case lain yang menyebabkan kita ga bisa gunakan cara di atas atau memang kita cuma butuh notifikasi simpel di telegram.


Cara Lain yang Juga Gampang

Untuk notifikasi simpel ke telegram ini kita bakal gunakan apprise .

Selain mendukung telegram, apprise ini mendukung service lain seperti Slack, AWS SES, dll

Berikut cara setup telegram notif di gitlab pipelines

  1. Tambahkan line berikut di .gitlab-ci.yml
deploy:
    stage: deploy
    script: |
      echo "hello!"      

notify:
    stage: notify
    image: python:3.9-slim 
    # avoid use alpine to avoid depedencies problem
    # avoid use apprise docker images because it was really big...
    before_script:
      - pip install apprise
    script: |
      apprise -vv --body="Your message!" \
      tgram://1234567:yourTokenBot/-yourGroupID \      
    #need deploy stage to run
    needs: ["deploy"]
Gampang juga kan?

Gampang juga kan?

Sumber:

stackoverflow - How to send notification to Telegram from GitLab pipeline?