Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: UffizziCloud/uffizzi_cli
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.4.5
Choose a base ref
...
head repository: UffizziCloud/uffizzi_cli
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.4.6
Choose a head ref
  • 6 commits
  • 13 files changed
  • 2 contributors

Commits on Feb 19, 2024

  1. [401] added install/uninstall help pages

    lidiamokevnina committed Feb 19, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    dda1121 View commit details
  2. Merge pull request #402 from UffizziCloud/feature/401-add-install-hel…

    …p-page
    
    [401] added install/uninstall help pages
    moklidia authored Feb 19, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5024823 View commit details
  3. [397] added check for controller installation and a dynamic installat…

    …ion message
    lidiamokevnina committed Feb 19, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    7b022c1 View commit details

Commits on Feb 20, 2024

  1. Merge pull request #404 from UffizziCloud/feature/397-add-controller-…

    …host-message-after-login
    
    [397] added check for controller installation and a dynamic installat…
    moklidia authored Feb 20, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    ee34d98 View commit details
  2. Change version to 2.4.6

    lidiamokevnina committed Feb 20, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    413c5e0 View commit details
  3. Merge branch 'develop'

    lidiamokevnina committed Feb 20, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    a090404 View commit details
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -91,5 +91,5 @@ Uffizzi supports a [Homebrew tap package] (https://github.com/UffizziCloud/homeb
4. Copy over the contents of the existing [Formula](https://github.com/UffizziCloud/homebrew-tap/blob/main/Formula/uffizzi.rb) from the master, replacing the sha and the url for the ones from the newly created Formula.
5. Update the `resource "uffizzi-cli"` to the latest gem and add new dependencies if needed.
6. Run `HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source --verbose --debug uffizzi` and manually test the new uffizzi version (make sure that all other homebrew uffizzi versions are uninstalled).
7. Run `brew audit --strict --online` to check if the Formula adheres to the Homebrew style.
7. Run `brew audit --strict --online uffizzi` to check if the Formula adheres to the Homebrew style.
8. If tests and audit pass, create a PR into master in the UffizziCloud/homebrew-tap [repository] (https://github.com/UffizziCloud/homebrew-tap) with the new Formula.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (2.4.5)
uffizzi-cli (2.4.6)
activesupport
awesome_print
faker
2 changes: 1 addition & 1 deletion lib/uffizzi/cli/account.rb
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ def handle_succeed_set_default_response(response)
account = response[:body][:account]
account_id = account[:id]
account_name = account[:name]
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(account_id, account_name))
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(id: account_id, name: account_name))
Uffizzi.ui.say("The account with name '#{account_name}' was set as default.")

projects = account[:projects]
41 changes: 37 additions & 4 deletions lib/uffizzi/cli/login.rb
Original file line number Diff line number Diff line change
@@ -71,6 +71,7 @@ def handle_token_success(response)
Uffizzi.ui.say('Login successful')

set_current_account_and_project
Uffizzi.ui.say(installation_message)
end

def open_browser(url)
@@ -88,7 +89,7 @@ def handle_succeed_response(response, username)

if ENV.fetch('CI_PIPELINE_RUN', false)
account = response[:body][:user][:default_account]
return ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(account[:id]))
return ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(id: account[:id]))
end

set_current_account_and_project
@@ -123,17 +124,17 @@ def set_account
accounts = accounts_response[:body][:accounts]
if accounts.length == 1
current_account = accounts.first
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(current_account[:id], current_account[:name]))
ConfigFile.write_option(:account, account_config(current_account))
return current_account[:id]
end
question = 'Select an account:'
choices = accounts.map do |account|
{ name: account[:name], value: account[:id] }
end
account_id = Uffizzi.prompt.select(question, choices)
account_name = accounts.detect { |account| account[:id] == account_id }[:name]
selected_account = accounts.detect { |account| account[:id] == account_id }

ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(account_id, account_name))
ConfigFile.write_option(:account, account_config(selected_account))

account_id
end
@@ -211,5 +212,37 @@ def handle_create_project_succeess(response)

Uffizzi.ui.say("Project #{project[:name]} was successfully created")
end

def installation_message
account_config = ConfigHelper.read_account_config
if account_config[:has_installation]
"\r\n\r\n"\
'####################################################################' \
"\r\n\r\n"\
"Your CLI is configured to use '#{account_config[:vclusters_controller_url]}'." \
"\r\n\r\n"\
'Run `uffizzi config -h` to see CLI configuration options.'\
"\r\n\r\n"
else
"\r\n\r\n"\
'####################################################################'\
"\r\n\r\n"\
'Your CLI is configured to use https://app.uffizzi.com (Uffizzi Cloud).'\
"\r\n\r\n"\
'Run `uffizzi config -h` to see CLI configuration options.'\
"\r\n"\
'Run `uffizzi install -h` to see self-hosted installation options.'\
"\r\n\r\n"
end
end

def account_config(account_data)
Uffizzi::ConfigHelper.account_config(
id: account_data[:id],
name: account_data[:name],
has_installation: account_data[:has_installation],
vclusters_controller_url: account_data[:vclusters_controller_url],
)
end
end
end
2 changes: 1 addition & 1 deletion lib/uffizzi/cli/login_by_identity_token.rb
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ def prepare_request_params(oidc_token, github_access_token)
def handle_succeed_response(response, server, oidc_token)
ConfigFile.write_option(:server, server)
ConfigFile.write_option(:cookie, response[:headers])
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(response[:body][:account_id]))
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(id: response[:body][:account_id]))
ConfigFile.write_option(:project, response[:body][:project_slug])
ConfigFile.write_option(:oidc_token, oidc_token)

5 changes: 3 additions & 2 deletions lib/uffizzi/cli/project.rb
Original file line number Diff line number Diff line change
@@ -171,10 +171,11 @@ def print_projects(projects)
def set_default_project(project)
ConfigFile.write_option(:project, project[:slug])
account = project[:account]
return ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(account[:id], account[:name])) if account
account_config = Uffizzi::ConfigHelper.account_config(id: account[:id], name: account[:name])
return ConfigFile.write_option(:account, account_config) if account

# For core versions < core_v2.2.3
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(project[:account_id]))
ConfigFile.write_option(:account, Uffizzi::ConfigHelper.account_config(id: project[:account_id]))
end
end
end
8 changes: 6 additions & 2 deletions lib/uffizzi/helpers/config_helper.rb
Original file line number Diff line number Diff line change
@@ -17,8 +17,8 @@ def read_option_from_config(option)
ConfigFile.option_has_value?(option) ? ConfigFile.read_option(option) : nil
end

def account_config(id, name = nil)
{ id: id, name: name }
def account_config(id:, name: nil, has_installation: false, vclusters_controller_url: nil)
{ id: id, name: name, has_installation: has_installation, vclusters_controller_url: vclusters_controller_url }
end

def update_clusters_config_by_id(id, params)
@@ -60,6 +60,10 @@ def dev_environment
read_option_from_config(:dev_environment) || {}
end

def read_account_config
read_option_from_config(:account)
end

private

def clusters
2 changes: 1 addition & 1 deletion lib/uffizzi/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Uffizzi
VERSION = '2.4.5'
VERSION = '2.4.6'
end
73 changes: 38 additions & 35 deletions man/uffizzi-install.ronn
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
$ uffizzi -h
uffizzi - manage Uffizzi resources
$ uffizzi install help
uffizzi-install - install the uffizzi platform
================================================================

## SYNOPSIS
uffizzi GROUP | COMMAND
uffizzi install [HOSTNAME] --email=[EMAIL]

## DESCRIPTION
The uffizzi CLI manages authentication, configuration, and
interaction with Uffizzi APIs.
Install the Uffizzi platform data plane (controller and operator) on a host cluster.

If you want to self-host the Uffizzi platform data and control planes, you should
use Uffizzi Enterprise instead. Contact sales@uffizzi.com to get started.

For more information on the uffizzi CLI, see:
https://docs.uffizzi.com/references/cli/
For more information on the Uffizzi installation process, see:
https://docs.uffizzi.com/install/platform

## GROUP
GROUP is one of the following:
cluster
Manage virtual clusters
## POSITIONAL ARGUMENTS

config
Configure the uffizzi CLI
HOSTNAME
The hostname where your installation will be publicly available. E.g. uffizzi.example.com
The output of the `install` command is an IP address or hostname where your instance
of the Uffizzi controller service is available. Uffizzi expects this service to be publicly
available at the specified HOSTNAME. Before you can create Uffizzi environments
on your installation, be sure to configure your DNS to point HOSTNAME to the IP
or hostname output by this command.

connect
Grant a Uffizzi user account access to external services
EMAIL
A business email, required for letsencrypt certificate authority.

compose
Manage Uffizzi compose environments (previews) and view logs
## FLAGS

dev
Creates a Uffizzi cluster preconfigured for development workflows
--email
A business email required for letsencrypt

install
Install the Uffizzi platform data plane on a host cluster.
--context
The name of the kubeconfig context to use. If no context is specified, your
kubeconfig current context is used.

project
Manage Uffizzi project resources including compose files for
specifying compose environment (preview) configurations and secrets
--namespace
The namespace where Uffizzi platform will be installed. If no namespace is
specified, the 'default' namespace is used.

## COMMAND
COMMAND is one of the following:
--help
Display this help page and exit

help
Show uffizzi documentation
## EXAMPLES

login
Log in to a Uffizzi user account
To install Uffizzi using the current context at hostname 'uffizzi.example.com', run:

logout
Log out of a Uffizzi user account

version
Print version information for uffizzi CLI
$ uffizzi install uffizzi.example.com --email="jdoe@example.com"

To install Uffizzi using context 'foo' and namespace 'bar', run:

$ uffizzi install uffizzi.example.com --email="jdoe@example.com" \
--context='foo' --namespace='bar'
23 changes: 23 additions & 0 deletions man/uffizzi-uninstall.ronn
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$ uffizzi uninstall help
uffizzi-uninstall - uninstall the uffizzi platform
================================================================

## SYNOPSIS
uffizzi uninstall

## DESCRIPTION
Uninstall the Uffizzi platform data plane (controller and operator) from a host cluster.

For more information on the Uffizzi installation process, see:
https://docs.uffizzi.com/install/platform

## FLAGS

--help
Display this help page and exit

## EXAMPLES

To uninstall Uffizzi, run:

$ uffizzi uninstall
11 changes: 9 additions & 2 deletions man/uffizzi.ronn
Original file line number Diff line number Diff line change
@@ -25,12 +25,19 @@ uffizzi - manage Uffizzi resources
compose
Manage Uffizzi compose environments (previews) and view logs

dev
Creates a Uffizzi cluster preconfigured for development workflows

install
Install the Uffizzi platform data plane on a host cluster.

project
Manage Uffizzi project resources including compose files for
specifying compose environment (preview) configurations and secrets

dev
Creates a Uffizzi cluster preconfigured for development workflows
uninstall
Uninstall the Uffizzi platform data plane from a host cluster. Updates CLI
to use Uffizzi Cloud as the default API.

## COMMAND
COMMAND is one of the following:
7 changes: 5 additions & 2 deletions test/fixtures/files/uffizzi/uffizzi_accounts_success.json
Original file line number Diff line number Diff line change
@@ -2,11 +2,14 @@
"accounts": [
{
"id": 1,
"name": "uffizzi"
"name": "uffizzi",
"has_installation": false,
"vclusters_controller_url": "https://controller.uclusters.app.uffizzi.com"
},
{
"id": 2,
"name": "hello-world"
"name": "hello-world",
"vclusters_controller_url": "https://controller.uclusters.app.uffizzi.com"
}
]
}
1 change: 0 additions & 1 deletion test/uffizzi/cli/login_test.rb
Original file line number Diff line number Diff line change
@@ -139,7 +139,6 @@ def test_browser_login_with_new_project_creation_success
assert_requested(stubbed_uffizzi_projects)
assert_requested(stubbed_uffizzi_project)
assert_requested(stubbed_uffizzi_accounts)
assert_match('was successfully created', Uffizzi.ui.last_message)
end

def test_browser_login_with_new_project_creation_when_project_already_exists_and_abort_repeat