Skip to content

digamma-ai/drone-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drone-helper

A simple way to accomplish two common tasks in Drone CI: caching and notifications.

Notifications

drone-helper notify is essentially a convenience wrapper over shoutrrr. All it does is gather the relevant build info from Drone, arrange it into a rich text message in a format supported by the respective platform and send it.

Supported services

Discord

  - name: notify
    image: zoickx/drone-helper
    commands:
      - drone-helper notify --discord
    settings:
      discord_webhook_token:
        # ex. value: hcXPnPGg_w6ZCPF-4OkLMn7nyTxEbZKex2R2suPNyUTWVl89ij9Qd46DosbREhnykUm4
        from_secret: discord_token 
      discord_webhook_id:
        # ex value: 1125469839924488938
        from_secret: discord_id

Slack

  - name: notify
    image: zoickx/drone-helper
    commands:
      - drone-helper notify --slack
    settings:
      slack_webhook_token:
        # ex. value: T15S51XNJSJ-B05T0LOP280-n8zDEin7EmijY0iCuaISBDay
        from_secret: discord_token

Caching

drone-helper cache implements full-system caching via Docker (a practice endorsed by the developer). A cache is uniquely identified by its build dependencies (--deps), and will be rebuilt if any one changes.

Usage

  1. drone-helper cache must be run before any steps using the cache (even if cache exists and doesn't need rebuilding).
  2. The repository must be "Trusted" in Drone (Settings -> General -> Project Settings -> Trusted)
  3. The step invoking drone-helper cache must mount the host's docker.sock.
  4. Subsequent steps that need to use the cache must be run in exactly:
    image: cache--${DRONE_REPO}:${DRONE_COMMIT_AFTER}
    pull: never

Example pipeline

---
kind: pipeline
type: docker
name: default

volumes:
  - name: dockersock
    host:
      path: /var/run/docker.sock

steps:
  - name: rebuild-cache
    image: zoickx/drone-helper
    commands:
      - drone-helper cache --deps="Dockerfile dependencies.json"
    volumes:
      - name: dockersock
        path: /var/run/docker.sock

  - name: run-in-cache-1
    image: cache--${DRONE_REPO}:${DRONE_COMMIT_AFTER}
    pull: never
    commands:
      - echo "This command will be run in cache. [1]"

  - name: run-in-cache-2
    image: cache--${DRONE_REPO}:${DRONE_COMMIT_AFTER}
    pull: never
    commands:
      - echo "This command will be run in cache. [2]"

  - name: notify
    image: zoickx/drone-helper
    commands:
      - drone-helper notify --discord
    settings:
      discord_webhook_token:
        from_secret: discord_token
      discord_webhook_id:
        from_secret: discord_id

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published