Repository: iterative/cml
Pull request #822 (2021-11-28 16:56:19)

Bitbucket driver choice
Adds BB as a driver choice. 


Patch:
diff --git a/bin/cml/pr.js b/bin/cml/pr.js
index e529fdc..9eab83b 100755
--- a/bin/cml/pr.js
+++ b/bin/cml/pr.js
@@ -46,7 +46,7 @@ exports.builder = (yargs) =>
       },
       driver: {
         type: 'string',
-        choices: ['github', 'gitlab'],
+        choices: ['github', 'gitlab', 'bitbucket'],
         description: 'If not specify it infers it from the ENV.'
       }
     })
diff --git a/bin/cml/publish.js b/bin/cml/publish.js
index e3f8661..3b4723e 100644
--- a/bin/cml/publish.js
+++ b/bin/cml/publish.js
@@ -72,7 +72,7 @@ exports.builder = (yargs) =>
       },
       driver: {
         type: 'string',
-        choices: ['github', 'gitlab'],
+        choices: ['github', 'gitlab', 'bitbucket'],
         description: 'If not specify it infers it from the ENV.'
       }
     })


Test patch:
diff --git a/bin/cml/pr.test.js b/bin/cml/pr.test.js
index 20bcce6..1f4aae3 100644
--- a/bin/cml/pr.test.js
+++ b/bin/cml/pr.test.js
@@ -5,25 +5,25 @@ describe('CML e2e', () => {
     const output = await exec(`echo none | node ./bin/cml.js pr --help`);
 
     expect(output).toMatchInlineSnapshot(`
-"cml.js pr <glob path...>
+      "cml.js pr <glob path...>
 
-Create a pull request with the specified files
+      Create a pull request with the specified files
 
-Options:
-  --help        Show help                                              [boolean]
-  --version     Show version number                                    [boolean]
-  --log         Maximum log level
-          [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
-  --md          Output in markdown format [](url).                     [boolean]
-  --remote      Sets git remote.                    [string] [default: \\"origin\\"]
-  --user-email  Sets git user email.   [string] [default: \\"olivaw@iterative.ai\\"]
-  --user-name   Sets git user name.            [string] [default: \\"Olivaw[bot]\\"]
-  --repo        Specifies the repo to be used. If not specified is extracted
-                from the CI ENV.                                        [string]
-  --token       Personal access token to be used. If not specified in extracted
-                from ENV REPO_TOKEN.                                    [string]
-  --driver      If not specify it infers it from the ENV.
-                                          [string] [choices: \\"github\\", \\"gitlab\\"]"
-`);
+      Options:
+        --help        Show help                                              [boolean]
+        --version     Show version number                                    [boolean]
+        --log         Maximum log level
+                [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
+        --md          Output in markdown format [](url).                     [boolean]
+        --remote      Sets git remote.                    [string] [default: \\"origin\\"]
+        --user-email  Sets git user email.   [string] [default: \\"olivaw@iterative.ai\\"]
+        --user-name   Sets git user name.            [string] [default: \\"Olivaw[bot]\\"]
+        --repo        Specifies the repo to be used. If not specified is extracted
+                      from the CI ENV.                                        [string]
+        --token       Personal access token to be used. If not specified in extracted
+                      from ENV REPO_TOKEN.                                    [string]
+        --driver      If not specify it infers it from the ENV.
+                                   [string] [choices: \\"github\\", \\"gitlab\\", \\"bitbucket\\"]"
+    `);
   });
 });
diff --git a/bin/cml/publish.test.js b/bin/cml/publish.test.js
index f8ee06b..715bde8 100644
--- a/bin/cml/publish.test.js
+++ b/bin/cml/publish.test.js
@@ -6,37 +6,37 @@ describe('CML e2e', () => {
     const output = await exec(`node ./bin/cml.js publish --help`);
 
     expect(output).toMatchInlineSnapshot(`
-"cml.js publish <asset>
-
-Upload an image to build a report
-
-Options:
-      --help                      Show help                            [boolean]
-      --version                   Show version number                  [boolean]
-      --log                       Maximum log level
-          [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
-      --md                        Output in markdown format [title ||
-                                  name](url).                          [boolean]
-  -t, --title                     Markdown title [title](url) or ![](url title).
-                                                                        [string]
-      --native, --gitlab-uploads  Uses driver's native capabilities to upload
-                                  assets instead of CML's storage. Currently
-                                  only available for GitLab CI.        [boolean]
-      --rm-watermark              Avoid CML watermark.                 [boolean]
-      --mime-type                 Specifies the mime-type. If not set guess it
-                                  from the content.                     [string]
-  -f, --file                      Append the output to the given file. Create it
-                                  if does not exist.                    [string]
-      --repo                      Specifies the repo to be used. If not
-                                  specified is extracted from the CI ENV.
-                                                                        [string]
-      --token                     Personal access token to be used. If not
-                                  specified, extracted from ENV REPO_TOKEN,
-                                  GITLAB_TOKEN, GITHUB_TOKEN, or
-                                  BITBUCKET_TOKEN.                      [string]
-      --driver                    If not specify it infers it from the ENV.
-                                          [string] [choices: \\"github\\", \\"gitlab\\"]"
-`);
+    "cml.js publish <asset>
+
+    Upload an image to build a report
+
+    Options:
+          --help                      Show help                            [boolean]
+          --version                   Show version number                  [boolean]
+          --log                       Maximum log level
+              [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
+          --md                        Output in markdown format [title ||
+                                      name](url).                          [boolean]
+      -t, --title                     Markdown title [title](url) or ![](url title).
+                                                                            [string]
+          --native, --gitlab-uploads  Uses driver's native capabilities to upload
+                                      assets instead of CML's storage. Currently
+                                      only available for GitLab CI.        [boolean]
+          --rm-watermark              Avoid CML watermark.                 [boolean]
+          --mime-type                 Specifies the mime-type. If not set guess it
+                                      from the content.                     [string]
+      -f, --file                      Append the output to the given file. Create it
+                                      if does not exist.                    [string]
+          --repo                      Specifies the repo to be used. If not
+                                      specified is extracted from the CI ENV.
+                                                                            [string]
+          --token                     Personal access token to be used. If not
+                                      specified, extracted from ENV REPO_TOKEN,
+                                      GITLAB_TOKEN, GITHUB_TOKEN, or
+                                      BITBUCKET_TOKEN.                      [string]
+          --driver                    If not specify it infers it from the ENV.
+                                 [string] [choices: \\"github\\", \\"gitlab\\", \\"bitbucket\\"]"
+  `);
   });
 
   test('cml publish assets/logo.png --md', async () => {
diff --git a/bin/cml/runner.test.js b/bin/cml/runner.test.js
index d928956..76ffe9d 100644
--- a/bin/cml/runner.test.js
+++ b/bin/cml/runner.test.js
@@ -5,62 +5,62 @@ describe('CML e2e', () => {
     const output = await exec(`echo none | node ./bin/cml.js runner --help`);
 
     expect(output).toMatchInlineSnapshot(`
-"cml.js runner
+      "cml.js runner
 
-Launch and register a self-hosted runner
+      Launch and register a self-hosted runner
 
-Options:
-  --help                      Show help                                [boolean]
-  --version                   Show version number                      [boolean]
-  --log                       Maximum log level
-          [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
-  --labels                    One or more user-defined labels for this runner
-                              (delimited with commas)  [string] [default: \\"cml\\"]
-  --idle-timeout              Seconds to wait for jobs before shutting down. Set
-                              to -1 to disable timeout   [number] [default: 300]
-  --name                      Name displayed in the repository once registered
-                                                    [string] [default: cml-{ID}]
-  --no-retry                  Do not restart workflow terminated due to instance
-                              disposal or GitHub Actions timeout       [boolean]
-  --single                    Exit after running a single job          [boolean]
-  --reuse                     Don't launch a new runner if an existing one has
-                              the same name or overlapping labels      [boolean]
-  --driver                    Platform where the repository is hosted. If not
-                              specified, it will be inferred from the
-                              environment [string] [choices: \\"github\\", \\"gitlab\\"]
-  --repo                      Repository to be used for registering the runner.
-                              If not specified, it will be inferred from the
-                              environment                               [string]
-  --token                     Personal access token to register a self-hosted
-                              runner on the repository. If not specified, it
-                              will be inferred from the environment     [string]
-  --cloud                     Cloud to deploy the runner
-                         [string] [choices: \\"aws\\", \\"azure\\", \\"gcp\\", \\"kubernetes\\"]
-  --cloud-region              Region where the instance is deployed. Choices:
-                              [us-east, us-west, eu-west, eu-north]. Also
-                              accepts native cloud regions
-                                                   [string] [default: \\"us-west\\"]
-  --cloud-type                Instance type. Choices: [m, l, xl]. Also supports
-                              native types like i.e. t2.micro           [string]
-  --cloud-permission-set      Specifies the instance profile in AWS or instance
-                              service account in GCP      [string] [default: \\"\\"]
-  --cloud-metadata            Key Value pairs to associate cml-runner instance
-                              on the provider i.e. tags/labels \\"key=value\\"
-                                                           [array] [default: []]
-  --cloud-gpu                 GPU type.
-                             [string] [choices: \\"nogpu\\", \\"k80\\", \\"v100\\", \\"tesla\\"]
-  --cloud-hdd-size            HDD size in GB                            [number]
-  --cloud-ssh-private         Custom private RSA SSH key. If not provided an
-                              automatically generated throwaway key will be used
-                                                                        [string]
-  --cloud-spot                Request a spot instance                  [boolean]
-  --cloud-spot-price          Maximum spot instance bidding price in USD.
-                              Defaults to the current spot bidding price
-                                                          [number] [default: -1]
-  --cloud-startup-script      Run the provided Base64-encoded Linux shell script
-                              during the instance initialization        [string]
-  --cloud-aws-security-group  Specifies the security group in AWS
-                                                          [string] [default: \\"\\"]"
-`);
+      Options:
+        --help                      Show help                                [boolean]
+        --version                   Show version number                      [boolean]
+        --log                       Maximum log level
+                [string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
+        --labels                    One or more user-defined labels for this runner
+                                    (delimited with commas)  [string] [default: \\"cml\\"]
+        --idle-timeout              Seconds to wait for jobs before shutting down. Set
+                                    to -1 to disable timeout   [number] [default: 300]
+        --name                      Name displayed in the repository once registered
+                                                          [string] [default: cml-{ID}]
+        --no-retry                  Do not restart workflow terminated due to instance
+                                    disposal or GitHub Actions timeout       [boolean]
+        --single                    Exit after running a single job          [boolean]
+        --reuse                     Don't launch a new runner if an existing one has
+                                    the same name or overlapping labels      [boolean]
+        --driver                    Platform where the repository is hosted. If not
+                                    specified, it will be inferred from the
+                                    environment [string] [choices: \\"github\\", \\"gitlab\\"]
+        --repo                      Repository to be used for registering the runner.
+                                    If not specified, it will be inferred from the
+                                    environment                               [string]
+        --token                     Personal access token to register a self-hosted
+                                    runner on the repository. If not specified, it
+                                    will be inferred from the environment     [string]
+        --cloud                     Cloud to deploy the runner
+                               [string] [choices: \\"aws\\", \\"azure\\", \\"gcp\\", \\"kubernetes\\"]
+        --cloud-region              Region where the instance is deployed. Choices:
+                                    [us-east, us-west, eu-west, eu-north]. Also
+                                    accepts native cloud regions
+                                                         [string] [default: \\"us-west\\"]
+        --cloud-type                Instance type. Choices: [m, l, xl]. Also supports
+                                    native types like i.e. t2.micro           [string]
+        --cloud-permission-set      Specifies the instance profile in AWS or instance
+                                    service account in GCP      [string] [default: \\"\\"]
+        --cloud-metadata            Key Value pairs to associate cml-runner instance
+                                    on the provider i.e. tags/labels \\"key=value\\"
+                                                                 [array] [default: []]
+        --cloud-gpu                 GPU type.
+                                   [string] [choices: \\"nogpu\\", \\"k80\\", \\"v100\\", \\"tesla\\"]
+        --cloud-hdd-size            HDD size in GB                            [number]
+        --cloud-ssh-private         Custom private RSA SSH key. If not provided an
+                                    automatically generated throwaway key will be used
+                                                                              [string]
+        --cloud-spot                Request a spot instance                  [boolean]
+        --cloud-spot-price          Maximum spot instance bidding price in USD.
+                                    Defaults to the current spot bidding price
+                                                                [number] [default: -1]
+        --cloud-startup-script      Run the provided Base64-encoded Linux shell script
+                                    during the instance initialization        [string]
+        --cloud-aws-security-group  Specifies the security group in AWS
+                                                                [string] [default: \\"\\"]"
+    `);
   });
 });