@Override
    public void decorateHome(final JenkinsRule jenkinsRule, final File home) throws Exception {
      final String jobFolder = parent.getJobFolder();
      final String configXmlPath = jobFolder + "config.xml";
      final File configXmlFile = new File(home, configXmlPath);

      final String tfsServerUrl = helper.getServerUrl();
      XmlHelper.pokeValue(configXmlFile, "/project/scm/serverUrl", tfsServerUrl);

      final String projectPath = parent.getPathInTfvc();
      XmlHelper.pokeValue(configXmlFile, "/project/scm/projectPath", projectPath);

      final String workspaceName = "Hudson-${JOB_NAME}-${COMPUTERNAME}";
      XmlHelper.pokeValue(configXmlFile, "/project/scm/workspaceName", workspaceName);

      final String userName = helper.getUserName();
      XmlHelper.pokeValue(configXmlFile, "/project/scm/userName", userName);

      final String userPassword = helper.getUserPassword();
      final SecretOverride secretOverride = new SecretOverride();
      try {
        final Secret secret = Secret.fromString(userPassword);
        encryptedPassword = secret.getEncryptedValue();
      } finally {
        try {
          secretOverride.close();
        } catch (IOException e) {
          // ignore
        }
      }
      final String projectScmPassword = "******";
      final String currentPassword = XmlHelper.peekValue(configXmlFile, projectScmPassword);
      if (currentPassword != null) {
        XmlHelper.pokeValue(configXmlFile, projectScmPassword, encryptedPassword);
      }
    }
 public String getEncryptedStashPassword() {
   if (stashPassword != null) return stashPassword.getEncryptedValue();
   else return null;
 }
 public String getStashUserPassword() {
   return stashUserPassword.getEncryptedValue();
 }
예제 #4
0
 public String getSecretKey() {
   return secretKey.getEncryptedValue();
 }