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

feat(wave client): Support local manifests in FUSION_CONTAINER_CONFIG_URL #5738

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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 @@ -73,8 +73,8 @@ class FusionConfig {

MemoryUnit cacheSize() { cacheSize }

URL containerConfigUrl() {
this.containerConfigUrl ? new URL(this.containerConfigUrl) : null
URI containerConfigURI() {
containerConfigUrl ? new URI(containerConfigUrl) : null
}

boolean privileged() {
Expand Down
33 changes: 27 additions & 6 deletions plugins/nf-wave/src/main/io/seqera/wave/plugin/WaveClient.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package io.seqera.wave.plugin

import java.nio.file.Paths

import static io.seqera.wave.util.DockerHelper.*

import java.net.http.HttpClient
Expand Down Expand Up @@ -376,25 +378,44 @@ class WaveClient {
}

ContainerConfig resolveContainerConfig(String platform = DEFAULT_DOCKER_PLATFORM) {
final urls = new ArrayList<URL>(config.containerConfigUrl())
final uris = config.containerConfigUrl().collect { it.toURI() }
if( fusion.enabled() ) {
final fusionUrl = fusion.containerConfigUrl() ?: defaultFusionUrl(platform)
urls.add(fusionUrl)
final fusionUrl = fusion.containerConfigURI() ?: defaultFusionUrl(platform).toURI()
uris.add(fusionUrl)
}
if( awsFargate ) {
final s5cmdUrl = s5cmdConfigUrl ?: defaultS5cmdUrl(platform)
urls.add(s5cmdUrl)
uris.add(s5cmdUrl.toURI())
}
if( !urls )
if( !uris )
return null
def result = new ContainerConfig()
for( URL it : urls ) {
for( URI it : uris ) {
// append each config to the other - the last has priority
result += fetchContainerConfig(it)
}
return result
}

@Memoized
synchronized protected ContainerConfig fetchContainerConfig(URI configURI) {
log.debug "Wave fetch container config: $configURI"
String scheme = configURI.getScheme()
if (scheme != null && scheme == 'http' || scheme == 'https' ) {
return fetchContainerConfig(configURI.toURL())
}
if (scheme == null || scheme == 'file') {
return fetchContainerConfig(Paths.get(configURI))
}
throw new IllegalArgumentException("Unsupported container config URI scheme: $scheme")
}

@Memoized
synchronized protected ContainerConfig fetchContainerConfig(Path configPath) {
log.debug "Wave read local container config: $configPath"
return jsonToContainerConfig(configPath.text)
}

@Memoized
synchronized protected ContainerConfig fetchContainerConfig(URL configUrl) {
log.debug "Wave request container config: $configUrl"
Expand Down
Loading