Skip to content

Commit

Permalink
feat: fcli ssc appversion update: Add --active option to allow ac…
Browse files Browse the repository at this point in the history
…tivating/deactivating applications versions (resolves #625) (#647)


Co-authored-by: Sangamesh Vijaykumar <[email protected]>
  • Loading branch information
SangameshV and Sangamesh Vijaykumar authored Nov 20, 2024
1 parent 1f7c9b6 commit c2c9a33
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public class SSCAppVersionUpdateCommand extends AbstractSSCJsonNodeOutputCommand
private String name;
@Option(names={"--description","-d"}, required = false)
private String description;
@Option(names={"--active"}, required = false, defaultValue=Option.NULL_VALUE, arity="1")
private Boolean active;

@Override
public JsonNode getJsonNode(UnirestInstance unirest) {
Expand Down Expand Up @@ -100,6 +102,10 @@ private final HttpRequest<?> getAppVersionUpdateRequest(UnirestInstance unirest,
boolean hasUpdate = optionalUpdate(updateData, "name", getUnqualifiedVersionName(name, descriptor));
hasUpdate |= optionalUpdate(updateData, "description", description);
hasUpdate |= optionalUpdate(updateData, issueTemplateResolver.getIssueTemplateDescriptor(unirest));
if (null != active) {
updateData.put("active", active);
hasUpdate |= true;
}
return hasUpdate
? unirest.put(SSCUrls.PROJECT_VERSION(descriptor.getVersionId())).body(updateData)
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static final SSCAppVersionDescriptor getOptionalAppVersionFromAppAndVersi
}

private static GetRequest getBaseRequest(UnirestInstance unirest, String... fields) {
GetRequest request = unirest.get("/api/v1/projectVersions?limit=2");
GetRequest request = unirest.get("/api/v1/projectVersions?includeInactive=true&limit=2");
if ( fields!=null && fields.length>0 ) {
request.queryString("fields", String.join(",", fields));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ fcli.ssc.appversion.update.usage.description = This command allows for updating
or --rm-users option may not be applied if the fcli session was created using a CIToken.
fcli.ssc.appversion.update.name = Update application version name.
fcli.ssc.appversion.update.description = Update application version description.
fcli.ssc.appversion.update.active = Specify whether application version should be activated (true) \
or not (false).
fcli.ssc.appversion.resolver.name = Application and version name.
fcli.ssc.appversion.resolver.nameOrId = Application version id or <application>:<version> name.
fcli.ssc.appversion.resolver.copy-from.nameOrId = Copy FROM application version: \nid or <application>:<version> name.
Expand Down

0 comments on commit c2c9a33

Please sign in to comment.