Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CI/CD для Go проектов на drone.io

CI/CD для Go проектов на drone.io

Iskander (Alex) Sharipov

February 08, 2020
Tweet

More Decks by Iskander (Alex) Sharipov

Other Decks in Programming

Transcript

  1. drone • open source (github.com/drone/drone), написан на Go • container

    native CI/CD платформа (все есть контейнер) • простая конфигурация через drone.yml (YAML/Jsonnet/ Starlark) • поддержка GitHub, Bitbucket, GitLab, Gogs, Gitea • система плагинов (любой контейнер может быть плагином) • поддержка kubernetes !2
  2. community vs enterprise Community • бесплатно • self-hosted* • single-instance

    • pipeline plugins !3 Enterprise • от 299$ в месяц • cloud или self-hosted • autoscaling • external secrets stores • pipeline + system plugins https://drone.io/enterprise/features/
  3. enterprise for free? • для open source проектов (cloud.drone.io) •

    первые 5000 билдов (self-hosted, official docker image) • для компаний/стартапов с годовой выручкой < $1 млн !4 https://discourse.drone.io/t/licensing-and-subscription-faq/3839
  4. run via docker-compose !7 version: '2.2' services: drone-server: image: drone/drone:1.6

    restart: always https://docs.drone.io/installation/providers/github/ ports: - 80:80 - 443:443 volumes: - ./drone-data:/data environment: - DRONE_TLS_AUTOCERT=true - DRONE_SERVER_HOST=drone.example.ru - DRONE_AGENTS_DISABLED=true - DRONE_GITHUB_CLIENT=gh_client_id - DRONE_GITHUB_SECRET=gh_secret_key
  5. .drone.yml kind: pipeline steps: - name: test image: golang commands:

    - go test - go build - name: publish image: plugins/docker settings: repo: octocat/hello-world tags: [ latest, 1.0, 1 ] !9
  6. .drone.yml (2) kind: pipeline name: admin-service-build steps: - name: gcr

    image: plugins/gcr settings: registry: gcr.io repo: kazanexpress/${DRONE_REPO,,} volumes: - name: docker-volume path: /var/run/docker.sock - name: deploy image: quay.io/honestbee/drone-kubernetes settings: container: admin deployment: admin repo: gcr.io/kazanexpress/${DRONE_REPO,,} environment: KUBERNETES_TOKEN: from_secret: kubernetes_token !10
  7. disadvantages • мало документации, не все фичи задокументированы • configuration

    duplication* • сравнительно мало плагинов • случайные ошибки и падения во время билдов (редко) !13
  8. advantages • простой и быстрый • open source • golang

    • плагины • “системные” плагины • сообщество в discourse !14
  9. resources • простой плагин с демо - https://github.com/alikhil/simple-drone-webhook-plugin • https://www.slideshare.net/appleboy/drone-cicd-platform

    • официальный сайт - https://drone.io • документация - https://docs.drone.io • плагины (тут не все) - http://plugins.drone.io/ • форум - https://discourse.drone.io • шаблон для плагинов https://github.com/drone-plugins/boilr-plugin • еще плагины - https://github.com/appleboy !16
  10. Open Source vs Enterprise Is Drone Enterprise Edition Free? Yes,

    the official docker image provides free access to all Drone Enterprise features, for up to 5,000 builds. This includes both commercial and non- commercial use. Can I Remove the Build Limit? Yes, you can remove the 5,000 build limit by purchasing a commercial license. Or if you qualify for free use you can build the Enterprise Edition from source and remove all limits by compiling with the nolimit build tag. Or you can downgrade to the Open Source Edition. Источник: Licensing and Subscription FAQ (https://discourse.drone.io/t/ licensing-and-subscription-faq/3839) !17