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: adds private docker container support #179

Merged
merged 12 commits into from
Jan 22, 2025

Conversation

dapineyro
Copy link
Collaborator

@dapineyro dapineyro commented Jan 21, 2025

Overview

This PR adds support for "Use private Docker repository" feature in CloudOS.
Screenshot 2025-01-21 at 19 34 45

This new feature allows the user to run using private docker images from their personal docker.io account.

The users have to link their docker.io account to cloudOS using the UI. If docker.io account is not linked, the user won't see the "Use private Docker repository" option in batch queue options. They will see a link to the page for connecting accounts.
Screenshot 2025-01-21 at 19 38 57

This feature doesn't work with system-tools and similar (Module workflows), as there is no option to select queues and then the option for use private Docker repo is not shown.

Jira

https://lifebit.atlassian.net/browse/LIF-1568

Changes

  • Flag --use-private-docker-repository added to cloudos job run command.
  • Checks done when using cloudos jog run --use-private-docker-repository:
    1. If the workflow is a system tool or similar (it's a module), then a message will be printed to inform the user the option won't take effect as CloudOS module tools are not compatible
    2. It checks user's credentials and if the user does not have credentials for docker.io, it raises an error
    3. If all passes, the same message as in the UI will be printed to inform the user that the option was selected and a custom job queue will be created based on their selected queue (or the default one)
  • The new method Cloudos.get_user_info has been added to be able to inspect user's credentials.
  • A new Pytest has been added for the new method.
  • The "dockerLogin" API request parameter has been added based on the new parameter.

Tests

Using docker image:

docker run --rm -it quay.io/lifebitaiorg/cloudos-cli:v2.16.0

Global variables:

CLOUDOS="https://cloudos.lifebit.ai"
MY_API_KEY="xxxx"
WORKSPACE_ID="xxxx"
PROJECT_NAME="API jobs"
WORKFLOW_NAME="rnatoy"
JOB_PARAMS="cloudos/examples/rnatoy.config"

Sending a job with default params (not using the new flag)

cloudos job run \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID \
    --project-name "$PROJECT_NAME" \
    --workflow-name $WORKFLOW_NAME \
    --job-config $JOB_PARAMS \
    --job-name cloudos_cli_default
Screenshot 2025-01-22 at 15 05 18 Screenshot 2025-01-22 at 15 05 37

Sending a job using --use-private-docker-repository from a user that has the credentials linked

Screenshot 2025-01-22 at 14 40 47
cloudos job run \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID \
    --project-name "$PROJECT_NAME" \
    --workflow-name $WORKFLOW_NAME \
    --job-config $JOB_PARAMS \
    --job-name cloudos_cli_private_docker \
    --use-private-docker-repository
Screenshot 2025-01-22 at 15 06 24 Screenshot 2025-01-22 at 15 06 40

Note

The queue used is now a clone from the previous one

Sending a job using --use-private-docker-repository from a user that doesn't have the credentials linked

Screenshot 2025-01-22 at 14 42 51
cloudos job run \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID \
    --project-name "$PROJECT_NAME" \
    --workflow-name $WORKFLOW_NAME \
    --job-config $JOB_PARAMS \
    --job-name cloudos_cli_private_docker \
    --use-private-docker-repository
Screenshot 2025-01-22 at 15 07 55

Sending a GWAS job (a module tool) using --use-private-docker-repository from a user that has the credentials linked

Screenshot 2025-01-22 at 14 44 31
WORKFLOW_NAME="GWAS"
cloudos job run \
    --cloudos-url $CLOUDOS \
    --apikey $MY_API_KEY \
    --workspace-id $WORKSPACE_ID \
    --project-name "$PROJECT_NAME" \
    --workflow-name $WORKFLOW_NAME \
    --nextflow-profile test_ci_staging_cloudos_phenofile \
    --job-name cloudos_cli_system_tool \
    --use-private-docker-repository
Screenshot 2025-01-22 at 15 09 24 Screenshot 2025-01-22 at 15 09 38

Note

It is using the expected system-tools queue

@dapineyro dapineyro marked this pull request as draft January 21, 2025 18:26
@dapineyro dapineyro marked this pull request as ready for review January 21, 2025 18:26
@dapineyro dapineyro requested a review from s0rthak January 22, 2025 14:10
@dapineyro dapineyro marked this pull request as draft January 22, 2025 14:59
@dapineyro dapineyro marked this pull request as ready for review January 22, 2025 14:59
Copy link
Member

@s0rthak s0rthak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@danielboloc danielboloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dapineyro dapineyro merged commit 827387f into main Jan 22, 2025
8 checks passed
@dapineyro dapineyro deleted the adds_private_container_support_for_jobs branch January 22, 2025 16:40
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

Successfully merging this pull request may close these issues.

3 participants