Skip to content
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

Enable Launcher type to use Environmental Variables #399

Open
HardHero opened this issue Aug 16, 2023 · 0 comments
Open

Enable Launcher type to use Environmental Variables #399

HardHero opened this issue Aug 16, 2023 · 0 comments

Comments

@HardHero
Copy link

Is your feature request related to a problem? Please describe.
When using the Launcher type to "Launch agent via execution of command on controller", I try to use the command aws ssm start-session --target $NODE_NAME to create an ssh session with the AWS Systems Manager sessions. I get the following error

$ aws ssm start-session --target $NODE_NAME

An error occurred (ValidationException) when calling the StartSession operation: 1 validation error detected: Value '$NODE_NAME' at 'target' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-zA-Z0-9_:-]{1,400}$
ERROR: Unable to launch the agent for FleetCloud i-0870f8fdcb91438b4
java.io.EOFException: unexpected stream termination
   at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:459)
   at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:404)
   at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:437)
   at hudson.slaves.CommandLauncher.launch(CommandLauncher.java:170)
   at hudson.slaves.DelegatingComputerLauncher.launch(DelegatingComputerLauncher.java:64)
   at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:298)
   at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
   at jenkins.security.ImpersonatingExecutorService$2.call(ImpersonatingExecutorService.java:80)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   at java.base/java.lang.Thread.run(Thread.java:829)
ERROR: Process terminated with exit code 254```

I realize the error tells you exactly what pattern needs to be used, but if we could just use the `$` character as well, it could potentially let this functionality execute as desired.


**Describe the solution you'd like**
On launch if the command could evaluate `$NODE_NAME` as the variable (something like i-XXXXXX) this would let us dynamically spin up jenkins agents and connect to them via AWS SSM.

**Describe alternatives you've considered**
From what I can tell, there doesn't seem to be any way to get the $NODE_NAME without using special character not allowed to be used by the regex pattern.

\
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants