New orb: leanpub

#1

Hi,

I’m not sure if it’s good etiquette to post announcements for new orbs here (please let me know if this is the case). I wrote a new orb for automating Leanpub API operations, to automate my book preview/publishing workflow. Thought others who use Leanpub might find it useful.

Orb: https://circleci.com/orbs/registry/orb/zzamboni/leanpub
Orb source (it’s my first orb, feedback appreciated!): https://github.com/zzamboni/leanpub-orb
Blog post describing how I use it: https://zzamboni.org/post/automating-leanpub-book-publishing-with-hammerspoon-and-circleci/

2 Likes

#2

@zzamboni Definitely, that’s a great use of the Orbs channel here, so thanks!

@tomtrahan Any interest in reaching out to Leanpub—maybe they’d be interested in adopting @zzamboni’s work so it can become an official partner orb?

0 Likes

#3

@zzamboni I can offer some fuller feedback later, but glancing over this orb quickly, one thing that stands out—

Anywhere you have a parameter whose default value is an environment variable (e.g, $LEANPUB_API_KEY), I would strongly encourage you to change that parameter’s type to env_var_name:

https://circleci.com/docs/2.0/reusing-config/#environment-variable-name

That way, it’s 100% explicit to users that they should not pass sensitive data like API keys, etc., to the orb as string literals.

But generally, the orb looks very full-featured, and I appreciate the usage example, as well—great work! @zzamboni

2 Likes

#4

Hi @zzamboni - This is really interesting and unique. Great work! I think your orb covers the use case well, so I’m not planning to reach out to Leanpub separately.

1 Like

#5

@rose, @tomtrahan - thanks for the kind words! I have been invited to appear in an upcoming episode of Leanpub’s Frontmatter author podcast, so I might mention this there as well. I’ll post an update here if/when this happens.

@rose: thanks for the feedback about the env_var_name parameters. I have updated my orb to use it. I have one question: is it possible to specify that an env var parameter must be specified (i.e. that the corresponding environment variable must be defined)? At the moment I had to insert check code to make sure the job fails when the variable is not defined, like this: https://github.com/zzamboni/leanpub-orb/blob/master/src/%40orb.yml#L87-L90

Thanks again for the feedback and the encouragement - I look forward to any other comments you may have.

2 Likes

#6

@zzamboni No, what you’re doing there is great. It’s not that much boilerplate, but still, it’s a common-enough situation that we could probably abstract that logic into its own orb command. Something like check-env-var-param. It would probably be a great fit for our Orb Tools orb:

0 Likes