Skip to content

Commit bbc06ba

Browse files
committed
rename sshDisableStrictHostKeyChecking to sshStrictHostKeyChecking
1 parent b24b109 commit bbc06ba

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,9 @@ spotlessChangelog { // all defaults
173173
commitMessage 'Published release/{{version}}' // {{version}} will be replaced
174174
remote 'origin'
175175
branch 'main'
176-
// default value is false, but if you set it to true, then it will
176+
// default value is `yes`, but if you set it to `no`, then it will
177177
// disable ssh host key checking (.ssh/known_hosts).
178-
// Can also set by command line arg `-PsshDisableStrictHostKeyChecking`.
179-
sshDisableStrictHostKeyChecking false
178+
sshStrictHostKeyChecking "yes" // can override with `-PsshStrictHostKeyChecking=no`
180179
}
181180
182181
// last version parsed from changelog

spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/GitActions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void checkCanPush() throws GitAPIException, IOException {
7373
}
7474
push(cfg.branch, RemoteRefUpdate.Status.UP_TO_DATE);
7575
} catch (GitAPIException e) {
76-
throw new IllegalArgumentException("You can set user/pass with any of these environment variables: " + envVars() + ", or try -PsshDisableStrictHostKeyChecking on ssh remotes", e);
76+
throw new IllegalArgumentException("You can set user/pass with any of these environment variables: " + envVars() + ", or try -PsshStrictHostKeyChecking=no on ssh remotes", e);
7777
}
7878
}
7979

@@ -133,7 +133,7 @@ private void push(Consumer<PushCommand> cmd, RemoteRefUpdate.Status expected) th
133133
sshTransport.setSshSessionFactory(new JschConfigSessionFactory() {
134134
@Override
135135
protected void configure(OpenSshConfig.Host host, Session session) {
136-
session.setConfig("StrictHostKeyChecking", cfg.disableStrictHostKeyChecking ? "no" : "yes");
136+
session.setConfig("StrictHostKeyChecking", cfg.sshStrictHostKeyChecking);
137137
}
138138
});
139139
});

spotless-changelog-lib/src/main/java/com/diffplug/spotless/changelog/GitCfg.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class GitCfg {
2929
public String commitMessage = "Published release/" + COMMIT_MESSAGE_VERSION;
3030
public String remote = "origin";
3131
public String branch = "main";
32-
public boolean disableStrictHostKeyChecking = false;
32+
public String sshStrictHostKeyChecking = "yes";
3333

3434
/** Returns an api configured with this config. */
3535
public GitActions withChangelog(File changelogFile, ChangelogAndNext model) throws IOException {

spotless-changelog-plugin-gradle/src/main/java/com/diffplug/spotless/changelog/gradle/ChangelogExtension.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ public void setAppendDashSnapshotUnless_dashPrelease(boolean appendSnapshot) {
173173
}
174174

175175
/**
176-
* If you set this to true, then the ssh host key checking over ssh:// remotes will be disabled.
177-
* By default strict host key checking is enabled. Make sure that there is an entry
176+
* If you set this to `no`, then the ssh host key checking over ssh:// remotes will be disabled.
177+
* By default strict host key checking is `yes`. Make sure that there is an entry
178178
* in know_hosts file for given ssh remote.
179-
* You can also add `-PsshDisableStrictHostKeyChecking` to the gradle command.
180-
* In your buildscript you can disable checking with `sshDisableStrictHostKeyChecking = true`
179+
* You can also add `-PsshStrictHostKeyChecking=no` to the gradle command.
180+
* In your buildscript you can disable checking with `sshStrictHostKeyChecking = "no"`
181181
*/
182-
public void setSshDisableStrictHostKeyChecking(boolean disableStrictHostKeyChecking) {
183-
gitCfg.disableStrictHostKeyChecking = disableStrictHostKeyChecking;
182+
public void setSshStrictHostKeyChecking(String sshStrictHostKeyChecking) {
183+
gitCfg.sshStrictHostKeyChecking = sshStrictHostKeyChecking;
184184
}
185185

186186
// tag and push

spotless-changelog-plugin-gradle/src/main/java/com/diffplug/spotless/changelog/gradle/ChangelogPlugin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public void apply(Project project) {
4646

4747
ChangelogExtension extension = project.getExtensions().create(ChangelogExtension.NAME, ChangelogExtension.class, project);
4848
project.getTasks().register(PrintTask.NAME, PrintTask.class, extension);
49-
extension.gitCfg.disableStrictHostKeyChecking = project.getRootProject().findProperty("sshDisableStrictHostKeyChecking") != null;
49+
if (project.getRootProject().hasProperty("sshStrictHostKeyChecking")) {
50+
extension.gitCfg.sshStrictHostKeyChecking = (String) project.getRootProject().findProperty("sshStrictHostKeyChecking");
51+
}
5052

5153
TaskProvider<CheckTask> check = project.getTasks().register(CheckTask.NAME, CheckTask.class, extension);
5254
TaskProvider<BumpTask> bump = project.getTasks().register(BumpTask.NAME, BumpTask.class, extension);

0 commit comments

Comments
 (0)