GithubHelp home page GithubHelp logo

uffizzicloud / uffizzi_cli Goto Github PK

View Code? Open in Web Editor NEW
87.0 26.0 46.0 25.11 MB

The command-line interface for the Uffizzi API

License: Apache License 2.0

Dockerfile 0.24% Ruby 98.42% Shell 0.72% Makefile 0.61%

uffizzi_cli's Introduction

uffizzi_cli's People

Contributors

7r41n33 avatar antlu avatar axisofentropy avatar gadkins avatar greenfrontend avatar jessikacastellano avatar jpthurman avatar krasnobay avatar moklidia avatar sergeykirillovdb avatar the38th avatar thetadev1 avatar zipofar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uffizzi_cli's Issues

BUG: CLI preview events returns divided by 0 #46

  1. Create preview from compose file
File: Click to expand
services:
  webhook:
    image: uffizzitest/webhooks-test-app:latest
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      TEST: test1


x-uffizzi-ingress:
  service: webhook
  port: 80

x-uffizzi-continuous-preview:
  share_to_github: true
  delete_preview_after: 99h
  tag_pattern: uffizzi_request_*
  delete_preview_when_image_tag_is_updated: true
  deploy_preview_when_image_tag_is_created: true
  delete_preview_when_pull_request_is_closed: true
  deploy_preview_when_pull_request_is_opened: true

  1. Run uffizzi preview events DEPLOYMENT-ID

Result: Error divided by 0

Error: Click to expand
~ # uffizzi preview events deployment-7
/usr/local/bundle/gems/thor-1.2.1/lib/thor/shell/basic.rb:168:in `%': divided by 0 (ZeroDivisionError)
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/shell/basic.rb:168:in `block in print_in_columns'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/shell/basic.rb:166:in `each'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/shell/basic.rb:166:in `each_with_index'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/shell/basic.rb:166:in `print_in_columns'
	from /usr/local/bundle/gems/uffizzi-cli-0.3.8/lib/uffizzi/shell.rb:21:in `print_in_columns'
	from /usr/local/bundle/gems/uffizzi-cli-0.3.8/lib/uffizzi/cli/preview.rb:116:in `handle_succeed_events_response'
	from /usr/local/bundle/gems/uffizzi-cli-0.3.8/lib/uffizzi/cli/preview.rb:109:in `handle_events_command'
	from /usr/local/bundle/gems/uffizzi-cli-0.3.8/lib/uffizzi/cli/preview.rb:76:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.3.8/lib/uffizzi/cli/preview.rb:55:in `events'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.3.8/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'

Events for preview was returned by API /api/cli/v1/projects/{project_slug}/deployments/{deployment_id}/events

From API: Click to expand ![image](/uploads/e6718937f60e179efcb02ffda41935a0/image.png)
{
    "events": [
        {
            "first_timestamp": null,
            "last_timestamp": null,
            "reason": "Scheduled",
            "message": "Successfully assigned deployment-7/app-deployment-7-6fcf7dd489-jscj5 to gke-uffizzi-client-sandbox-510ebd16-vmes"
        },
        {
            "first_timestamp": "2022-03-29T14:44:04Z",
            "last_timestamp": "2022-03-29T14:44:04Z",
            "reason": "Pulling",
            "message": "Pulling image \"uffizzitest/webhooks-test-app:latest\""
        },
        {
            "first_timestamp": "2022-03-29T14:44:05Z",
            "last_timestamp": "2022-03-29T14:44:05Z",
            "reason": "Pulled",
            "message": "Successfully pulled image \"uffizzitest/webhooks-test-app:latest\" in 455.548757ms"
        },
        {
            "first_timestamp": "2022-03-29T14:44:05Z",
            "last_timestamp": "2022-03-29T14:44:05Z",
            "reason": "Created",
            "message": "Created container a74ced40d3"
        },
        {
            "first_timestamp": "2022-03-29T14:44:06Z",
            "last_timestamp": "2022-03-29T14:44:06Z",
            "reason": "Started",
            "message": "Started container a74ced40d3"
        },
        {
            "first_timestamp": null,
            "last_timestamp": null,
            "reason": "Scheduled",
            "message": "Successfully assigned deployment-7/cm-acme-http-solver-mbkx2 to gke-uffizzi-client-default-pool-34f79102-s0ri"
        },
        {
            "first_timestamp": "2022-03-29T14:43:53Z",
            "last_timestamp": "2022-03-29T14:43:53Z",
            "reason": "Pulled",
            "message": "Container image \"quay.io/jetstack/cert-manager-acmesolver:v1.6.1\" already present on machine"
        },
        {
            "first_timestamp": "2022-03-29T14:43:54Z",
            "last_timestamp": "2022-03-29T14:43:54Z",
            "reason": "Created",
            "message": "Created container acmesolver"
        },
        {
            "first_timestamp": "2022-03-29T14:43:54Z",
            "last_timestamp": "2022-03-29T14:43:54Z",
            "reason": "Started",
            "message": "Started container acmesolver"
        },
        {
            "first_timestamp": "2022-03-29T14:44:13Z",
            "last_timestamp": "2022-03-29T14:44:13Z",
            "reason": "Killing",
            "message": "Stopping container acmesolver"
        }
    ]
}

Process interruption for uffizzi preview update

  • Create preview by the command bundle exec uffizzi preview create -o=json test-compose/uffizzi-compose-webhook-docker.yml
  • Update preview by the command bundle exec uffizzi preview update deployment-14 test-compose/uffizzi-compose-webhook-docker-feature.yml
  • Interrupt uffizzi preview update command

Result:

  • Message The command was interrupted
  • Preview was updated from new compose file

Actual result:

  • Updating was interrupted.
  • Preview was still deployed from the old file.
  • Message, that updating was interrupted.

Originally posted by @NealArw in #62 (comment)

Change uffizzi connect to update existing credentials

From Adam:

What's the behavior of uffizzi connect if you specify environment variables but there are already credentials on the account? How does that behavior change with the --skip-raise-existence-error flag? I see this option demonstrated within the entrypoint script (good) but I do not see it documented anywhere.

Is there a way to change existing credentials without doing uffizzi disconnect? For execution in CD pipelines, we need a way to do this. With a flag is fine; I think overwriting as the default behavior is probably fine too?

[CLI] Hide the number of characters in the secrets

  1. Create deployment from compose file with secrets
  2. Run uffizzi preview describe deployment-[ID]

Result:

  1. In a result of running the command value of the secret was changed by *
  2. Number of characters in secret value = number of *

Expected result:
The number of * always is 6 ******. Like in UI version.

image

CLI Login Improve Example

Tell us about your request
A clear and concise description of what you want to happen or the change you would like to see

Which service(s) is this request for?
Let us know which product(s) you want this for - Open Source or Cloud solution or both?

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Are you currently working around the issue?
A clear and concise description of any alternative solutions or features you've considered or are using today.

Additional context
Add any other context or screenshots about the feature request here.

Anchors are not parsed via CLI

An example compose file:

services:
  hello-world:
    image: nginx
    env: &base
      DATABASE_USER: postgres
      DATABASE_PASSWORD: postgres
  redis:
    image: redis
    env: *base

x-uffizzi-ingress:
  service: hello-world
  port: 80

Result: Psych::BadAlias: Unknown alias: base

BUG: CLI Invalid port

  1. Create compose with invalid port (<1 or >65535)
  2. Try to add this compose or create deployment

Result: Error: Invalid port specification '%{value}'

Expected result: Port should be specified between 1 - 65535

Issue was fixed for UI application in gitlab task #1498

File example:

services:
  webhooks-test-app:
    image: uffizzitest/webhooks-test-app:uffizzi_request_feature_1
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres

x-uffizzi-ingress:
  service: webhooks-test-app
  port: 80000000

x-uffizzi-continuous-preview:
  share_to_github: true
  delete_preview_after: 99h
  tag_pattern: uffizzi_request_*
  delete_preview_when_image_tag_is_updated: true
  deploy_preview_when_image_tag_is_created: true
  delete_preview_when_pull_request_is_closed: true

BUG: CLI uffizzi connect ghcr returns an error

  1. uffizzi connect ghcr returns an error
Click to expand
bash-5.1# bundle exec uffizzi connect ghcr
Github Username:  NealArw
Access Token:
bundler: failed to load command: uffizzi (/bundle_cache/ruby/3.0.0/bin/uffizzi)
/usr/local/lib/ruby/3.0.0/net/http.rb:987:in `initialize': Failed to open TCP connection to :80 (Address not available - connect(2) for nil port 80) (Errno::EADDRNOTAVAIL)
	from /usr/local/lib/ruby/3.0.0/net/http.rb:987:in `open'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:987:in `block in connect'
	from /usr/local/lib/ruby/3.0.0/timeout.rb:97:in `block in timeout'
	from /usr/local/lib/ruby/3.0.0/timeout.rb:107:in `timeout'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:985:in `connect'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:970:in `do_start'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:959:in `start'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:621:in `start'
	from /gem/lib/uffizzi/clients/api/http_client.rb:39:in `make_request'
	from /gem/lib/uffizzi/clients/api/http_client.rb:22:in `make_post_request'
	from /gem/lib/uffizzi/clients/api/api_client.rb:32:in `create_credential'
	from /gem/lib/uffizzi/cli/connect.rb:139:in `ghcr'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /gem/lib/uffizzi/cli.rb:65:in `dispatch'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /gem/exe/uffizzi:5:in `<top (required)>'
	from /bundle_cache/ruby/3.0.0/bin/uffizzi:25:in `load'
	from /bundle_cache/ruby/3.0.0/bin/uffizzi:25:in `<top (required)>'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:478:in `exec'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:49:in `block in <top (required)>'
	from /usr/local/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:37:in `<top (required)>'
	from /usr/local/bundle/bin/bundle:23:in `load'
	from /usr/local/bundle/bin/bundle:23:in `<main>'
/usr/local/lib/ruby/3.0.0/net/http.rb:987:in `initialize': Address not available - connect(2) for nil port 80 (Errno::EADDRNOTAVAIL)
	from /usr/local/lib/ruby/3.0.0/net/http.rb:987:in `open'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:987:in `block in connect'
	from /usr/local/lib/ruby/3.0.0/timeout.rb:97:in `block in timeout'
	from /usr/local/lib/ruby/3.0.0/timeout.rb:107:in `timeout'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:985:in `connect'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:970:in `do_start'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:959:in `start'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:621:in `start'
	from /gem/lib/uffizzi/clients/api/http_client.rb:39:in `make_request'
	from /gem/lib/uffizzi/clients/api/http_client.rb:22:in `make_post_request'
	from /gem/lib/uffizzi/clients/api/api_client.rb:32:in `create_credential'
	from /gem/lib/uffizzi/cli/connect.rb:139:in `ghcr'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /gem/lib/uffizzi/cli.rb:65:in `dispatch'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /gem/exe/uffizzi:5:in `<top (required)>'
	from /bundle_cache/ruby/3.0.0/bin/uffizzi:25:in `load'
	from /bundle_cache/ruby/3.0.0/bin/uffizzi:25:in `<top (required)>'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:478:in `exec'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:49:in `block in <top (required)>'
	from /usr/local/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:37:in `<top (required)>'
	from /usr/local/bundle/bin/bundle:23:in `load'
	from /usr/local/bundle/bin/bundle:23:in `<main>'
bash-5.1#

Cli improvements

  1. Typo after running uffizzi login
Login to Uffizzi to your previews.

Should say:

Login to Uffizzi to view and manage your previews.  
  1. Improve error message for uffizzi preview service list. Subcommand is service list but usage command shows:
ERROR: "uffizzi service list" was called with no arguments
Usage: "uffizzi service logs [DEPLOYMENT_ID]"  
  1. Unfriendly error message uffizzi preview create docker-compose.uffizzi.yml
    (Note: I didn’t have a config file.)
/usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/services/compose_file_service.rb:25:in `read': No such file or directory @ rb_sysopen - ./vote.conf (Errno::ENOENT)
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/services/compose_file_service.rb:25:in `block in prepare_dependency_files_data'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/services/compose_file_service.rb:24:in `map'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/services/compose_file_service.rb:24:in `prepare_dependency_files_data'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/services/compose_file_service.rb:20:in `prepare_dependencies'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/services/compose_file_service.rb:14:in `parse'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:269:in `prepare_params'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:80:in `handle_create_command'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:59:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:25:in `create'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli.rb:74:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'

  1. Ambiguous error message from uffizzi preview create docker-compose.uffizzi.yml
Compose repository is undefined
  1. I would be helpful to give line numbers here:
~ # uffizzi preview create docker-compose.uffizzi.yml
Service worker has neither an image nor a build context specified. At least one must be provided.
  1. Unfriendly error message for bad credentials:
~ # uffizzi connect docker-hub
Username:  gadkins
Password:  
/usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/response_helper.rb:41:in `print_errors': undefined method `each_key' for nil:NilClass (NoMethodError)
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/response_helper.rb:31:in `handle_failed_response'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/connect.rb:44:in `handle_docker_hub'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/connect.rb:12:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli.rb:58:in `connect'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli.rb:74:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'
  1. This error message should probably be displayed before asking for my credentials.
~ # uffizzi connect docker-hub
Username: gadkins
Password:  
Credential of that type already exist.

The error message should say:

Credentials of type 'docker-hub' already exist for this account. To remove them, run $ uffizzi disconnect docker-hub
  1. There is currently no way to view which credentials uffizzi has. We could add a command to list credentials that uffizzi connect uses:
uffizzi connect list-credentials

`--dry run` flag for `uffizzi preview`

Tell us about your request

Add flag to cli uffizzi preview create --dry-run which makes it possible for the CLI to validate uffizzi compose files before sending them to the server

Which service(s) is this request for?

Both Open Source and Cloud solution

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

Before creating previews on uffizzi check if the docker-compose can be used to preview https://helm.sh/docs/chart_best_practices/custom_resource_definitions/#method-1-let-helm-do-it-for-you

Describe the solution you'd like

Lint and check against a uffizzi server if there is the given docker compose API is completely supported. eg: if restart is not supported by the given server, notify the user during dry run that it isn't supported.

Are you currently working around the issue?

No

uffizzi project set-default

Tell us about your request
Implement support for setting the default project context via $ uffizzi project set-default subcommand.

Which service(s) is this request for?
uffizzi_cli

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
The uffizzi CLI uses a default project context when running commands like preview create. The user can change the project context for a given subcommand with the Uffizzi-wide flag --project. However, the user should also have a simple way to changed the default project context.

Describe the solution you'd like

$ uffizzi project set-default help (also `--help`, `-h`) 

UFFIZZI-PROJECT-SET-DEFAULT()

NAME
    uffizzi-project-set-default - set the default project for the 
    active account

SYNOPSIS
    uffizzi project set-default PROJECT_SLUG [UFFIZZI_WIDE_FLAG ...]

DESCRIPTION
    Sets the default project given with the given project slug. When set, 
    all commands use this project as the default context unless 
    overridden by the --project flag.

    This command can fail for the following reasons:
      - There is no project with the given project slug

    For more information on Uffizzi projects, see:
    https://docs.uffizzi.com/cli

UFFIZZI WIDE FLAGS
    These flags are available to all commands: --project. Run $ uffizzi 
    help for details.

EXAMPLES
    The following sets the default project with project slug 
    example-foo-9suw4 for the active account:

        $ uffizzi project set-default example-foo-9suw4

Example Output

$ uffizzi project set-default example-foo-9suw4
Default project has been updated.

Are you currently working around the issue?
The user must specify the uffizzi-wide flag--project

Additional context
N/A

`uffizzi connect` accept input non-interactively

Tell us about your request

When setting up Uffizzi for the first time, users must connect a Docker Hub account before deploying previews that fetch images from Docker Hub (even public images.) We'd like to provide users with an option to skip this and go straight to using the GitHub Action. I believe we can enable this by enabling our uffizzi connect command to accept input when executed within another script.

Which service(s) is this request for?

open-source CLI

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?

Right now our GitHub Action accepts credentials and logs in before executing uffizzi preview. (It also sets the Project just after logging in.) We want a way to also connect open-source Uffizzi to Docker Hub (and other registries) before executing uffizzi preview. This cannot happen interactively; uffizzi connect will be called from docker-entrypoint.sh.

Describe the solution you'd like

Any way to define the values for the connection without interactively prompting the user. This could be one or more command-line --flags or environment variables or even from files.

This issue's Pull Request should also update docker-entrypoint.sh to read some common environment variables and, if they are defined, execute uffizzi connect with the appropriate options. Some common environment variables used as "secrets" within GitHub Actions:

  • DOCKERHUB_USERNAME
  • DOCKERHUB_PASSWORD
  • ACR_USERNAME
  • ACR_PASSWORD
  • GCLOUD_SERVICE_KEY
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • GITHUB_TOKEN

Are you currently working around the issue?

No. Maybe emulating at TTY could work around this but I don't want to.

Additional context

This is similar to the behavior of uffizzi login implemented in #22

Ambiguous Error When Executing `uffizzi connect ghcr`

I got an undefined method error when executing uffizzi connect ghcr.

To Reproduce

root@b5a799772b08:~# uffizzi login
Login to Uffizzi server.
Server:  https://app.uffizzi.com
Username:  [email protected]
Password:
Login successfull
root@b5a799772b08:~# uffizzi project list
my-application
# uffizzi connect ghcr
Github Username:  axisofentropy
Access Token:
undefined method `registry_url' for nil:NilClass

Of course I'd like this to succeed, but also this error should probably be more helpful. We should better check input to make sure nothing we need is nil.

Possible Race Condition for config file handling

Describe the bug
I think there may be a race condition in the config file handling. When many uffizzi preview create commands are executed simultaneously within a container, sometimes the config file contents get changed to only include the cookie but not the server URL or any other values. I don't know why preview create is writing to the file at all; maybe

To Reproduce

~ # for i in `seq 42`; do echo $i; uffizzi preview create /app/docker-compose.2022-04-11.yml & done

Check contents of ~/.config/uffizzi/config_default.json

Configuration:

$ docker run --interactive --tty --rm --env-file=/home/adam/src/uffizzi_cli/tmp.env -v /home/adam/src/example-voting-app-monorepo:/app --entrypoint=sh uffizzi/cli:latest

BUG: CLI delete secret error

  1. Create secret with command printf "test" | bundle exec uffizzi project secret create TEST_S
  2. Create preview with command uffizzi preview create COMPOSE-FILE.yml
  3. Try to delete secret uffizzi project secret delete TEST_S

image

Fix /api-docs.
In /api/cli/v1/projects/{project_slug}/secrets/{id} should be used {secret_name}({secret_key}?) instead of {id}

Fix help command

We need to change the path to man in uffizzi_cli/lib/uffizzi/cli/common.rb to get worked help command in the cli container. For now, it works only on a local machine within the gem container.

Create preview from compose with ENV variables

  1. Use the attached compose file
  2. Try to create preview from this file with command bundle exec uffizzi preview create uffizzi-compose-webhook-docker-prod-secret.yml

Result: The specified value for port should be an Integer type

File: Click to expand
services:
  webhook:
    image: uffizzitest/webhooks-test-app:latest
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      TEST: test1


x-uffizzi-ingress:
  service: webhook
  port: ${PORT:-8080}

x-uffizzi-continuous-preview:
  share_to_github: true
  delete_preview_after: 99h
  tag_pattern: uffizzi_request_*
  delete_preview_when_image_tag_is_updated: true
  deploy_preview_when_image_tag_is_created: true
  delete_preview_when_pull_request_is_closed: true
  deploy_preview_when_pull_request_is_opened: true

BUG: [CLI] No error for command uffizzi preview running with --option

  1. Create compose file compose.yml with a source from GitHub or a file with errors (e.g. change service to s1ervice or set port = 0)
  2. Run command uffizzi preview create -o=json compose.yml

Result:

  1. There are no errors in the console
  2. Deployment was not started

File example:

s1ervices:
  webhooks-test-app:
    image: uffizzitest/webhooks-test-app:latest
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres

x-uffizzi-ingress:
  service: webhooks-test-app
  port: 80

x-uffizzi-continuous-preview:
  share_to_github: true
  delete_preview_after: 99h
  tag_pattern: uffizzi_request_*
  delete_preview_when_image_tag_is_updated: true
  deploy_preview_when_image_tag_is_created: true
  delete_preview_when_pull_request_is_closed: true
  deploy_preview_when_pull_request_is_opened: true

uffizzi preview update (CLI)

Given a compose file and preview ID, we should update an existing preview URL with a new specification.
Use case: In this scenario, the user wants to keep their existing preview URL, but update their compose with a new image tag, for example.

Documentation for uffizzi preview create help (also --help, -h)

NAME
    uffizzi preview update - update a preview  

SYNOPSIS
    uffizzi preview update [PREVIEW_ID] [COMPOSE_FILE] [UFFIZZI_WIDE_FLAG ...]

DESCRIPTION
    Given a preview ID and new compose file, update a preview. Updating a 
    preview does not change its preview URL. 

    This command can fail for the following reasons: 
        - There is no preview with the given PREVIEW_ID
        - The COMPOSE_FILE specified is invalid

    For more information on Uffizzi previews, see:
    https://docs.uffizzi.com/cli/preview

POSITIONAL ARGUMENTS
    [PREVIEW_ID]
        The ID of the preview that you want to update.

    [COMPOSE_FILE]
        The new compose file you want to preview.

UFFIZZI WIDE FLAGS
    These flags are available to all commands: --project. Run $ uffizzi 
    help for details.

EXAMPLES
    The following command updates a preview with ID deployment-67 using
    compose file docker-compose.alt.yml:

        $ uffizzi preview update deployment-67 docker-compose.alt.yml

Example Output

$ uffizzi preview update deployment-67 docker-compose.alt.yml
Preview with ID deployment-67 was successfully updated.  
Preview URL: https://pr-14.example-app.demo.app.uffizzi.com

uffizzi project create

Tell us about your request
Implement support for creating projects via $ uffizzi project create subcommand.

Which service(s) is this request for?
uffizzi_cli

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
A user or automation (e.g. GitHub Action) should be able to create Uffizzi projects.

Describe the solution you'd like

$ uffizzi project create help (also `--help`, `-h`) 

UFFIZZI-PROJECT-CREATE()

NAME
    uffizzi-projec-create - Creates a new project

SYNOPSIS
    uffizzi project create [--name=NAME] [--slug=SLUG]
         [--description=DESCRIPTION] [UFFIZZI_WIDE_FLAG ...] 

DESCRIPTION
    Create new project.

    This command can fail for the following reasons:  
        - The project --description is too long.
        - The project --name flag is not specified.
        - The project --slug is malformed or used by another project. 

    For more information on the uffizzi project command, see:
    https:/github.com/UffizziCloud/uffizzi_cli

FLAGS
    --description=DESCRIPTION
       Description for the project you want to create. Max of 256 
       characters.

    --name=NAME
       Name for the project you want to create. 

    --slug=SLUG
       A URL-compatible name. Do not include whitespaces or special 
       characters. Project slugs must be globally unique across all 
       Uffizzi projects. 

UFFIZZI WIDE FLAGS
    These flags are available to all commands: --project. Run $ uffizzi 
    help for details.

EXAMPLES
    To create a new project with name My App, project slug my-app, and
    description "My first project", run:

        $ uffizzi project create --name="My App" --slug="my-app" \
          --description="My first project"

Are you currently working around the issue?
The user must use a single default project

Additional context
N/A

Improve error messages in `preview create` command

When uffizzi preview create times out or gives up it gives the following error:

/usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:196:in `block in check_activity_items_state': undefined method `[]' for nil:NilClass (NoMethodError)
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:194:in `each'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:194:in `check_activity_items_state'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:172:in `block in wait_containers_deploying'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:166:in `loop'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:166:in `wait_containers_deploying'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:153:in `print_deployment_progress'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:117:in `handle_succeed_create_response'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:84:in `handle_create_command'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:59:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli/preview.rb:25:in `create'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/lib/uffizzi/cli.rb:74:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.5.0/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'

Misleading message when unable to connect due to DNS lookup failure.

When the CLI cannot connect to a Uffizzi API server, users may receive a misleading error message:

$ docker run --interactive --rm --tty --entrypoint=bash uffizzi/cli
root@881228c80c70:~# uffizzi login
Login to Uffizzi to view and manage your previews.
Server:  https://devopseu.uffizzicloud.com
Username:  [email protected]
Password:  
The command was interrupted

This message should probably tell users that the CLI could not connect. In this case it's a DNS lookup failure. (devopseu.uffizzicloud.com is a CNAME that points to another record that no longer exists.)

BUG: [CLI][Prod] Process interruption within preview creation

If a cli process stops within a preview creation it gives the following stacktrace:

# uffizzi preview create -o=json compose.yml
[✔] Creating containers...
[⠋] Deploying preview...
  [✔] redis
  [✔] postgres
  [⠸] nginx
  [✔] example-voting-app-worker
  [✔] example-voting-app-vote
  [✔] example-voting-app-result
^C/usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:98:in `rescue in handle_create_command': undefined local variable or method `hostname' for #<Uffizzi::Cli::Preview:0x0000556cd0f91d38 @_invocations={Uffizzi::Cli=>["preview"], Uffizzi::Cli::Preview=>["create"]}, @_initializer=[[], ["-o=json", "compose.yml"], {:shell=>#<Thor::Shell::Color:0x0000556cd0f61638 @base=#<Uffizzi::Cli:0x0000556cd0f5afb8 @_invocations={Uffizzi::Cli=>["preview"], Uffizzi::Cli::Preview=>["create"]}, @_initializer=[["create"], ["-o=json", "compose.yml"], {:shell=>#<Thor::Shell::Color:0x0000556cd0f61638 ...>, :current_command=>#<struct Thor::Command name="preview", description="preview", long_description=nil, usage="preview", options={:project=>#<Thor::Option:0x0000556cd12ee260 @check_default_type=nil, @repeatable=false, @name="project", @description=nil, @required=false, @type=:string, @default=nil, @human_name="project", @banner="PROJECT", @enum=nil, @lazy_default=nil, @aliases=[], @hide=nil, @switch_name="--project">}, ancestor_name=nil>}], @options={}, @args=["create", "-o=json", "compose.yml"], @shell=#<Thor::Shell::Color:0x0000556cd0f61638 ...>>, @mute=false, @padding=0, @always_force=false>, :current_command=>#<struct Thor::Command name="create", description="Create a preview", long_description=nil, usage="create [COMPOSE_FILE]", options={:output=>#<Thor::Option:0x0000556cd1314d98 @check_default_type=nil, @repeatable=false, @name="output", @description=nil, @required=false, @type=:string, @default=nil, @human_name="output", @banner="OUTPUT", @enum=["json", "github-action"], @lazy_default=nil, @aliases=["-o"], @hide=nil, @switch_name="--output">}, ancestor_name="preview">, :invocations=>{Uffizzi::Cli=>["preview"], Uffizzi::Cli::Preview=>["create"]}, :invoked_via_subcommand=>true, :class_options=>{}}], @options={"output"=>"json"}, @args=["compose.yml"], @shell=#<Thor::Shell::Color:0x0000556cd0f61638 @base=#<Uffizzi::Cli:0x0000556cd0f5afb8 @_invocations={Uffizzi::Cli=>["preview"], Uffizzi::Cli::Preview=>["create"]}, @_initializer=[["create"], ["-o=json", "compose.yml"], {:shell=>#<Thor::Shell::Color:0x0000556cd0f61638 ...>, :current_command=>#<struct Thor::Command name="preview", description="preview", long_description=nil, usage="preview", options={:project=>#<Thor::Option:0x0000556cd12ee260 @check_default_type=nil, @repeatable=false, @name="project", @description=nil, @required=false, @type=:string, @default=nil, @human_name="project", @banner="PROJECT", @enum=nil, @lazy_default=nil, @aliases=[], @hide=nil, @switch_name="--project">}, ancestor_name=nil>}], @options={}, @args=["create", "-o=json", "compose.yml"], @shell=#<Thor::Shell::Color:0x0000556cd0f61638 ...>>, @mute=false, @padding=0, @always_force=false>, @parent_options={}, @http_client=#<Uffizzi::HttpClient:0x0000556cd111fb78 @auth_cookie="_uffizzi_app_session=7NMCezbaQ2rStbNht1ywE1pJlQOr0b1V%2F4NBQLDmTl3DQWMV7WdTxNz%2FnT4zHH%2FyHpITbnH3Q%2FN8bRxSjLYzHhIO%2B7cPAIgqN5Dh5kTv0EnRziisdmBfxhUnqO1eruW%2FJPfAKgEu8P1Fz2LBIxWDvsMpvj6GDC0p2scAqKZdV4O1Cgpr4h%2BVXxQiJMNZ%2FaVlW%2BmepgTWRGf5RBt7--n8pKRvV4%2FHDpPpB9--5Jm04RLOzcAHwzLWYVdiMQ%3D%3D", @basic_auth_user=nil, @basic_auth_password=nil>> (NameError)
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:85:in `handle_create_command'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:63:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:23:in `create'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli.rb:64:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'
/usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/services/preview_service.rb:70:in `sleep': Interrupt
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/services/preview_service.rb:70:in `block in display_containers_deploying_status'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/services/preview_service.rb:63:in `loop'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/services/preview_service.rb:63:in `display_containers_deploying_status'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/services/preview_service.rb:52:in `create_deployment'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/services/preview_service.rb:26:in `start_deploy_containers'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:92:in `handle_create_command'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:63:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli/preview.rb:23:in `create'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/lib/uffizzi/cli.rb:64:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.7.3/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'

uffizzi config - Create new project that already exists

👉 Point 4 from #75 (comment). FAILED

Create a config file with a project that does not exist
Login
In interactively mode select Create new project
Enter the name that already exists
Continue
Result:

Error Name already exists
User successfully logged in
Expected:

Error Project with name NAME already exists. Please run $ uffizzi config to set it as a default project.

2

BUG: CLI uffizzi preview list does not show previews in disabled state

uffizzi preview list does not show previews in the disabled state. For now, it shows only active deployments:

bash-5.1# bundle exec uffizzi preview list
deployment-1
deployment-2
deployment-3
deployment-8

image

Preview can get disabled state in two cases:

  1. Deployment was deleted
  2. Deployment failed

CLI should show active, building, deploying and failed previews. And should not show deleted previews.

Help for command:

DESCRIPTION
    Lists all previews for a project, including active, building, 
    deploying and failed previews. 

Process interruption for uffizzi preview update

  • Create preview by the command bundle exec uffizzi preview create -o=json test-compose/uffizzi-compose-webhook-docker.yml
  • Update preview by the command bundle exec uffizzi preview update deployment-14 test-compose/uffizzi-compose-webhook-docker-feature.yml
  • Interrupt uffizzi preview update command

Result:

  • Message The command was interrupted
  • Preview was updated from new compose file

Actual result:

  • Updating was interrupted.
  • Preview was still deployed from the old file.
  • Message, that updating was interrupted.

uffizzi project delete

Tell us about your request
Implement support for deleting projects via $ uffizzi project delete subcommand.

Which service(s) is this request for?
uffizzi_cli

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
A user or automation (e.g. GitHub Action) should be able to delete Uffizzi projects.

Describe the solution you'd like

$ uffizzi project delete help (also `--help`, `-h`) 

UFFIZZI-PROJECT-DELETE()

NAME
    uffizzi project delete - delete a project

SYNOPSIS
    uffizzi project delete PROJECT_SLUG [UFFIZZI_WIDE_FLAG ...]

DESCRIPTION
    Deletes a project with the given project slug. 

    This command can fail for the following reasons:
      - There is no project with the given project slug
      - The active account does not have permission to delete the project

    For more information on Uffizzi projects, see:
    https://docs.uffizzi.com/cli

UFFIZZI WIDE FLAGS
    These flags are available to all commands: --project. Run $ uffizzi 
    help for details.

EXAMPLES
    To delete a project with project slug my-app-xc8fw, run:

        $ uffizzi project delete my-app-xc8fw

Are you currently working around the issue?
The user must use a single default project

Additional context
N/A

Process interruption within preview creation

If a cli process stops within a preview creation it gives the following stacktrace:

bash-5.1# bundle exec uffizzi preview create
Preview created with name deployment-31
[✔] Creating containers...
Done
[⠸] Deploying preview...
  [⠙] nginx
  [✔] example-voting-app-vote
  [✔] example-voting-app-result
  [✔] example-voting-app-worker
  [✔] postgres
  [✔] redis
^C/gem/lib/uffizzi/cli/preview.rb:175:in `sleep': Interrupt
	from /gem/lib/uffizzi/cli/preview.rb:175:in `block in wait_containers_deploying'
	from /gem/lib/uffizzi/cli/preview.rb:166:in `loop'
	from /gem/lib/uffizzi/cli/preview.rb:166:in `wait_containers_deploying'
	from /gem/lib/uffizzi/cli/preview.rb:153:in `print_deployment_progress'
	from /gem/lib/uffizzi/cli/preview.rb:117:in `handle_succeed_create_response'
	from /gem/lib/uffizzi/cli/preview.rb:84:in `handle_create_command'
	from /gem/lib/uffizzi/cli/preview.rb:59:in `run'
	from /gem/lib/uffizzi/cli/preview.rb:25:in `create'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:116:in `invoke'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:243:in `block in subcommand'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /gem/lib/uffizzi/cli.rb:69:in `dispatch'
	from /bundle_cache/ruby/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /gem/exe/uffizzi:5:in `<top (required)>'
	from /bundle_cache/ruby/3.0.0/bin/uffizzi:25:in `load'
	from /bundle_cache/ruby/3.0.0/bin/uffizzi:25:in `<top (required)>'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
	from /usr/local/lib/ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:478:in `exec'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/3.0.0/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:49:in `block in <top (required)>'
	from /usr/local/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:37:in `<top (required)>'
	from /usr/local/bundle/bin/bundle:23:in `load'
	from /usr/local/bundle/bin/bundle:23:in `<main>'

Misleading warning messages when logging in for the first time

Describe the bug

When running uffizzi login when a configuration file is not yet written, it outputs warnings about the config file missing, even though it will be written very soon.

To Reproduce

adam@ephemeron:~/src/uffizzi_cli$ docker run --interactive --rm --tty --entrypoint=bash --env-file=/home/adam/src/uffizzi_cli/2022-05.env uffizzi/cli:qa
root@645b583e67b6:~# uffizzi login --username "${UFFIZZI_USER}" --server "${UFFIZZI_SERVER}"
Login to Uffizzi to view and manage your previews.
Configuration file not found: /root/.config/uffizzi/config_default
To configure the uffizzi CLI interactively, run $ uffizzi config
Configuration file not found: /root/.config/uffizzi/config_default
To configure the uffizzi CLI interactively, run $ uffizzi config
Configuration file not found: /root/.config/uffizzi/config_default
To configure the uffizzi CLI interactively, run $ uffizzi config

Expected behavior

root@645b583e67b6:~# uffizzi login --username "${UFFIZZI_USER}" --server "${UFFIZZI_SERVER}"
Login successful as [email protected].

Configuration:

This is on the qa branch today.

`uffizzi preview service logs`

We should implement the ability for the CLI user to retrieve build logs.

uffizzi preview service logs help (also --help, -h)

NAME
    uffizzi preview service logs - show the logs for a container service 
    of a preview

SYNOPSIS
    uffizzi preview service logs LOG_TYPE [PREVIEW_ID] [SERVICE] [UFFIZZI_WIDE_FLAG ...] 

DESCRIPTION
    Shows the logs for a given container service of a given preview.

    This command can fail for the following reasons: 
        - There is no preview with the given PREVIEW_ID
        - There is no service with the name SERVICE

    For more information on service logs, see:
    https://github.com/UffizziCloud/uffizzi_cli

LOG_TYPE
    LOG_TYPE is one of the following:
    
    build
        The build logs of a service.
    
    container
        The container logs of a service.

POSITIONAL ARGUMENTS
    [PREVIEW_ID]
        The ID of the preview that includes the service you want to 
        show logs for.

    [SERVICE]
        The name of the service you want to show logs for.

UFFIZZI WIDE FLAGS
    These flags are available to all commands: --project. Run $ uffizzi 
    help for details.

EXAMPLES
    The following command shows build logs for the service web-app of the 
    preview with ID deployment-14:

        $ uffizzi preview service logs build deployment-14 web-app

    The following command shows container logs for the service postgres-db of 
    the preview with ID deployment-14:

        $ uffizzi preview service logs container deployment-14 postgres-db

Misleading message when unable to connect due to DNS lookup failure. Part 2.

When the CLI cannot connect to a Uffizzi API server, users may receive a misleading error message:

$ docker run --interactive --rm --tty --entrypoint=bash uffizzi/cli
root@881228c80c70:~# uffizzi login
Login to Uffizzi to view and manage your previews.
Server: https://devopseu.uffizzicloud.com
Username: [email protected]
Password:
The command was interrupted
This message should probably tell users that the CLI could not connect. In this case it's a DNS lookup failure. (devopseu.uffizzicloud.com is a CNAME that points to another record that no longer exists.)

Needs to implement this task also for next case:

  1. URL: https://test.com - Valid URL, that can be reached
/usr/local/lib/ruby/3.0.0/net/http.rb:987:in `initialize': execution expired (Net::OpenTimeout)
	from /usr/local/lib/ruby/3.0.0/net/http.rb:987:in `open'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:987:in `block in connect'
	from /usr/local/lib/ruby/3.0.0/timeout.rb:107:in `timeout'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:985:in `connect'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:970:in `do_start'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:959:in `start'
	from /usr/local/lib/ruby/3.0.0/net/http.rb:621:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/lib/uffizzi/clients/api/http_client.rb:38:in `make_request'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/lib/uffizzi/clients/api/http_client.rb:21:in `make_post_request'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/lib/uffizzi/clients/api/api_client.rb:11:in `create_session'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/lib/uffizzi/cli/login.rb:24:in `run'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/lib/uffizzi/cli.rb:24:in `login'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/lib/uffizzi/cli.rb:64:in `dispatch'
	from /usr/local/bundle/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from /usr/local/bundle/gems/uffizzi-cli-0.11.0/exe/uffizzi:5:in `<top (required)>'
	from /usr/local/bundle/bin/uffizzi:25:in `load'
	from /usr/local/bundle/bin/uffizzi:25:in `<main>'

CLI improvements 3/n

from @gadkins:

CLI improvements needed:
1. More user-friendly login error - currently it just says Not Found
2. When uffizzi login is run, replace the current message to STDOUT
Login to Uffizzi to view and manage your previews. 
with something more useful like:
Logging in to Uffizzi server
...
Login successful
or similar
3.  More user-friendly Resource Not Found error - tell me which resource is not found and how to fix it
4.  Add single quotes around the service name to improve readability. E.g.: Service 'worker' has …

uffizzi project describe

Tell us about your request
Implement support for describing project details via $ uffizzi project describe subcommand.

Which service(s) is this request for?
uffizzi_cli

Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
A user or automation (e.g. GitHub Action) should be able to see details about Uffizzi projects, including settings, default compose spec, secret names, preview URLs, metadata (created, name, slug, description, etc).

Describe the solution you'd like

The project describe subcommand should function similarly to preview describe. The default output format should be a JSON object, but the user should be able to specify a pretty print format.

$ uffizzi project describe help (also `--help`, `-h`) 

UFFIZZI-PROJECT-DESCRIBE()

NAME
    uffizzi project describe - show metadata for a project

SYNOPSIS
    uffizzi project describe PROJECT_SLUG [UFFIZZI_WIDE_FLAG ...]

DESCRIPTION
    Shows metadata for a project given a valid project slug. 

    This command can fail for the following reasons:
      - There is no project with the given project slug

    For more information on Uffizzi projects, see:
    https://docs.uffizzi.com/cli

FLAGS
    --output FORMAT
       Output format. FORMAT is one of the following: json, pretty 
       Default is json.

UFFIZZI WIDE FLAGS
    These flags are available to all commands: --project. Run $ uffizzi 
    help for details.

EXAMPLES
    The following command prints metadata in json format for a project with the 
    project slug my-app-xc8fw:

        $ uffizzi project describe my-app-xc8fw

    The following command pretty prints metadata for a project with the project
    slug my-app-xc8fw:

        $ uffizzi project describe my-app-xc8fw --output pretty 

Example Output

  $ uffizzi project describe my-app-xc8fw --output pretty 
  Project name: My App
  Project slug: my-app-xc8fw
  Description: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do 
    eiusmod tempor incididunt
  Created: Tue, 19 Apr 2022 17:38:18 GMT
  Default compose: https://github.com/example/docker-compose.uffizzi.yml
  Previews:
      - deployment-201 (https://my-app-xc8fw.foo-bar.app.uffizzi.com)
      - deployment-202 (https://pr84-my-app-xc8fw.foo-bar.app.uffizzi.com)
      - deployment-203 (https://pr85-my-app-xc8fw.foo-bar.app.uffizzi.com)
  Secrets:
      - DATABASE_USER
      - DATABASE_PASSWORD
  ...

Are you currently working around the issue?
No. There is currently no way to see details about a project.

Additional context
N/A

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.