Polishing.

Remove Authentication.password in favor of API Key as both values are the same.

Document GitHub Token requirements.
This commit is contained in:
Mark Paluch
2024-12-10 09:38:42 +01:00
parent ab909975a3
commit ac87407457
5 changed files with 10 additions and 11 deletions

View File

@@ -118,13 +118,13 @@ Both are available in the Spring/Pivotal Last Pass repository.
* `maven.mavenHome` - Pointing to the location of your Maven installation.
* `deployment.username` - Your Artifactory user.
* `deployment.api-key` - The Artifactory API key to use for artifact promotion.
* `deployment.password` - The encrypted Artifactory password..
* `deployment.password` - The encrypted Artifactory password.
* `gpg.keyname` - The GPG key name.
* `gpg.passphrase` - The password of your GPG key.
* `gpg.executable` - Path to your GPG executable, typically `/usr/local/MacGPG2/bin/gpg2`
or `/usr/local/bin/gpg`.
* `project-service.key` - Project Service authentication token. Must be a valid GitHub token. Can be the same
as `git.password` when using a GitHub token as password.
* `project-service.key` - Project Service authentication token. Must be a valid GitHub token. Can be the same as `git.password` when using a GitHub token as password.
Use the following scopes: `project, read:org, repo, user, workflow`.
(See link:application-local.template[`application-local.template`] for details)

View File

@@ -361,7 +361,7 @@ class MavenBuildSystem implements BuildSystem {
arg("artifactory.server").withValue(authentication.getServer().getUri()),
arg("artifactory.staging-repository").withValue(authentication.getStagingRepository()),
arg("artifactory.username").withValue(authentication.getUsername()),
arg("artifactory.password").withValue(authentication.getPassword()),
arg("artifactory.password").withValue(authentication.getApiKey()),
arg("artifactory.build-name").withQuotedValue(information.getBuildName()),
arg("artifactory.build-number").withValue(information.getBuildNumber()),
arg("gpg.executable").withValue(gpg.getExecutable()), //
@@ -508,7 +508,7 @@ class MavenBuildSystem implements BuildSystem {
arg("artifactory.server").withValue(authentication.getServer().getUri()),
arg("artifactory.distribution-repository").withValue(authentication.getDistributionRepository()),
arg("artifactory.username").withValue(authentication.getUsername()),
arg("artifactory.password").withValue(authentication.getPassword()))
arg("artifactory.password").withValue(authentication.getApiKey()))
.andIf(deploymentInformation != null, () -> {
return arg("artifactory.build-number").withValue(deploymentInformation.getBuildNumber());
}).andIf(!ObjectUtils.isEmpty(properties.getSettingsXml()), () -> settingsXml(properties.getSettingsXml())));
@@ -518,7 +518,7 @@ class MavenBuildSystem implements BuildSystem {
arg("artifactory.server").withValue(authentication.getServer().getUri()),
arg("artifactory.distribution-repository").withValue(authentication.getDistributionRepository()),
arg("artifactory.username").withValue(authentication.getUsername()),
arg("artifactory.password").withValue(authentication.getPassword()))
arg("artifactory.password").withValue(authentication.getApiKey()))
.andIf(deploymentInformation != null, () -> {
return arg("artifactory.build-number").withValue(deploymentInformation.getBuildNumber());
}).andIf(!ObjectUtils.isEmpty(properties.getSettingsXml()), () -> settingsXml(properties.getSettingsXml())));

View File

@@ -19,7 +19,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.release.deployment.DeploymentProperties.Authentication;
import org.springframework.data.release.model.Password;
import org.springframework.data.release.utils.HttpBasicCredentials;
import org.springframework.data.release.utils.HttpComponentsClientHttpRequestFactoryBuilder;
import org.springframework.data.release.utils.Logger;
@@ -53,7 +52,7 @@ class DeploymentConfiguration {
if (authentication.hasCredentials()) {
HttpBasicCredentials credentials = new HttpBasicCredentials(authentication.getUsername(),
Password.of(authentication.getApiKey()));
authentication.getApiKey());
builder = builder.withAuthentication(uri, credentials);
} else {

View File

@@ -123,12 +123,11 @@ public class DeploymentProperties implements InitializingBean {
String distributionRepository;
String project;
String username;
Password password;
String apiKey;
Password apiKey;
String repositoryPrefix = "";
public boolean hasCredentials() {
return StringUtils.hasText(username) && password != null;
return StringUtils.hasText(username) && apiKey != null;
}
public void validate() {

View File

@@ -35,6 +35,7 @@ deployment.commercial.staging-repository=spring-enterprise-maven-stage-local
deployment.commercial.target-repository=spring-enterprise-maven-prod-local
deployment.commercial.distribution-repository=spring-enterprise-maven-prod-local
deployment.commercial.project=spring
deployment.maven-central.staging-profile-id=2a29ff48cbb4b
# deployment.commercial.distribution-repository=
# deployment.commercial.username <- local, for build