diff --git a/docs/reference/cli.md b/docs/reference/cli.md index 5a7f15c23c..23874f2ec5 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -631,9 +631,9 @@ The `kuberun` command supports the following options from [`run`](#run): - `-with-dag` - `-N, -with-notification` - `-with-report` +- `-with-seqera` - `-with-spack` - `-with-timeline` -- `-with-tower` - `-with-trace` - `-with-wave` - `-with-weblog` @@ -1194,6 +1194,9 @@ The `run` command is used to execute a local pipeline script or remote pipeline `-with-report` (`report-.html`) : Create workflow execution HTML report. +`-with-seqera`, `-with-tower` (`https://api.cloud.seqera.io`) +: Monitor workflow execution with [Seqera Platform](https://seqera.io/) (formerly Tower Cloud). + `-with-singularity` : Enable process execution in a Singularity container. @@ -1203,9 +1206,6 @@ The `run` command is used to execute a local pipeline script or remote pipeline `-with-timeline` (`timeline-.html`) : Create workflow execution timeline. -`-with-tower` (`https://api.cloud.seqera.io`) -: Monitor workflow execution with [Seqera Platform](https://seqera.io/) (formerly Tower Cloud). - `-with-trace` (`trace-.txt`) : Create workflow execution trace file. @@ -1271,7 +1271,7 @@ The `run` command is used to execute a local pipeline script or remote pipeline - Execute a pipeline with integrated monitoring in [Seqera Platform](https://seqera.io). ```console - $ nextflow run nextflow-io/hello -with-tower + $ nextflow run nextflow-io/hello -with-seqera ``` - Execute a pipeline with a custom parameters file (YAML or JSON). diff --git a/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy b/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy index d096e678e6..356b0f397b 100644 --- a/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy @@ -167,7 +167,7 @@ class CmdRun extends CmdBase implements HubOptions { launcher.options.ansiLog = value } - @Parameter(names = ['-with-tower'], description = 'Monitor workflow execution with Seqera Platform (formerly Tower Cloud)') + @Parameter(names = ['-with-tower', '-with-seqera'], description = 'Monitor workflow execution with Seqera Platform (formerly Tower Cloud)') String withTower @Parameter(names = ['-with-wave'], hidden = true) diff --git a/modules/nextflow/src/main/groovy/nextflow/cli/Launcher.groovy b/modules/nextflow/src/main/groovy/nextflow/cli/Launcher.groovy index 6afda06942..8ba72b764d 100644 --- a/modules/nextflow/src/main/groovy/nextflow/cli/Launcher.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/cli/Launcher.groovy @@ -293,7 +293,7 @@ class Launcher { normalized << '-' } - else if( current == '-with-tower' && (i==args.size() || args[i].startsWith('-'))) { + else if( (current == '-with-tower' || current == '-with-seqera') && (i==args.size() || args[i].startsWith('-'))) { normalized << '-' } diff --git a/modules/nextflow/src/main/groovy/nextflow/platform/PlatformHelper.groovy b/modules/nextflow/src/main/groovy/nextflow/platform/PlatformHelper.groovy index 0b701ccbe7..5a388d612b 100644 --- a/modules/nextflow/src/main/groovy/nextflow/platform/PlatformHelper.groovy +++ b/modules/nextflow/src/main/groovy/nextflow/platform/PlatformHelper.groovy @@ -30,7 +30,8 @@ class PlatformHelper { /** * Return the configured Platform access token: if `TOWER_WORKFLOW_ID` is provided in the environment, it means * we are running in a Platform-made run and we should ONLY retrieve the token from the environment. Otherwise, - * check the configuration or fallback to the environment. If no token is found, return null. + * check the configuration or fallback to the environment. The access token can be provided via either + * SEQERA_ACCESS_TOKEN (preferred) or TOWER_ACCESS_TOKEN environment variables. If no token is found, return null. * * @param opts the configuration options for Platform (e.g. `session.config.navigate('tower')`) * @param env the applicable environment variables @@ -38,8 +39,8 @@ class PlatformHelper { */ static String getAccessToken(Map opts, Map env) { final token = env.get('TOWER_WORKFLOW_ID') - ? env.get('TOWER_ACCESS_TOKEN') - : opts.containsKey('accessToken') ? opts.accessToken as String : env.get('TOWER_ACCESS_TOKEN') + ? (env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN')) + : opts.containsKey('accessToken') ? opts.accessToken as String : (env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN')) return token } diff --git a/modules/nextflow/src/test/groovy/nextflow/cli/LauncherTest.groovy b/modules/nextflow/src/test/groovy/nextflow/cli/LauncherTest.groovy index 2527d1bac1..bc55b065dc 100644 --- a/modules/nextflow/src/test/groovy/nextflow/cli/LauncherTest.groovy +++ b/modules/nextflow/src/test/groovy/nextflow/cli/LauncherTest.groovy @@ -195,6 +195,10 @@ class LauncherTest extends Specification { launcher.normalizeArgs('run','-with-tower', '-x') == ['run', '-with-tower', '-', '-x'] launcher.normalizeArgs('run','-with-tower', 'foo.com') == ['run', '-with-tower','foo.com'] + launcher.normalizeArgs('run','-with-seqera') == ['run', '-with-seqera', '-'] + launcher.normalizeArgs('run','-with-seqera', '-x') == ['run', '-with-seqera', '-', '-x'] + launcher.normalizeArgs('run','-with-seqera', 'foo.com') == ['run', '-with-seqera','foo.com'] + launcher.normalizeArgs('run','-with-wave') == ['run', '-with-wave', '-'] launcher.normalizeArgs('run','-with-wave', '-x') == ['run', '-with-wave', '-', '-x'] launcher.normalizeArgs('run','-with-wave', 'foo.com') == ['run', '-with-wave','foo.com'] diff --git a/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy b/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy index 18c331a073..1a02897a63 100644 --- a/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy +++ b/modules/nf-commons/src/main/nextflow/plugin/PluginsFacade.groovy @@ -430,7 +430,7 @@ class PluginsFacade implements PluginStateListener { } // add tower plugin when config contains tower options - if( (Bolts.navigate(config,'tower.enabled') || Bolts.navigate(config,'fusion.enabled') || env.TOWER_ACCESS_TOKEN ) && !specs.find {it.id == 'nf-tower' } ) { + if( (Bolts.navigate(config,'tower.enabled') || Bolts.navigate(config,'fusion.enabled') || env.TOWER_ACCESS_TOKEN || env.SEQERA_ACCESS_TOKEN) && !specs.find {it.id == 'nf-tower' } ) { specs << defaultPlugins.getPlugin('nf-tower') } if( (Bolts.navigate(config,'wave.enabled') || Bolts.navigate(config,'fusion.enabled')) && !specs.find {it.id == 'nf-wave' } ) { diff --git a/plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerClient.groovy b/plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerClient.groovy index e9cc657766..aa63408f2c 100644 --- a/plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerClient.groovy +++ b/plugins/nf-tower/src/main/io/seqera/tower/plugin/TowerClient.groovy @@ -378,15 +378,19 @@ class TowerClient implements TraceObserver { log.info(LoggerHelper.STICKY, msg) } + /** + * Get the access token for Seqera Platform authentication. + * When 'TOWER_WORKFLOW_ID' is provided in the env, it's a tower made launch + * therefore the access token should only be taken from the env. + * Otherwise check into the config file and fallback in the env. + * The access token can be provided via either SEQERA_ACCESS_TOKEN (preferred) or TOWER_ACCESS_TOKEN environment variables. + */ String getAccessToken() { - // when 'TOWER_WORKFLOW_ID' is provided in the env, it's a tower made launch - // therefore the access token should only be taken from the env - // otherwise check into the config file and fallback in the env def token = env.get('TOWER_WORKFLOW_ID') - ? env.get('TOWER_ACCESS_TOKEN') - : session.config.navigate('tower.accessToken', env.get('TOWER_ACCESS_TOKEN')) + ? (env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN')) + : session.config.navigate('tower.accessToken', env.get('SEQERA_ACCESS_TOKEN') ?: env.get('TOWER_ACCESS_TOKEN')) if( !token ) - throw new AbortOperationException("Missing Seqera Platform access token -- Make sure there's a variable TOWER_ACCESS_TOKEN in your environment") + throw new AbortOperationException("Missing Seqera Platform access token -- Make sure there's a variable SEQERA_ACCESS_TOKEN or TOWER_ACCESS_TOKEN in your environment") return token }