Skip to content

Commit

Permalink
adding support for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dapineyro committed Apr 11, 2024
1 parent 79a651e commit 5d3413e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## lifebit-ai/cloudos-cli: changelog

## v2.10.0 (2024-04-11)

- Adds the new parameter `--workflow-docs-link` to add a documentation link to the imported workflow.

## v2.9.0 (2024-04-09)

- Adds `workflow import` command, allowing user to import Nextflow workflows to CloudOS.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,20 @@ Executing workflow import...
Workflow test_import_github_3 was imported successfully with the following ID: 6616a8cb454b09bbb3d9dc20
```

Optionally, you can add a link to your workflow documentation by providing the URL using the parameter `--workflow-docs-link`. E.g.:

```bash
cloudos workflow import \
--cloudos-url $CLOUDOS \
--apikey $MY_API_KEY \
--workspace-id $WORKSPACE_ID \
--workflow-url $WORKFLOW_URL \
--workflow-name "new_name_for_the_github_workflow" \
--workflow-docs-link "https://github.com/lifebit-ai/DeepVariant/blob/master/README.md" \
--repository-project-id $REPOSITORY_PROJECT_ID \
--repository-id $REPOSITORY_ID
```

To import bitbucket server workflows, `--repository-id` parameter is not required:

```bash
Expand Down
5 changes: 5 additions & 0 deletions cloudos/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,9 @@ def list_workflows(apikey,
@click.option('--workflow-name',
help="The name that the workflow will have in CloudOS",
required=True)
@click.option('--workflow-docs-link',
help="Workflow documentation URL.",
default='')
@click.option('--repository-project-id',
type=int,
help="The ID of your repository project",
Expand All @@ -818,6 +821,7 @@ def import_workflows(apikey,
workflow_url,
workflow_name,
repository_project_id,
workflow_docs_link,
repository_id,
disable_ssl_verification,
ssl_cert):
Expand All @@ -830,6 +834,7 @@ def import_workflows(apikey,
workflow_url,
workflow_name,
repository_project_id,
workflow_docs_link,
repository_id,
verify=verify_ssl)
print(f'\tWorkflow {workflow_name} was imported successfully with the ' +
Expand Down
2 changes: 1 addition & 1 deletion cloudos/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.9.0'
__version__ = '2.10.0'
7 changes: 5 additions & 2 deletions cloudos/clos.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,8 @@ def process_project_list(r, all_fields=False):
return df

def workflow_import(self, workspace_id, workflow_url, workflow_name,
repository_project_id, repository_id=None, verify=True):
repository_project_id, workflow_docs_link='',
repository_id=None, verify=True):
"""Imports workflows to CloudOS.
Parameters
Expand All @@ -547,6 +548,8 @@ def workflow_import(self, workspace_id, workflow_url, workflow_name,
A name for the imported pipeline in CloudOS.
repository_project_id : int
The repository project ID.
workflow_docs_link : string
Link to the documentation URL.
repository_id : int
The repository ID. Only required for GitHub repositories.
verify: [bool|string]
Expand Down Expand Up @@ -596,7 +599,7 @@ def workflow_import(self, workspace_id, workflow_url, workflow_name,
"mainFile": "main.nf",
"defaultContainer": None,
"processes": [],
"docsLink": "",
"docsLink": workflow_docs_link,
"team": workspace_id
}
r = retry_requests_post("{}/api/v1/workflows?teamId={}".format(self.cloudos_url,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_clos/test_workflow_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
WORKSPACE_ID = 'lv89ufc838sdig'
WORKFLOW_URL = 'https://github.com/lifebit-ai/repo'
WORKFLOW_NAME = 'test-repo'
WORKFLOW_DOCS_LINK = ''
REPOSITORY_PROJECT_ID = 1234
REPOSITORY_ID = 567

Expand All @@ -38,6 +39,7 @@ def test_workflow_import_correct():
WORKFLOW_URL,
WORKFLOW_NAME,
REPOSITORY_PROJECT_ID,
WORKFLOW_DOCS_LINK,
REPOSITORY_ID)
# check the response
assert isinstance(workflow_id, str)
Expand Down Expand Up @@ -70,5 +72,6 @@ def test_workflow_import_incorrect():
WORKFLOW_URL,
WORKFLOW_NAME,
REPOSITORY_PROJECT_ID,
WORKFLOW_DOCS_LINK,
REPOSITORY_ID)
assert "Server returned status 400." in (str(error))

0 comments on commit 5d3413e

Please sign in to comment.