3 ms·
Orb is actually a Docker image (executor) plus few defined commands. Say, if you want to build a custom Slack notification for multiple projects, you'd create a
by sirn 8y ago
Orb is actually a Docker image (executor) plus few defined commands. Say, if you want to build a custom Slack notification for multiple projects, you'd create an Orb with an executor and a command, e.g.
executors:
alpine:
docker:
- image: alpine:3.6
parameters:
webhook_url:
description: URL to Slack webhook
type: string
message:
description: Message to post to Slack
type: string
commands:
notify:
description: "Notify Slack"
executor: alpine
steps:
- run:
name: Notify Slack
command: |
curl -X POST -H 'Content-Type: application/json' --data "{ \
\"attachments\": [ \
{ \
\"fallback\": \"<<parameters.message>>\", \
\"text\": \"<<parameters.message>>\", \
\"mrkdwn\": true, \
\"color\": \"#1cbf43\", \
} \
] \
}" <<parameters.webhook_url>>
So if I publish this Orb as say sirn/slack@dev, anyone can use this Orb in their build pipeline with:
orbs:
slack_notify: sirn/slack@dev
workflow:
foo:
jobs:
- slack/notify:
webhook_url: "..."
message: "..."
I've been using Orb for the past month and I see Orb as a more of a way to share common steps definition (à la Ansible Galaxy) than something of Apt/Brew/NixPkg caliber. It's convenient in CircleCI's context, and easier to get started than trying to build a shared Jenkins Pipeline Scripts, but it's still weird that we're programming in YAML leveraging shell scripts instead of going directly to shell script (which is part of why I love builds.sr.ht).
- peterwwillis 8y agoMan, that's terrible. How the hell are you supposed to syntax check that, or version control it, or collaborate on it? Extract it from yaml, do a thing, test it, then put it back in yaml, then run it and test it again? And if anyone else wants to make a change to your change, they now have to do the same? What a pain in the ass. If this is all Docker containers anyway, why aren't they just creating Docker images and referencing them? They're just shoving a Dockerfile into YAML, without the benefit of it actually being a Dockerfile.