Search in sources :

Example 1 with Release

use of org.gitlab4j.api.models.Release in project choerodon-starters by open-hand.

the class ReleasesApi method updateRelease.

/**
 * Updates the release notes of a given release.
 *
 * <pre><code>GitLab Endpoint: PUT /projects/:id/releases/:tag_name</code></pre>
 *
 * @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
 * @param params a ReleaseParams instance holding the parameters for the release
 * @return a Release instance containing info on the updated Release
 * @throws GitLabApiException if any exception occurs
 */
public Release updateRelease(Object projectIdOrPath, ReleaseParams params) throws GitLabApiException {
    String tagName = params.getTagName();
    if (tagName == null || tagName.trim().isEmpty()) {
        throw new RuntimeException("params.tagName cannot be null or empty");
    }
    GitLabApiForm formData = new GitLabApiForm().withParam("tag_name", tagName, true).withParam("description", params.getDescription(), false);
    Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "releases", urlEncode(tagName));
    return (response.readEntity(Release.class));
}
Also used : Response(javax.ws.rs.core.Response) Release(org.gitlab4j.api.models.Release)

Example 2 with Release

use of org.gitlab4j.api.models.Release in project legend-sdlc by finos.

the class GitLabApiWithFileAccess method fromGitLabTag.

protected static Version fromGitLabTag(String projectId, Tag tag) {
    if (tag == null) {
        return null;
    }
    VersionId versionId = parseVersionTagName(tag.getName());
    String revisionId = tag.getCommit().getId();
    String notes = applyIfNotNull(Release::getDescription, tag.getRelease());
    return new Version() {

        @Override
        public VersionId getId() {
            return versionId;
        }

        @Override
        public String getProjectId() {
            return projectId;
        }

        @Override
        public String getRevisionId() {
            return revisionId;
        }

        @Override
        public String getNotes() {
            return notes;
        }
    };
}
Also used : VersionId(org.finos.legend.sdlc.domain.model.version.VersionId) Version(org.finos.legend.sdlc.domain.model.version.Version) Release(org.gitlab4j.api.models.Release)

Aggregations

Release (org.gitlab4j.api.models.Release)2 Response (javax.ws.rs.core.Response)1 Version (org.finos.legend.sdlc.domain.model.version.Version)1 VersionId (org.finos.legend.sdlc.domain.model.version.VersionId)1