protected File createSshKeyFile(String namespace, String sourceSecretName, String privateKeyName, String privateKey) throws IOException { File keyFile = null; if (privateKey != null) { String text = Base64Encoder.decode(privateKey); keyFile = projectFileSystem.getSecretsFolder(namespace, sourceSecretName, privateKeyName); Files.writeToFile(keyFile, text.getBytes()); } return keyFile; }
Files.writeToFile(file, updatedText, StandardCharsets.UTF_8);
protected CommitInfo doWrite(Git git, String path, byte[] contents, PersonIdent personIdent, String commitMessage) throws Exception { File file = getRelativeFile(path); file.getParentFile().mkdirs(); Files.writeToFile(file, contents); String filePattern = getFilePattern(path); AddCommand add = git.add().addFilepattern(filePattern).addFilepattern("."); add.call(); CommitCommand commit = git.commit().setAll(true).setAuthor(personIdent).setMessage(commitMessage); RevCommit revCommit = commitThenPush(git, commit); return createCommitInfo(revCommit); }
flowText = Strings.replaceAllWithoutRegex(flowText, "GIT_URL", "'" + gitUrl + "'"); File newFile = new File(basedir, ProjectConfigs.LOCAL_FLOW_FILE_NAME); Files.writeToFile(newFile, flowText.getBytes()); LOG.info("Written pipeline to " + newFile); config.setPipeline(null);