-
Notifications
You must be signed in to change notification settings - Fork 7
Add developer joy ! #159
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
Open
ggrebert
wants to merge
1
commit into
quarkiverse:main
Choose a base branch
from
ggrebert:dev-joy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add developer joy ! #159
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
deployment/src/main/java/io/quarkus/jsch/deployment/JSchBuildTimeConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| package io.quarkus.jsch.deployment; | ||
|
|
||
| import io.quarkus.runtime.annotations.ConfigDocSection; | ||
| import io.quarkus.runtime.annotations.ConfigGroup; | ||
| import io.quarkus.runtime.annotations.ConfigPhase; | ||
| import io.quarkus.runtime.annotations.ConfigRoot; | ||
| import io.smallrye.config.ConfigMapping; | ||
| import io.smallrye.config.WithDefault; | ||
|
|
||
| @ConfigMapping(prefix = "quarkus.jsch") | ||
| @ConfigRoot(phase = ConfigPhase.BUILD_TIME) | ||
| public interface JSchBuildTimeConfig { | ||
|
|
||
| /** | ||
| * The JSch DevService configuration. | ||
| */ | ||
| @ConfigDocSection | ||
| JSchDevServiceConfig devservices(); | ||
|
|
||
| @ConfigGroup | ||
| public interface JSchDevServiceConfig { | ||
|
|
||
| /** | ||
| * Enable the JSch DevService. | ||
| */ | ||
| @WithDefault("true") | ||
| boolean enabled(); | ||
|
|
||
| /** | ||
| * The image to use for the JSch DevService. | ||
| */ | ||
| @WithDefault("linuxserver/openssh-server") | ||
| String image(); | ||
|
|
||
| /** | ||
| * The port to use for the JSch DevService. | ||
| */ | ||
| @WithDefault("2222") | ||
| int port(); | ||
|
|
||
| /** | ||
| * The username to use for the JSch DevService. | ||
| */ | ||
| @WithDefault("quarkus") | ||
| String username(); | ||
|
|
||
| /** | ||
| * The password to use for the JSch DevService. | ||
| */ | ||
| @WithDefault("quarkus") | ||
| String password(); | ||
|
|
||
| /** | ||
| * Whether to reuse the container for the JSch DevService. | ||
| */ | ||
| @WithDefault("false") | ||
| boolean reuse(); | ||
|
|
||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
deployment/src/main/java/io/quarkus/jsch/deployment/JSchDevServiceProcessor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package io.quarkus.jsch.deployment; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import org.testcontainers.containers.GenericContainer; | ||
| import org.testcontainers.utility.DockerImageName; | ||
|
|
||
| import io.quarkus.deployment.IsNormal; | ||
| import io.quarkus.deployment.annotations.BuildStep; | ||
| import io.quarkus.deployment.annotations.BuildSteps; | ||
| import io.quarkus.deployment.builditem.DevServicesResultBuildItem; | ||
| import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig; | ||
|
|
||
| @BuildSteps(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class) | ||
| public class JSchDevServiceProcessor { | ||
|
|
||
| @BuildStep | ||
| DevServicesResultBuildItem startDevServices(JSchBuildTimeConfig config) { | ||
| if (!config.devservices().enabled()) { | ||
| return null; | ||
| } | ||
|
|
||
| DockerImageName dockerImageName = DockerImageName.parse(config.devservices().image()); | ||
| GenericContainer container = new GenericContainer<>(dockerImageName) | ||
| .withEnv("USER_NAME", config.devservices().username()) | ||
| .withEnv("USER_PASSWORD", config.devservices().password()) | ||
| .withEnv("PASSWORD_ACCESS", "true") | ||
| .withExposedPorts(config.devservices().port()) | ||
| .withReuse(config.devservices().reuse()); | ||
|
|
||
| container.start(); | ||
|
|
||
| Map<String, String> configOverrides = Map.of( | ||
| "quarkus.jsch.session.host", container.getHost(), | ||
| "quarkus.jsch.session.port", container.getMappedPort(config.devservices().port()).toString(), | ||
| "quarkus.jsch.session.username", config.devservices().username(), | ||
| "quarkus.jsch.session.password", config.devservices().password(), | ||
| "quarkus.jsch.session.config.StrictHostKeyChecking", "no"); | ||
|
|
||
| return new DevServicesResultBuildItem.RunningDevService(JSchProcessor.FEATURE, container.getContainerId(), | ||
| container::close, configOverrides) | ||
| .toBuildItem(); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
deployment/src/main/java/io/quarkus/jsch/deployment/JSchSessionBuildItem.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| package io.quarkus.jsch.deployment; | ||
|
|
||
| import io.quarkus.builder.item.MultiBuildItem; | ||
|
|
||
| /** | ||
| * A build item that registers a JSch session created by annotation. | ||
| */ | ||
| public final class JSchSessionBuildItem extends MultiBuildItem { | ||
gastaldi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private final String name; | ||
|
|
||
| public JSchSessionBuildItem(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String name() { | ||
| return name; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (obj == this) { | ||
| return true; | ||
| } | ||
|
|
||
| if (!(obj instanceof JSchSessionBuildItem)) { | ||
| return false; | ||
| } | ||
|
|
||
| JSchSessionBuildItem other = (JSchSessionBuildItem) obj; | ||
| return name.equals(other.name); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return name.hashCode(); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.