Skip to content

Commit f0b535b

Browse files
Remove imNotification from utils_nfcore_pipeline (#10119)
* Remove imNotification function from utils_nfcore_pipeline subworkflow Part of removing Slack/Teams webhook notification support from the nf-core template. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Rename workflow test file to main.nf.test to satisfy linter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f3e0289 commit f0b535b

3 files changed

Lines changed: 0 additions & 64 deletions

File tree

subworkflows/nf-core/utils_nfcore_pipeline/main.nf

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -353,67 +353,3 @@ def completionSummary(monochrome_logs=true) {
353353
log.info("-${colors.purple}[${workflow.manifest.name}]${colors.red} Pipeline completed with errors${colors.reset}-")
354354
}
355355
}
356-
357-
//
358-
// Construct and send a notification to a web server as JSON e.g. Microsoft Teams and Slack
359-
//
360-
def imNotification(summary_params, hook_url) {
361-
def summary = [:]
362-
summary_params
363-
.keySet()
364-
.sort()
365-
.each { group ->
366-
summary << summary_params[group]
367-
}
368-
369-
def misc_fields = [:]
370-
misc_fields['start'] = workflow.start
371-
misc_fields['complete'] = workflow.complete
372-
misc_fields['scriptfile'] = workflow.scriptFile
373-
misc_fields['scriptid'] = workflow.scriptId
374-
if (workflow.repository) {
375-
misc_fields['repository'] = workflow.repository
376-
}
377-
if (workflow.commitId) {
378-
misc_fields['commitid'] = workflow.commitId
379-
}
380-
if (workflow.revision) {
381-
misc_fields['revision'] = workflow.revision
382-
}
383-
misc_fields['nxf_version'] = workflow.nextflow.version
384-
misc_fields['nxf_build'] = workflow.nextflow.build
385-
misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp
386-
387-
def msg_fields = [:]
388-
msg_fields['version'] = getWorkflowVersion()
389-
msg_fields['runName'] = workflow.runName
390-
msg_fields['success'] = workflow.success
391-
msg_fields['dateComplete'] = workflow.complete
392-
msg_fields['duration'] = workflow.duration
393-
msg_fields['exitStatus'] = workflow.exitStatus
394-
msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None')
395-
msg_fields['errorReport'] = (workflow.errorReport ?: 'None')
396-
msg_fields['commandLine'] = workflow.commandLine.replaceFirst(/ +--hook_url +[^ ]+/, "")
397-
msg_fields['projectDir'] = workflow.projectDir
398-
msg_fields['summary'] = summary << misc_fields
399-
400-
// Render the JSON template
401-
def engine = new groovy.text.GStringTemplateEngine()
402-
// Different JSON depending on the service provider
403-
// Defaults to "Adaptive Cards" (https://adaptivecards.io), except Slack which has its own format
404-
def json_path = hook_url.contains("hooks.slack.com") ? "slackreport.json" : "adaptivecard.json"
405-
def hf = new File("${workflow.projectDir}/assets/${json_path}")
406-
def json_template = engine.createTemplate(hf).make(msg_fields)
407-
def json_message = json_template.toString()
408-
409-
// POST
410-
def post = new URL(hook_url).openConnection()
411-
post.setRequestMethod("POST")
412-
post.setDoOutput(true)
413-
post.setRequestProperty("Content-Type", "application/json")
414-
post.getOutputStream().write(json_message.getBytes("UTF-8"))
415-
def postRC = post.getResponseCode()
416-
if (!postRC.equals(200)) {
417-
log.warn(post.getErrorStream().getText())
418-
}
419-
}

subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test renamed to subworkflows/nf-core/utils_nfcore_pipeline/tests/main.nf.test

File renamed without changes.

subworkflows/nf-core/utils_nfcore_pipeline/tests/main.workflow.nf.test.snap renamed to subworkflows/nf-core/utils_nfcore_pipeline/tests/main.nf.test.snap

File renamed without changes.

0 commit comments

Comments
 (0)