Skip to content

Commit

Permalink
Merge pull request #12 from jenkinsci/feature/SIGN-6572
Browse files Browse the repository at this point in the history
SIGN-6572 - log plug-in, JDK, and Jenkins versions to User-Agent header
  • Loading branch information
volbobvol authored Jan 8, 2024
2 parents cbc1518 + 5e5ceec commit 4e8a1e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>io.signpath.javaclient</groupId>
<artifactId>api-client</artifactId>
<version>1.0.7</version>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.jenkins.plugins.signpath.ApiIntegration.SignPathClient;
//</editor-fold>
import hudson.util.VersionNumber;
import io.jenkins.plugins.signpath.ApiIntegration.ApiConfiguration;
import io.jenkins.plugins.signpath.ApiIntegration.Model.SigningRequestModel;
import io.jenkins.plugins.signpath.ApiIntegration.Model.SigningRequestOriginModel;
Expand All @@ -20,6 +21,7 @@
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.model.Jenkins;

public class SignPathClientFacade implements SignPathFacade {

Expand All @@ -41,7 +43,8 @@ public SignPathClientFacade(SignPathCredentials credentials, ApiConfiguration ap
apiConfiguration.getServiceUnavailableTimeoutInSeconds(),
apiConfiguration.getUploadAndDownloadRequestTimeoutInSeconds(),
apiConfiguration.getWaitForCompletionTimeoutInSeconds(),
apiConfiguration.getWaitBetweenReadinessChecksInSeconds()
apiConfiguration.getWaitBetweenReadinessChecksInSeconds(),
buildUserAgent()
));
}

Expand Down Expand Up @@ -129,5 +132,14 @@ private Map<String, String> buildOriginData(SigningRequestModel submitModel){
originParameters.put("RepositoryData.SourceControlManagementType", origin.getRepositoryMetadata().getSourceControlManagementType());

return originParameters;
}
}

private String buildUserAgent(){

return String.format("SignPath.Plugins.Jenkins/%1$s (OpenJDK %2$s; Jenkins %3$s)",
SignPathClientFacade.class.getPackage().getImplementationVersion(),
System.getProperty("java.version"),
Jenkins.getVersion()
);
}
}

0 comments on commit 4e8a1e6

Please sign in to comment.