On Wed, Mar 7, 2018 at 1:04 PM Jesse Glick <[email protected]> wrote:

> On Tue, Mar 6, 2018 at 4:23 PM, Kohsuke Kawaguchi <[email protected]> wrote:
> > I have another idea. Instead of
> > running Jenkinsfile in this CLI and try to emulate your Jenkins instance
> as
> > closely as possible (in terms of configuration), we could just run
> > Jenkinsfile in the current Jenkins, in a place that nobody else can see.
>
> In principle this is possible, by defining a new implementation of
> `FlowExecutionOwner` that is not based on a `Run`. We have in the past
> discussed the possibility of a Pipeline equivalent to the `/script`
> console.
>

Thanks for the tip. I was actually thinking about creating a full blown
WorkflowJob that's just so happen to be invisible to anyone. Do you think
that would work better/worse?

I doubt this would be a very satisfactory solution to the use case at
> hand, though. Any step which required a `Run` context (either
> mandatory, as in `StepDescriptor.getRequiredContext`, or optionally,
> by checking for null from `StepContext.get(Run.class)`) would either
> fail or behave in some reduced capacity. If you took care to only
> write `Jenkinsfile`s that just used `node` and `sh` and the like and
> none of these features, then fine. But a lot of common functionality
> does assume it has a `Run` context: anything that looks up
> folder-scoped environment variables or credentials; `junit`,
> `milestone`, `lock`, `stash`; everything based on `SimpleBuildStep` or
> `SimpleBuildWrapper`…a lot. You could create a temporary `WorkflowJob`
> in the same folder and hack around with access control so that it is
> only visible to the invoking user, which would let most of these
> things work (probably with some specialized support for branch
> projects), but this seems like it is asking for trouble.
>

IIUC, creating invisible WorkflowJob would bypass these problems.

I think it would be far more practical to work with the existing
> Replay feature, which was designed for precisely this use case. If the
> main objection to using Replay is that you do not want these
> experimental builds to “pollute” the general build history, then we
> can do some minor UI work (for example in Blue Ocean) to hide these
> build records by default. There is already a plan to do something very
> similar for restarted stages (JENKINS-48643). We could even stream the
> build log to the CLI command (JENKINS-33438) and then add an option to
> delete the build as soon as it completes—a very simple and safe
> feature.
>

Ah, so instead of invisible WorkflowJob, we create invisible WorkflowRun,
right?
-- 
Kohsuke Kawaguchi

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAN4CQ4zn1XtZrYY5O6CVe_Kzk%3DL%3Dga%2BBUE_ZvHmtMVYAFES3RQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to