New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an interactive CLI mode (--cli argument) #207
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a bootstrap would be a cleaner approach IMHO. Jenkins official Docker images do that, and we may need it here to provide better compatibility with classic images. E.g. JAVA_OPTS
, DEBUG
, JENKINS_OPTS
have a real use-case in JFR.
But it is fine to do it as a follow-up
bootstrap/src/main/java/io/jenkins/jenkinsfile/runner/bootstrap/Bootstrap.java
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
private List<String> findArgsFromLineParts(String[] commandLineParts) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be generalized in JenkinsLauncher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can move it there, but I don't see how this internal utility method belongs there semantically - the only other existing implementation doesn't do command-line parsing and this use-case seems very specific to this one mode.
setup/src/main/java/io/jenkins/jenkinsfile/runner/CliLauncher.java
Outdated
Show resolved
Hide resolved
Thanks for the review @oleg-nenashev! With "bootstrap" you mean the Docker image and providing a I just noticed that the integration tests are failing due to an Update: The Update: The failing test is Update: Failures seem to be random. Update: I got the tests to pass locally by re-trying in a loop: |
b3c6aee
to
c7325a0
Compare
Yes
Just ignore it for now, please. CI is still not very stable. I will test it manually before merging |
Retriggering CI |
c7325a0
to
c98cb05
Compare
merge conflicts resolved |
This allows users to pass "cli" or "run" as Docker CMD to easily switch modes without having to set environment variables. Also provides the DEBUG environment variable that used to be provided by the launcher script (which is no longer used as of this). Also removes the FORCE_JENKINS_CLI environment variables as it's no longer necessary. as per jenkinsci#207 (comment)
c98cb05
to
6374b26
Compare
6374b26
to
6aeca51
Compare
In the meantime, another flag with the |
This allows users to pass "cli" or "run" as Docker CMD to easily switch modes without having to set environment variables. Also provides the DEBUG environment variable that used to be provided by the launcher script (which is no longer used as of this). Also removes the FORCE_JENKINS_CLI environment variables as it's no longer necessary. as per jenkinsci#207 (comment)
I am not a big fan of shortcuts at all :( Thanks for adjusting the PR!
…On Sat, Oct 26, 2019, 19:52 Philipp Nowak ***@***.***> wrote:
In the meantime, another flag with the -c shorthand was added (for
setting the cause), so I have removed that alias.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#207?email_source=notifications&email_token=AAW4RIB76VGGEHXQGG2X6N3QQRYU3A5CNFSM4JCSOE5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKMGAI#issuecomment-546620161>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAW4RIBY34SLF4J5CWFEKJ3QQRYU3ANCNFSM4JCSOE5A>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it manually, and it works like a charm. Thanks!
I will go ahead and merge it without #213, we can integrate it in a follow-up
This allows users to pass "cli" or "run" as Docker CMD to easily switch modes without having to set environment variables. Also provides the DEBUG environment variable to the non-dev Dockerfile. Removes the FORCE_JENKINS_CLI environment variables as it's no longer necessary. as per jenkinsci#207 (comment)
Ellipsis
As suggested by #178, this PR adds a way to access the Jenkins CLI from
jenkinsfile-runner
.Technical Overview
To support the new mode of execution, a new
JenkinsLauncher
superclass has been extracted from the existingJenkinsfileRunnerLauncher
, to abstract Jenkins setup capabilities. A new subclassCliLauncher
has been added that provides a loop forwarding commands viaCliCommand.clone()
.App
now has a switch on the newBootstrap.cliOnly
flag, and decides which implementation to use.This flag can be set via
--cli
or-c
, and additionally via aFORCE_JENKINS_CLI
environment variable. The latter is mainly intended for use with Docker (otherwise we'd need a custom entrypoint script or a separateDockerfile
just for CLI).Usage
I hope this is somewhat similar to what was meant with "new engine" in #178.
Fixes #178