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

CWL 1.3 - Convert SBGSECRETS to standard secrets #170

Open
bkappes opened this issue May 17, 2024 · 1 comment
Open

CWL 1.3 - Convert SBGSECRETS to standard secrets #170

bkappes opened this issue May 17, 2024 · 1 comment

Comments

@bkappes
Copy link

bkappes commented May 17, 2024

Example of a Seven Bridges CWL that uses secrets.

{
    "class": "CommandLineTool",
    "cwlVersion": "v1.2",
    "$namespaces": {
        "sbg": "https://sevenbridges.com"
    },
    "baseCommand": [
        "birdshot"
    ],
    "inputs": [
        {
            "sbg:secretAlias": "SBGSECRET_USER",
            "id": "username",
            "type": "string",
            "label": "Carta Username"
        },
        {
            "sbg:secretAlias": "SBGSECRET_PASS",
            "id": "password",
            "type": "string",
            "label": "Carta Password"
        },
        {
            "id": "use_development_env",
            "type": "boolean?",
            "label": "Development Environment",
            "doc": "Turn on if the Carta credentials are for the development environment. Default: off (False).",
            "default": false
        },
        {
            "id": "no_auth",
            "type": "boolean?",
            "label": "Disable Authentication",
            "doc": "If enabled, this flag prevents authentication. This is useful when no data needs to be retrieved from the BIRDSHOT Google Drive; i.e., all files are local.",
            "default": null
        },
        {
            "id": "unpack",
            "type": "boolean?",
            "label": "Unpack Metadata",
            "doc": "If True (default), load metadata into the appropriate node in the graph.",
            "default": true
        }
    ],
    "outputs": [
        {
            "id": "output",
            "type": "File?",
            "outputBinding": {
                "glob": "birdshot*.pkl"
            }
        }
    ],
    "label": "birdshot-graph-download",
    "arguments": [
        {
            "prefix": "--username",
            "shellQuote": false,
            "position": 0,
            "valueFrom": "$SBGSECRET_USER"
        },
        {
            "prefix": "--password",
            "shellQuote": false,
            "position": 0,
            "valueFrom": "$SBGSECRET_PASS"
        },
        {
            "prefix": "--url",
            "shellQuote": false,
            "position": 0,
            "valueFrom": "${\n    if(inputs.use_development_env) {\n        return \"https://api.sandbox.carta.contextualize.us.com\"\n    } else {\n        return \"https://api.carta.contextualize.us.com\"\n    }\n}"
        },
        {
            "prefix": "",
            "shellQuote": false,
            "position": 0,
            "valueFrom": "${\n    if(inputs.no_auth) {\n        return \"--no-auth\"\n    } else {\n        return \"\"\n    }\n}"
        },
        {
            "prefix": "",
            "shellQuote": false,
            "position": 1,
            "valueFrom": "graph"
        },
        {
            "prefix": "",
            "shellQuote": false,
            "position": 2,
            "valueFrom": "${\n    if(inputs.unpack) {\n        return \"push --pass nodes node-filter -n '.*.json' unpack drop pop\"\n    } else {\n        return \"\"\n    }\n}"
        },
        {
            "prefix": "dump",
            "shellQuote": false,
            "position": 3,
            "valueFrom": "${\n    var date = new Date();\n    return \"birdshot-\" + date.toISOString().split(\"T\")[0] + \".pkl\"\n}"
        }
    ],
    "requirements": [
        {
            "class": "ShellCommandRequirement"
        },
        {
            "class": "DockerRequirement",
            "dockerPull": "images.sbgenomics.com/htmdec/birdshot:0.1.8"
        },
        {
            "class": "EnvVarRequirement",
            "envDef": [
                {
                    "envName": "SBGSECRET_USER",
                    "envValue": "$(inputs.username)"
                },
                {
                    "envName": "SBGSECRET_PASS",
                    "envValue": "$(inputs.password)"
                },
                {
                    "envName": "DEBUG",
                    "envValue": "1"
                }
            ]
        },
        {
            "class": "InlineJavascriptRequirement"
        }
    ],
    "sbg:projectName": "demo",
    "sbg:revisionsInfo": [
        {
            "sbg:revision": 0,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703194967,
            "sbg:revisionNotes": null
        },
        {
            "sbg:revision": 1,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703196795,
            "sbg:revisionNotes": "Initial commit."
        },
        {
            "sbg:revision": 2,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703197220,
            "sbg:revisionNotes": "Forgot output port."
        },
        {
            "sbg:revision": 3,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703197675,
            "sbg:revisionNotes": "Forgot to pop the graph back into the queue."
        },
        {
            "sbg:revision": 4,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703218588,
            "sbg:revisionNotes": "Tracking bug in output file."
        },
        {
            "sbg:revision": 5,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703219346,
            "sbg:revisionNotes": "Enabled debugging."
        },
        {
            "sbg:revision": 6,
            "sbg:modifiedBy": "htmdec/bkappes",
            "sbg:modifiedOn": 1703256215,
            "sbg:revisionNotes": "Forgot '-n' flag to node-filter."
        }
    ],
    "sbg:image_url": null,
    "sbg:appVersion": [
        "v1.2"
    ],
    "id": "https://api.sbgenomics.com/v2/apps/htmdec/demo/birdshot-graph-download/6/raw/",
    "sbg:id": "htmdec/demo/birdshot-graph-download/6",
    "sbg:revision": 6,
    "sbg:revisionNotes": "Forgot '-n' flag to node-filter.",
    "sbg:modifiedOn": 1703256215,
    "sbg:modifiedBy": "htmdec/bkappes",
    "sbg:createdOn": 1703194967,
    "sbg:createdBy": "htmdec/bkappes",
    "sbg:project": "htmdec/demo",
    "sbg:sbgMaintained": false,
    "sbg:validationErrors": [],
    "sbg:contributors": [
        "htmdec/bkappes"
    ],
    "sbg:latestRevision": 6,
    "sbg:publisher": "sbg",
    "sbg:content_hash": "a2c1eb446345b451a0ca15e663bfc43fec3cc6bd750fedfa3a03fed4e5894d3f4",
    "sbg:workflowLanguage": "CWL"
}
@tetron
Copy link
Member

tetron commented May 17, 2024

        {
            "sensitive": true,
            "default": {
               "class": "Secret",
               "secretKey": "SBGSECRET_USER"
            },
            "id": "username",
            "type": "string",
            "label": "Carta Username"
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants