Skip to content

Commit c777340

Browse files
authored
Merge pull request #144 from common-workflow-language/nosupport-ssh
Clarify lack of support for SSH
2 parents 326f60e + 55a712c commit c777340

File tree

4 files changed

+28
-12
lines changed

4 files changed

+28
-12
lines changed

src/main/java/org/commonwl/view/workflow/WorkflowController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.commonwl.view.git.GitDetails;
2525
import org.commonwl.view.graphviz.GraphVizService;
2626
import org.eclipse.jgit.api.errors.GitAPIException;
27+
import org.eclipse.jgit.api.errors.TransportException;
2728
import org.slf4j.Logger;
2829
import org.slf4j.LoggerFactory;
2930
import org.springframework.beans.factory.annotation.Autowired;
@@ -120,6 +121,9 @@ public ModelAndView createWorkflow(@Valid WorkflowForm workflowForm, BindingResu
120121
if (workflow == null) {
121122
try {
122123
workflow = workflowService.createQueuedWorkflow(gitInfo).getTempRepresentation();
124+
} catch (TransportException ex) {
125+
bindingResult.rejectValue("url", "git.sshError");
126+
return new ModelAndView("index");
123127
} catch (GitAPIException ex) {
124128
bindingResult.rejectValue("url", "git.retrievalError");
125129
logger.error("Git API Error", ex);
@@ -450,9 +454,10 @@ private ModelAndView getWorkflow(GitDetails gitDetails, RedirectAttributes redir
450454
if (!errors.hasErrors()) {
451455
try {
452456
queued = workflowService.createQueuedWorkflow(gitDetails);
457+
} catch (TransportException ex) {
458+
errors.rejectValue("url", "git.sshError", "SSH URLs are not supported, please provide a HTTPS URL for the repository or submodules");
453459
} catch (GitAPIException ex) {
454460
errors.rejectValue("url", "git.retrievalError", "The workflow could not be retrieved from the Git repository using the details given");
455-
logger.error("Git API Error", ex);
456461
} catch (WorkflowNotFoundException ex) {
457462
errors.rejectValue("url", "git.pathTraversal", "The path given did not resolve to a location within the repository");
458463
} catch (IOException ex) {

src/main/resources/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ path.emptyOrWhitespace = You must provide a path to the workflow within the repo
44

55
git.retrievalError = The workflow could not be retrieved from the Git repository using the details given
66
git.pathTraversal = The path given did not resolve to a location within the repository
7+
git.sshError = SSH URLs are not supported, please provide a HTTPS URL for the repository or submodules
78

89
url.parsingError = An unexpected error occurred when parsing the workflow

src/main/resources/static/js/main.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,22 @@ require(['jquery'],
7979
var pathPattern = new RegExp("^\\/?([^\\/]*\\/)*[^\\/]+\\.cwl$");
8080
var input = $("#url").val();
8181
if (gitPattern.test(input)) {
82-
var success = true;
83-
if (!$("#branch").val()) {
84-
addWarning("branch", "You must provide a branch name for the workflow");
85-
success = false;
86-
}
87-
if (!$("#path").val()) {
88-
addWarning("path", "You must provide a path to the workflow");
89-
success = false;
90-
} else if (!pathPattern.test($("#path").val())) {
91-
addWarning("path", "Must be a valid path from the root to a .cwl workflow");
92-
success = false;
82+
var success = false;
83+
if (input.startsWith("ssh") || input.startsWith("git@")) {
84+
addWarning("url", "SSH is not supported as a protocol, please provide a HTTPS URL to clone");
85+
} else {
86+
success = true;
87+
if (!$("#branch").val()) {
88+
addWarning("branch", "You must provide a branch name for the workflow");
89+
success = false;
90+
}
91+
if (!$("#path").val()) {
92+
addWarning("path", "You must provide a path to the workflow");
93+
success = false;
94+
} else if (!pathPattern.test($("#path").val())) {
95+
addWarning("path", "Must be a valid path from the root to a .cwl workflow");
96+
success = false;
97+
}
9398
}
9499
return success;
95100
} else if (!githubPattern.test(input) && !gitlabPattern.test(input)) {

src/main/resources/templates/about.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ <h2>Research Objects</h2>
187187
(<a href="https://github.com/common-workflow-language/cwlviewer/issues/103">see Github issue</a>)</p>
188188
<p>We recommend that you keep all files in the containing folder for current use of CWL Viewer</p>
189189

190+
<h2>SSH Cloning</h2>
191+
<p>SSH URLs are not able to be cloned or used as submodules due to the need for SSH keys to be set up.</p>
192+
<p>We do not plan SSH support due to the impact on reproducibility from this being made a required
193+
step to download the workflow.</p>
194+
190195
<h2>Others</h2>
191196
<p>Other limitations or unimplemented features can be viewed
192197
<a href="https://github.com/common-workflow-language/cwlviewer">on the Github issues page</a></p>

0 commit comments

Comments
 (0)