Search in sources :

Example 1 with ReleaseType

use of io.spring.concourse.releasescripts.ReleaseType in project spring-boot by spring-projects.

the class PublishToSdkmanCommand method run.

@Override
public void run(ApplicationArguments args) throws Exception {
    logger.debug("Running 'push to SDKMAN' command");
    List<String> nonOptionArgs = args.getNonOptionArgs();
    Assert.state(!nonOptionArgs.isEmpty(), "No command argument specified");
    Assert.state(nonOptionArgs.size() >= 3, "Release type or version not specified");
    String releaseType = nonOptionArgs.get(1);
    ReleaseType type = ReleaseType.from(releaseType);
    if (!ReleaseType.RELEASE.equals(type)) {
        return;
    }
    String version = nonOptionArgs.get(2);
    boolean makeDefault = false;
    if (nonOptionArgs.size() == 4) {
        makeDefault = Boolean.parseBoolean(nonOptionArgs.get(3));
    }
    this.service.publish(version, makeDefault);
}
Also used : ReleaseType(io.spring.concourse.releasescripts.ReleaseType)

Example 2 with ReleaseType

use of io.spring.concourse.releasescripts.ReleaseType in project spring-boot by spring-projects.

the class PublishToCentralCommand method run.

@Override
public void run(ApplicationArguments args) throws Exception {
    List<String> nonOptionArgs = args.getNonOptionArgs();
    Assert.state(nonOptionArgs.size() == 4, "Release type, build info location, or artifacts location not specified");
    String releaseType = nonOptionArgs.get(1);
    ReleaseType type = ReleaseType.from(releaseType);
    if (!ReleaseType.RELEASE.equals(type)) {
        return;
    }
    String buildInfoLocation = nonOptionArgs.get(2);
    logger.debug("Loading build-info from " + buildInfoLocation);
    byte[] content = Files.readAllBytes(new File(buildInfoLocation).toPath());
    BuildInfoResponse buildInfoResponse = this.objectMapper.readValue(content, BuildInfoResponse.class);
    BuildInfo buildInfo = buildInfoResponse.getBuildInfo();
    ReleaseInfo releaseInfo = ReleaseInfo.from(buildInfo);
    String artifactsLocation = nonOptionArgs.get(3);
    this.sonatype.publish(releaseInfo, new File(artifactsLocation).toPath());
}
Also used : ReleaseType(io.spring.concourse.releasescripts.ReleaseType) BuildInfo(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.BuildInfo) ReleaseInfo(io.spring.concourse.releasescripts.ReleaseInfo) BuildInfoResponse(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse) File(java.io.File)

Example 3 with ReleaseType

use of io.spring.concourse.releasescripts.ReleaseType in project spring-boot by spring-projects.

the class PromoteCommand method run.

@Override
public void run(ApplicationArguments args) throws Exception {
    logger.debug("Running 'promote' command");
    List<String> nonOptionArgs = args.getNonOptionArgs();
    Assert.state(!nonOptionArgs.isEmpty(), "No command argument specified");
    Assert.state(nonOptionArgs.size() == 3, "Release type or build info location not specified");
    String releaseType = nonOptionArgs.get(1);
    ReleaseType type = ReleaseType.from(releaseType);
    String buildInfoLocation = nonOptionArgs.get(2);
    byte[] content = Files.readAllBytes(new File(buildInfoLocation).toPath());
    BuildInfoResponse buildInfoResponse = this.objectMapper.readValue(new String(content), BuildInfoResponse.class);
    ReleaseInfo releaseInfo = ReleaseInfo.from(buildInfoResponse.getBuildInfo());
    this.service.promote(type.getRepo(), releaseInfo);
}
Also used : ReleaseType(io.spring.concourse.releasescripts.ReleaseType) ReleaseInfo(io.spring.concourse.releasescripts.ReleaseInfo) BuildInfoResponse(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse) File(java.io.File)

Aggregations

ReleaseType (io.spring.concourse.releasescripts.ReleaseType)3 ReleaseInfo (io.spring.concourse.releasescripts.ReleaseInfo)2 BuildInfoResponse (io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse)2 File (java.io.File)2 BuildInfo (io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.BuildInfo)1