-
Notifications
You must be signed in to change notification settings - Fork 88
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 support to remote kafka plugin #316
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,10 +159,15 @@ protected Object readResolve() { | |
.jvmOptions(Util.fixEmpty(jvmOptions)) | ||
; | ||
|
||
LauncherFactory lf = "SSH".equals(slaveType) | ||
? new LauncherFactory.SSH(credentialsId) | ||
: LauncherFactory.JNLP.JNLP | ||
; | ||
LauncherFactory lf = null; | ||
if ("SSH".equals(slaveType)) { | ||
lf = new LauncherFactory.SSH(credentialsId); | ||
} else if ("JNLP".equals(slaveType)) { | ||
lf = LauncherFactory.JNLP.JNLP; | ||
} else if ("KAFKA".equals(slaveType)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to add these into |
||
lf = LauncherFactory.KAFKA.KAFKA; | ||
} | ||
|
||
builder.launcherFactory(lf); | ||
|
||
if (overrideRetentionTime > 0) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,6 +122,8 @@ private Object readResolve() { | |
lf = new LauncherFactory.SSH(credentialsId); | ||
} else if("JNLP".equals(slaveType)) { | ||
lf = LauncherFactory.JNLP.JNLP; | ||
} else if("KAFKA".equals(slaveType)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to add these into |
||
lf = LauncherFactory.KAFKA.KAFKA; | ||
} | ||
|
||
BootSource.Image bs = imageId == null ? null : new BootSource.Image(imageId); | ||
|
@@ -153,6 +155,9 @@ private Object readResolve() { | |
} else if ("SSH".equals(slaveOptions.slaveType)) { | ||
lf = new LauncherFactory.SSH(slaveOptions.credentialsId); | ||
slaveOptions.slaveType = slaveOptions.credentialsId = null; | ||
} else if ("KAFKA".equals(slaveOptions.slaveType)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to add these into |
||
lf = LauncherFactory.KAFKA.KAFKA; | ||
slaveOptions.slaveType = null; | ||
} | ||
if (lf != null) { | ||
slaveOptions = slaveOptions.getBuilder().launcherFactory(lf).build(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
import hudson.Util; | ||
import hudson.util.VariableResolver; | ||
import jenkins.slaves.JnlpAgentReceiver; | ||
import io.jenkins.plugins.remotingkafka.KafkaSecretManager; | ||
|
||
import javax.annotation.Nonnull; | ||
import java.util.LinkedHashMap; | ||
|
@@ -77,6 +78,16 @@ | |
"Labels of the node.", | ||
r -> r.labelString | ||
); | ||
stub( | ||
"SLAVE_KAFKA_SECRET", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refrain from using the word There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just want to be compliant with SLAVE_JNLP_SECRET variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we would have to rename that one as well. |
||
"Kafka secret.", | ||
r -> Util.fixNull(KafkaSecretManager.getConnectionSecret(r.serverName)) | ||
); | ||
stub( | ||
"SLAVE_NAME", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refrain from using the word |
||
"SLAVE_NAME.", | ||
r -> Util.fixNull(r.serverName) | ||
); | ||
} | ||
private static void stub(@Nonnull String name, @Nonnull String doc, @Nonnull ValueCalculator vc) { | ||
STUB.put(name, new Entry(name, doc, vc)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form"> | ||
<f:section title="KAFKA remote agent launch"> | ||
<f:entry> | ||
<p>Jenkins will wait for the Kafka connection to be initiated from the slave itself. Note this plugin does not initiate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please refrain from using the word |
||
that. See help for <i>User Data</i> field for more information on the available options.</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might need to massage this a bit, by ideally moving the details here. For now, JNLP was the only inbound connection supported so the user-data config mentioned that only. Kafka seems to require specific launching instructions, that needs to be documented here (or at least link to plugin documentation). Also, there will be no way for the other plugin to contribute documentation for User Data, so this might be the only place to document it. |
||
</f:entry> | ||
</f:section> | ||
</j:jelly> |
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.
There is no need to add these into
readResolve
methods. They are only used to migrate old config to new one. And since kafka is just being added, it does not exist in user configs.