On Fri, Sep 15, 2017 at 10:43 AM, 'Alexandra Goultiaeva' via Jenkins
Developers <
jenkin...@googlegroups.com> wrote:
> Do I understand it correctly, that you are suggesting that we make the base
> class implement SimpleBuildStep, which will allow it to be used in a
> pipeline
Correct.
> but will not expose it as a Build step for Freestyle project?
Ignored by freestyle projects. If it is a `Publisher`, it will be
offered as a post-build action; if a `Builder`, as a build step.
> There's some teams unable to switch to pipeline for other compatibility
> reasons
Please make sure those are filed in JIRA.
> we wanted to allow them to use the upload step as a build step as
> well.
Then make a separate `Builder` (which would be the more natural one to
mark as a `SimpleBuildStep` as well, if you have to choose). Obviously
most implementation can be shared via a utility class.
> As a next step, we planned to add Download functionality, making this plugin
> no longer only relevant to post-build - or do you feel that functionality
> would be better as a separate plugin?
Sounds appropriate as a build step in the same plugin. Again it could
be useful from Pipeline.
As a general matter I recommend developers stay away from overly
specific plugin features like “upload this to Google Storage if the
build is stable” or “download this from Google Storage and unzip to
the workspace”. Again I know nothing about the specifics of your
plugin, but you can consider a different style: have the project’s
`Makefile` / `pom.xml` / `build.gradle` / etc. actually do those
things if, when, and how it chooses. Presumably using some kind of
convenient CLI tool specific to the service—you do have a nice,
tested, well-documented CLI somewhere, right?—and limit the Jenkins
plugin to the minimum necessary to set up an environment conducive to
running that tool. Typically this would be a `SimpleBuildWrapper`
(usable equally from freestyle or Pipeline), for example integrating
with the `credentials` plugin to let a project configure an access
token or whatever to connect to the service account; perhaps using
`ToolInstallation` to ensure that your CLI is installed and ready in
`$PATH` (for those benighted users who are not yet running all builds
inside a reproducible Docker image).