Skip to content

Commit

Permalink
Merge branch 'master' into 285-overwrite-when-importing-pipelines-and…
Browse files Browse the repository at this point in the history
…-ces
  • Loading branch information
JaimeSeqLabs authored Sep 21, 2023
2 parents 59b6ab3 + df3870c commit 9e44116
Show file tree
Hide file tree
Showing 41 changed files with 868 additions and 116 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,33 @@ jobs:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GH_SEQERA_TOKEN }}
PLATFORM: osx-x86_64
- name: Codesign binary
if: "contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'"
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime build/native/nativeCompile/tw -v
- name: Notarize binary
if: "contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'"
env:
MACOS_AC_API_CERT: ${{ secrets.MACOS_AC_API_CERT }}
MACOS_AC_API_ISSUER_ID: ${{ secrets.MACOS_AC_API_ISSUER_ID }}
MACOS_AC_API_KEY_ID: ${{ secrets.MACOS_AC_API_KEY_ID }}
run: |
echo $MACOS_AC_API_CERT | base64 --decode > AuthKey.p8
xcrun notarytool store-credentials "notarytool-profile" -k AuthKey.p8 -d "$MACOS_AC_API_KEY_ID" -i "$MACOS_AC_API_ISSUER_ID"
ditto -c -k --keepParent "build/native/nativeCompile/tw" "notarization.zip"
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
- name: Upload Mac native image artifact
uses: actions/upload-artifact@v2
Expand Down
27 changes: 19 additions & 8 deletions conf/reflect-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,12 @@
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"name":"io.seqera.tower.cli.responses.computeenvs.ComputeEnvUpdated",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true
},
{
"name":"io.seqera.tower.cli.responses.computeenvs.ComputeEnvExport",
"allDeclaredFields":true,
Expand Down Expand Up @@ -2131,7 +2137,8 @@
"name":"io.seqera.tower.model.AwsBatchConfig",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
"allDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"getCliPath","parameterTypes":[] }, {"name":"getComputeJobRole","parameterTypes":[] }, {"name":"getComputeQueue","parameterTypes":[] }, {"name":"getDiscriminator","parameterTypes":[] }, {"name":"getDragenQueue","parameterTypes":[] }, {"name":"getEnvironment","parameterTypes":[] }, {"name":"getExecutionRole","parameterTypes":[] }, {"name":"getForge","parameterTypes":[] }, {"name":"getForgedResources","parameterTypes":[] }, {"name":"getFusion2Enabled","parameterTypes":[] }, {"name":"getHeadJobCpus","parameterTypes":[] }, {"name":"getHeadJobMemoryMb","parameterTypes":[] }, {"name":"getHeadJobRole","parameterTypes":[] }, {"name":"getHeadQueue","parameterTypes":[] }, {"name":"getLogGroup","parameterTypes":[] }, {"name":"getNvnmeStorageEnabled","parameterTypes":[] }, {"name":"getPostRunScript","parameterTypes":[] }, {"name":"getPreRunScript","parameterTypes":[] }, {"name":"getRegion","parameterTypes":[] }, {"name":"getVolumes","parameterTypes":[] }, {"name":"getWaveEnabled","parameterTypes":[] }, {"name":"getWorkDir","parameterTypes":[] }, {"name":"setCliPath","parameterTypes":["java.lang.String"] }, {"name":"setComputeJobRole","parameterTypes":["java.lang.String"] }, {"name":"setComputeQueue","parameterTypes":["java.lang.String"] }, {"name":"setDragenQueue","parameterTypes":["java.lang.String"] }, {"name":"setEnvironment","parameterTypes":["java.util.List"] }, {"name":"setExecutionRole","parameterTypes":["java.lang.String"] }, {"name":"setForge","parameterTypes":["io.seqera.tower.model.ForgeConfig"] }, {"name":"setForgedResources","parameterTypes":["java.util.List"] }, {"name":"setFusion2Enabled","parameterTypes":["java.lang.Boolean"] }, {"name":"setHeadJobCpus","parameterTypes":["java.lang.Integer"] }, {"name":"setHeadJobMemoryMb","parameterTypes":["java.lang.Integer"] }, {"name":"setHeadJobRole","parameterTypes":["java.lang.String"] }, {"name":"setHeadQueue","parameterTypes":["java.lang.String"] }, {"name":"setLogGroup","parameterTypes":["java.lang.String"] }, {"name":"setNvnmeStorageEnabled","parameterTypes":["java.lang.Boolean"] }, {"name":"setPostRunScript","parameterTypes":["java.lang.String"] }, {"name":"setPreRunScript","parameterTypes":["java.lang.String"] }, {"name":"setRegion","parameterTypes":["java.lang.String"] }, {"name":"setVolumes","parameterTypes":["java.util.List"] }, {"name":"setWaveEnabled","parameterTypes":["java.lang.Boolean"] }, {"name":"setWorkDir","parameterTypes":["java.lang.String"] }]
},
{
"name":"io.seqera.tower.model.AwsSecurityKeys",
Expand Down Expand Up @@ -2212,7 +2219,8 @@
{
"name":"io.seqera.tower.model.ComputeEnvStatus",
"allDeclaredFields":true,
"allDeclaredMethods":true
"allDeclaredMethods":true,
"methods":[{"name":"fromValue","parameterTypes":["java.lang.String"] }]
},
{
"name":"io.seqera.tower.model.ComputePlatformDto",
Expand Down Expand Up @@ -2400,7 +2408,8 @@
"name":"io.seqera.tower.model.DescribeComputeEnvResponse",
"allDeclaredFields":true,
"allDeclaredMethods":true,
"allDeclaredConstructors":true
"allDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }, {"name":"setComputeEnv","parameterTypes":["io.seqera.tower.model.ComputeEnvResponseDto"] }]
},
{
"name":"io.seqera.tower.model.DescribeCredentialsResponse",
Expand Down Expand Up @@ -2800,11 +2809,6 @@
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"io.seqera.tower.model.PipelineOptimizationStatus",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true
},
{
"name":"io.seqera.tower.model.PipelineSecret",
"allDeclaredFields":true,
Expand Down Expand Up @@ -2913,6 +2917,13 @@
"allDeclaredMethods":true,
"allDeclaredConstructors":true
},
{
"name":"io.seqera.tower.model.UpdateComputeEnvRequest",
"allDeclaredFields":true,
"queryAllDeclaredMethods":true,
"queryAllDeclaredConstructors":true,
"methods":[{"name":"getName","parameterTypes":[] }]
},
{
"name":"io.seqera.tower.model.UpdateCredentialsRequest",
"allDeclaredFields":true,
Expand Down
10 changes: 8 additions & 2 deletions conf/resource-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,21 @@
"pattern":"\\QMETA-INF/services/org.glassfish.jersey.internal.inject.InjectionManagerFactory\\E"
}, {
"pattern":"\\QMETA-INF/services/org.glassfish.jersey.internal.spi.AutoDiscoverable\\E"
}, {
"pattern":"java.base:\\Qjdk/internal/icu/impl/data/icudt67b/nfkc.nrm\\E"
}, {
"pattern":"java.base:\\Qjdk/internal/icu/impl/data/icudt67b/uprops.icu\\E"
}, {
"pattern":"java.base:\\Qsun/net/idn/uidna.spp\\E"
}, {
"pattern":"java.base:\\Qsun/text/resources/LineBreakIteratorData\\E"
}]},
"bundles":[{
"name":"org.glassfish.jersey.client.internal.localization",
"locales":["und"]
"locales":["", "und"]
}, {
"name":"org.glassfish.jersey.internal.localization",
"locales":["und"]
"locales":["", "und"]
}, {
"name":"org.glassfish.jersey.media.multipart.internal.localization"
}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io.seqera.tower.cli.commands.computeenvs.ImportCmd;
import io.seqera.tower.cli.commands.computeenvs.ListCmd;
import io.seqera.tower.cli.commands.computeenvs.PrimaryCmd;
import io.seqera.tower.cli.commands.computeenvs.UpdateCmd;
import io.seqera.tower.cli.commands.computeenvs.ViewCmd;
import picocli.CommandLine.Command;

Expand All @@ -26,6 +27,7 @@
description = "Manage workspace compute environments.",
subcommands = {
AddCmd.class,
UpdateCmd.class,
DeleteCmd.class,
ViewCmd.class,
ListCmd.class,
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/io/seqera/tower/cli/commands/actions/UpdateCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.seqera.tower.ApiException;
import io.seqera.tower.cli.commands.global.WorkspaceOptionalOptions;
import io.seqera.tower.cli.commands.pipelines.LaunchOptions;
import io.seqera.tower.cli.exceptions.InvalidResponseException;
import io.seqera.tower.cli.exceptions.TowerException;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.actions.ActionUpdate;
Expand All @@ -38,6 +39,9 @@ public class UpdateCmd extends AbstractActionsCmd {
@CommandLine.Option(names = {"-s", "--status"}, description = "Action status (pause or active).")
public String status;

@CommandLine.Option(names = {"--new-name"}, description = "Action new name.")
public String newName;

@CommandLine.Mixin
public WorkspaceOptionalOptions workspace;

Expand All @@ -50,6 +54,15 @@ protected Response exec() throws ApiException, IOException {
ActionResponseDto action = fetchDescribeActionResponse(actionRefOptions, wspId).getAction();
String actionName = action.getName();

// Validate new action name if any
if (newName != null) {
try {
api().validateActionName(wspId, newName);
} catch (ApiException ex) {
throw new InvalidResponseException(String.format("Action name '%s' is not valid", newName));
}
}

// Retrieve the provided computeEnv or use the primary if not provided
String ceId = opts.computeEnv != null ? computeEnvByRef(wspId, opts.computeEnv).getId() : action.getLaunch().getComputeEnv().getId();

Expand Down Expand Up @@ -78,6 +91,7 @@ protected Response exec() throws ApiException, IOException {
.entryName(opts.entryName);

UpdateActionRequest request = new UpdateActionRequest();
request.setName(newName != null ? newName : actionName);
request.setLaunch(workflowLaunchRequest);

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import io.seqera.tower.cli.commands.global.PaginationOptions;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.collaborators.CollaboratorsList;
import io.seqera.tower.cli.utils.PaginationInfo;
import io.seqera.tower.model.ListMembersResponse;
import io.seqera.tower.model.OrgAndWorkspaceDbDto;
import picocli.CommandLine;
Expand Down Expand Up @@ -45,6 +46,6 @@ protected Response exec() throws ApiException, IOException {

ListMembersResponse response = api().listOrganizationCollaborators(orgAndWorkspaceDbDto.getOrgId(), max, offset, startsWith);

return new CollaboratorsList(orgAndWorkspaceDbDto.getOrgId(), response.getMembers());
return new CollaboratorsList(orgAndWorkspaceDbDto.getOrgId(), response.getMembers(), PaginationInfo.from(paginationOptions, response.getTotalSize()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2021, Seqera Labs.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This Source Code Form is "Incompatible With Secondary Licenses", as
* defined by the Mozilla Public License, v. 2.0.
*/

package io.seqera.tower.cli.commands.computeenvs;

import io.seqera.tower.ApiException;
import io.seqera.tower.cli.commands.global.WorkspaceOptionalOptions;
import io.seqera.tower.cli.exceptions.ComputeEnvNotFoundException;
import io.seqera.tower.cli.exceptions.InvalidResponseException;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.computeenvs.ComputeEnvUpdated;
import io.seqera.tower.model.ComputeEnvResponseDto;
import io.seqera.tower.model.UpdateComputeEnvRequest;
import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;
import picocli.CommandLine.Option;

import java.io.IOException;

@Command(
name = "update",
description = "Update compute environments."
)
public class UpdateCmd extends AbstractComputeEnvCmd {

@Mixin
public ComputeEnvRefOptions computeEnvRefOptions;

@Mixin
public WorkspaceOptionalOptions workspace;

@Option(names = {"--new-name"}, description = "Compute environment new name.")
public String newName;

@Override
protected Response exec() throws ApiException, IOException {
Long wspId = workspaceId(workspace.workspace);

if (newName != null) {
try {
api().validateComputeEnvName(wspId, newName);
} catch (ApiException ex) {
throw new InvalidResponseException(String.format("Compute environment name '%s' is not valid", newName));
}
}
ComputeEnvResponseDto ce = describeCE(computeEnvRefOptions, wspId);


UpdateComputeEnvRequest req = new UpdateComputeEnvRequest()
.name(newName != null ? newName : ce.getName());

api().updateComputeEnv(ce.getId(), req, wspId);


return new ComputeEnvUpdated(workspaceRef(wspId), ce.getName());

}

private ComputeEnvResponseDto describeCE(ComputeEnvRefOptions computeEnvRefOptions, Long wspId) throws ComputeEnvNotFoundException, ApiException {
try {
return fetchComputeEnv(computeEnvRefOptions, wspId);

} catch (ApiException e) {
if (e.getCode() == 403) {
String ref = computeEnvRefOptions.computeEnv.computeEnvId != null
? computeEnvRefOptions.computeEnv.computeEnvId
: computeEnvRefOptions.computeEnv.computeEnvName;
// Customize the forbidden message
throw new ComputeEnvNotFoundException(ref, workspaceRef(wspId));
}

throw e;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.seqera.tower.cli.commands.global.WorkspaceOptionalOptions;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.labels.ListLabelsCmdResponse;
import io.seqera.tower.cli.utils.PaginationInfo;
import io.seqera.tower.model.LabelType;
import io.seqera.tower.model.ListLabelsResponse;
import picocli.CommandLine;
Expand Down Expand Up @@ -53,6 +54,6 @@ protected Response exec() throws ApiException, IOException {

ListLabelsResponse res = api().listLabels(wspId, max, offset, filter == null ? "" : filter, labelType, null);

return new ListLabelsCmdResponse(wspId, labelType, res.getLabels());
return new ListLabelsCmdResponse(wspId, labelType, res.getLabels(), PaginationInfo.from(paginationOptions, res.getTotalSize()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class UpdateCmd extends AbstractOrganizationsCmd {
@CommandLine.Mixin
OrganizationRefOptions organizationRefOptions;

@CommandLine.Option(names = {"--new-name"}, description = "Organization new name.")
public String newName;

@CommandLine.Option(names = {"-f", "--full-name"}, description = "Organization full name.")
public String fullName;

Expand All @@ -43,6 +46,7 @@ protected Response exec() throws ApiException, IOException {
OrganizationDbDto organization = response.getOrganization();

UpdateOrganizationRequest request = new UpdateOrganizationRequest();
request.setName(newName != null ? newName : organization.getName());
request.setFullName(fullName != null ? fullName : organization.getFullName());
request.setDescription(opts.description != null ? opts.description : organization.getDescription());
request.setLocation(opts.location != null ? opts.location : organization.getLocation());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.seqera.tower.cli.commands.global.WorkspaceRequiredOptions;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.participants.ParticipantsList;
import io.seqera.tower.cli.utils.PaginationInfo;
import io.seqera.tower.model.ParticipantDbDto;
import io.seqera.tower.model.ParticipantType;
import picocli.CommandLine;
Expand Down Expand Up @@ -55,6 +56,6 @@ protected Response exec() throws ApiException, IOException {
response = response.stream().filter(it -> it.getType() == type).collect(Collectors.toList());
}

return new ParticipantsList(orgName(wspId), workspaceName(wspId), response);
return new ParticipantsList(orgName(wspId), workspaceName(wspId), response, PaginationInfo.from(paginationOptions));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import io.seqera.tower.cli.exceptions.WorkspaceNotFoundException;
import io.seqera.tower.cli.responses.Response;
import io.seqera.tower.cli.responses.pipelines.PipelinesList;
import io.seqera.tower.cli.utils.PaginationInfo;
import io.seqera.tower.model.ListPipelinesResponse;
import io.seqera.tower.model.PipelineQueryAttribute;
import picocli.CommandLine;
import picocli.CommandLine.Command;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

@Command(
Expand Down Expand Up @@ -68,6 +68,6 @@ protected Response exec() throws ApiException, IOException {
}
}

return new PipelinesList(workspaceRef(wspId), response.getPipelines(), baseWorkspaceUrl(wspId), showLabelsOption.showLabels);
return new PipelinesList(workspaceRef(wspId), response.getPipelines(), baseWorkspaceUrl(wspId), showLabelsOption.showLabels, PaginationInfo.from(paginationOptions, response.getTotalSize()));
}
}
Loading

0 comments on commit 9e44116

Please sign in to comment.