Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Hardcoded Profiles and Default URLs from SCORe Client #469

Merged
merged 4 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@

import bio.overture.score.client.cli.Terminal;
import bio.overture.score.client.config.ClientProperties;
import bio.overture.score.client.manifest.DownloadManifest;
import bio.overture.score.client.util.ProfileRepoValidator;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

Expand All @@ -39,22 +36,4 @@ public abstract class AbstractClientCommand implements ClientCommand {
protected void printTitle() {
terminal.printStatus("\n" + terminal.label("> ") + terminal.value("SCORE ") + "Client\n\n");
}

protected void validateManifest(final DownloadManifest manifest) {
for (val entry : manifest.getEntries()) {
try {
if (!ProfileRepoValidator.validateRepoAgainstProfile(storageProfile, entry.getRepoCode())) {
terminal.printWarn(
"Manifest entry %s - %s (%s) exists in the '%s' repository. However, this SCORe Client instance is using the '%s' profile.",
entry.getFileId(),
entry.getFileName(),
entry.getFileUuid(),
entry.getRepoCode(),
storageProfile);
}
} catch (IllegalArgumentException iae) {
terminal.printWarn(iae.getMessage());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ private List<String> getIdsFromManifest(ManifestResource manifestResource)
}
val manifest = manifestService.getDownloadManifest(manifestResource);

validateManifest(manifest);

val entries = manifest.getEntries();
if (entries.isEmpty()) {
throw new BadManifestException(format("Manifest '%s' is empty", manifestResource));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ private void version() {
}

private void active() {
if ((storageUrl == null || storageUrl.isEmpty())
&& (metadataUrl == null || metadataUrl.isEmpty())) {
throw new IllegalArgumentException(
"Error: Storage URL or Metadata URL is not configured. Please provide a valid URL.");
}
terminal.println(terminal.label(" Active Configuration: "));
terminal.println(" Profile: " + storageProfile);
terminal.println(" Storage URL: " + terminal.url(storageUrl));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,6 @@ private boolean hasManifest() {
private List<ObjectInfo> filterManifestObjects(List<ObjectInfo> objects) {
val manifest = manifestService.getDownloadManifest(manifestResource);

validateManifest(manifest);

val objectIds =
manifest.getEntries().stream()
.flatMap(entry -> Stream.of(entry.getFileUuid(), entry.getIndexFileUuid()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
/** Service responsible for interacting with the remote upload service. */
@Slf4j
@Service
@Profile({"dev", "collab", "aws", "default", "!kf"})
@Profile({"dev", "collab", "aws", "default"})
public class ScoreStorageService extends AbstractStorageService {

/** Configuration. */
Expand Down

This file was deleted.

38 changes: 2 additions & 36 deletions score-client/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ transport:

storage:
# default for backwards compatibility
url: https://virginia.cloud.icgc.org
# url:
retryNumber: 10
retryTimeout: 1

metadata:
# default for backwards compatibility
url: https://virginia.song.icgc.org
# url:
ssl:
enabled: true

Expand All @@ -80,40 +80,6 @@ token:
isTest: false
defaultProfile: collaboratory

---

###############################################################################
# Profile - "kf"
###############################################################################

spring:
config:
activate:
on-profile: kf

# Storage server
storage:
url: https://kf.com


client:
ssl:
custom: false

---

###############################################################################
# Profile - "oicr"
###############################################################################

spring:
config:
activate:
on-profile: oicr

# uses storage.url and client.ssl.custom define in common


---

###############################################################################
Expand Down
38 changes: 6 additions & 32 deletions score-client/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ transport:

storage:
# default for backwards compatibility
url: https://virginia.cloud.icgc.org
url: https://teststorageurl
retryNumber: 10
retryTimeout: 1

metadata:
# default for backwards compatibility
url: https://virginia.song.icgc.org
url: https://testmetadataurl
ssl:
enabled: true

Expand All @@ -69,7 +69,7 @@ portal:

logging:
file: target/logs/client.log

mount:
logging: false

Expand All @@ -79,35 +79,9 @@ token:

isTest: true
defaultProfile: collaboratory

---

###############################################################################
# Profile - "kf"
###############################################################################

spring.profiles: kf

# Storage server
storage:
url: https://kf.com


client:
ssl:
custom: false

---

###############################################################################
# Profile - "oicr"
###############################################################################

spring.profiles: oicr

# uses storage.url and client.ssl.custom define in common


logging:
file:
name: target/logs/client.log
---

###############################################################################
Expand Down