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

EVEREST-1815 Replase AlecAivazis/survey lib with charmbracelet/bubbletea #1062

Merged
merged 34 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
bdbd761
EVEREST-1815 Replase AlecAivazis/survey lib with charmbracelet/bubbletea
maxkondr Jan 27, 2025
ea750fb
EVEREST-1815 Adjust styles
maxkondr Jan 28, 2025
3fe72d1
Merge branch 'main' into EVEREST-1815-bubbletea
maxkondr Jan 28, 2025
34eec50
EVEREST-1815 Test
maxkondr Jan 28, 2025
8f5273d
EVEREST-1815 Logger test
maxkondr Jan 28, 2025
895c9bf
EVEREST-1815 Logger test
maxkondr Jan 28, 2025
551093e
TEST
maxkondr Jan 28, 2025
b94b2fc
TEST 2
maxkondr Jan 28, 2025
a6acfcd
Fix Helm config
maxkondr Jan 28, 2025
022baab
EVEREST-1815 Fix running actions in case of tty absence
maxkondr Jan 28, 2025
b865742
Fix go.mod
maxkondr Jan 28, 2025
2201a81
Fix tests
maxkondr Jan 28, 2025
f85b051
Fix tests
maxkondr Jan 28, 2025
1c2a836
Fix tests
maxkondr Jan 28, 2025
9f22859
Fix password validation regexp
maxkondr Jan 28, 2025
1f49859
Fix password validation regexp
maxkondr Jan 28, 2025
9b8fc18
Add tmate to minikube
maxkondr Jan 29, 2025
7d1953a
Adjust docker daemon config for GH workflowswq
maxkondr Jan 29, 2025
cef9926
Adjust docker daemon config for GH workflowswq
maxkondr Jan 29, 2025
da13667
Adjust docker daemon config for GH workflowswq
maxkondr Jan 29, 2025
f9e9ad4
Adjust docker config for FE GH e2e workflow
maxkondr Jan 29, 2025
8d27479
Fix comments for account CLI commands
maxkondr Jan 30, 2025
0c5f85c
Fix comments
maxkondr Jan 30, 2025
e66f6fc
Fix formatting
maxkondr Jan 30, 2025
e7cfb6e
Merge branch 'main' into EVEREST-1815-bubbletea
percona-robot Jan 31, 2025
aa0d962
Merge branch 'main' into EVEREST-1815-bubbletea
maxkondr Feb 3, 2025
1d6f5ab
Replace Unicode digits in post-install message
maxkondr Feb 3, 2025
4b9c653
Merge branch 'main' into EVEREST-1815-bubbletea
percona-robot Feb 3, 2025
8faac1d
Add mark for current cursor position
maxkondr Feb 4, 2025
090329e
Merge branch 'main' into EVEREST-1815-bubbletea
percona-robot Feb 4, 2025
e611c38
Merge branch 'main' into EVEREST-1815-bubbletea
maxkondr Feb 6, 2025
3939fbc
Update configure.go
maxkondr Feb 6, 2025
9642994
Merge branch 'main' into EVEREST-1815-bubbletea
percona-robot Feb 7, 2025
03e3c44
Update go.mod
maxkondr Feb 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/workflows/dev-be-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ jobs:
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go-version }}-build-

# Switch docker data directory to /mnt to have more space for the local Kubernetes cluster
- name: Switch docker-daemon data directory to /mnt
run: |
sudo systemctl stop docker
echo '{ "exec-opts": ["native.cgroupdriver=cgroupfs"], "cgroup-parent": "/actions_job", "data-root": "/mnt/docker-data" }' | sudo tee /etc/docker/daemon.json
sudo mkdir /mnt/docker-data
sudo systemctl start docker

- name: Start local Kubernetes cluster with the local registry
uses: medyagh/setup-minikube@latest
id: minikube
Expand All @@ -262,6 +270,11 @@ jobs:
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build-debug

- name: Build Everest CLI
shell: bash
run: |
make build-cli

- name: Build Everest docker container
uses: docker/metadata-action@v5
id: meta
Expand Down Expand Up @@ -319,8 +332,8 @@ jobs:
- name: Provision Everest using CLI
shell: bash
run: |
make build-cli
./bin/everestctl install -v \
--disable-telemetry \
--version 0.0.0 \
--version-metadata-url https://check-dev.percona.com \
--operator.mongodb \
Expand All @@ -346,10 +359,14 @@ jobs:
kubectl patch configmap everest-rbac -n everest-system --patch "$(kubectl get configmap everest-rbac -n everest-system -o json | jq '.data["policy.csv"] += "\ng, everest_ci, role:admin"' | jq '{data: { "policy.csv": .data["policy.csv"] } }')"
kubectl get configmap everest-rbac -n everest-system -ojsonpath='{.data.policy\.csv}'

- name: Run integration tests
- name: Init integration tests
run: |
cd api-tests
make init

- name: Run integration tests
run: |
cd api-tests
make test

- name: Run debug commands on failure
Expand All @@ -360,9 +377,6 @@ jobs:
kubectl -n everest describe pods
kubectl -n everest-system logs deploy/everest-server




integration_tests_cli:
name: CLI Integration Tests
strategy:
Expand Down Expand Up @@ -418,9 +432,9 @@ jobs:
uses: helm/[email protected]

- name: Run integration tests
working-directory: cli-tests
id: cli-tests
run: |
cd cli-tests
make init
make install-operators
make test-cli
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/dev-fe-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: [1.23.x]
may-fail: [false]
go-version: [ 1.23.x ]
may-fail: [ false ]
runs-on: ubuntu-latest
steps:
# Setup Go
Expand Down Expand Up @@ -139,6 +139,7 @@ jobs:
shell: bash
run: |
./bin/everestctl install -v \
--disable-telemetry \
oksana-grishchenko marked this conversation as resolved.
Show resolved Hide resolved
--version 0.0.0 \
--version-metadata-url https://check-dev.percona.com \
--skip-wizard \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ run-debug: build-debug ## Run binary
bin/everest

run-cli-install: build-cli
bin/everestctl install --skip-wizard --namespaces=everest
bin/everestctl install --disable-telemetry --skip-wizard --namespaces=everest

cert: ## Install dev TLS certificates
mkcert -install
Expand Down
1 change: 1 addition & 0 deletions cli-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ init: ## Install dependencies

install-operators: ## Install operators to k8s
../bin/everestctl install -v \
--disable-telemetry \
--version 0.0.0 \
--version-metadata-url https://check-dev.percona.com \
--namespaces percona-everest-operators \
Expand Down
4 changes: 2 additions & 2 deletions cli-tests/helpers/cliHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ export class CliHelper {
async everestExecSkipWizard(command: string) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return test.step(`Run "${command}" command with --skip-wizard`, async () => {
return this.execute(`${this.pathToBinary} ${command} --skip-wizard --version 0.0.0 --version-metadata-url https://check-dev.percona.com`);
return this.execute(`${this.pathToBinary} ${command} --disable-telemetry --skip-wizard --version 0.0.0 --version-metadata-url https://check-dev.percona.com`);
});
}

async everestExecSkipWizardWithEnv(command, env: string) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return test.step(`Run "${command}" command with env variables`, async () => {
return this.execute(`${env} ${this.pathToBinary} ${command} --skip-wizard --version 0.0.0 --version-metadata-url https://check-dev.percona.com`);
return this.execute(`${env} ${this.pathToBinary} ${command} --disable-telemetry --skip-wizard --version 0.0.0 --version-metadata-url https://check-dev.percona.com`);
});
}

Expand Down
14 changes: 7 additions & 7 deletions cli-tests/tests/flow/all-operators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ test.describe('Everest CLI install', async () => {

await out.assertSuccess();
await out.outContainsNormalizedMany([
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespaces (everest-all)',
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespace \'everest-all\'',
'Thank you for installing Everest',
]);
});
Expand Down
14 changes: 7 additions & 7 deletions cli-tests/tests/flow/mongodb-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ test.describe('Everest CLI install', async () => {

await out.assertSuccess();
await out.outContainsNormalizedMany([
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespaces (everest-operators)',
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespace \'everest-operators\'',
'Thank you for installing Everest',
]);
});
Expand Down
38 changes: 19 additions & 19 deletions cli-tests/tests/flow/namespaces.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ test.describe('Everest CLI install', async () => {

await out.assertSuccess();
await out.outContainsNormalizedMany([
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
'Thank you for installing Everest',
]);
});
Expand All @@ -65,7 +65,7 @@ test.describe('Everest CLI install', async () => {
`install`,
);
await out.outErrContainsNormalizedMany([
'× everest is already installed',
' everest is already installed',
]);
});
await page.waitForTimeout(10_000);
Expand All @@ -77,7 +77,7 @@ test.describe('Everest CLI install', async () => {
);
await out.assertSuccess();
await out.outContainsNormalizedMany([
'✓ Installing namespace \'everest\'',
'✅ Provisioning database namespace \'everest\'',
]);
});
await page.waitForTimeout(10_000);
Expand All @@ -89,7 +89,7 @@ test.describe('Everest CLI install', async () => {
`add everest --operator.mongodb=false --operator.postgresql=false --operator.xtradb-cluster=true`,
);
await out.outErrContainsNormalizedMany([
'× invalid namespace (everest): namespace already exists. HINT: set \'--take-ownership\' flag to use existing namespaces',
'❌ \'everest\': namespace already exists and is managed by Everest',
]);
});
await page.waitForTimeout(10_000);
Expand All @@ -102,7 +102,7 @@ test.describe('Everest CLI install', async () => {
);
await out.assertSuccess();
await out.outContainsNormalizedMany([
' Updating namespace \'everest\'',
' Updating database namespace \'everest\'',
]);
});
await page.waitForTimeout(10_000);
Expand All @@ -119,10 +119,10 @@ test.describe('Everest CLI install', async () => {
);
await out.assertSuccess();
await out.outContainsNormalizedMany([
' Deleting database clusters in namespace \'everest\'',
' Deleting backup storages in namespace \'everest\'',
' Deleting monitoring instances in namespace \'everest\'',
' Deleting namespace \'everest\'',
' Deleting database clusters in namespace \'everest\'',
' Deleting backup storages in namespace \'everest\'',
' Deleting monitoring instances in namespace \'everest\'',
' Deleting database namespace \'everest\'',
]);

out = await cli.exec(`kubectl get namespace everest`);
Expand All @@ -142,7 +142,7 @@ test.describe('Everest CLI install', async () => {
);
await out.assertSuccess();
await out.outContainsNormalizedMany([
'✓ Installing namespace \'existing-ns\'',
'✅ Provisioning database namespace \'existing-ns\'',
]);
});
await page.waitForTimeout(10_000);
Expand All @@ -154,10 +154,10 @@ test.describe('Everest CLI install', async () => {
);
await out.assertSuccess();
await out.outContainsNormalizedMany([
' Deleting database clusters in namespace \'existing-ns\'',
' Deleting backup storages in namespace \'existing-ns\'',
' Deleting monitoring instances in namespace \'existing-ns\'',
' Deleting resources from namespace \'existing-ns\'',
' Deleting database clusters in namespace \'existing-ns\'',
' Deleting backup storages in namespace \'existing-ns\'',
' Deleting monitoring instances in namespace \'existing-ns\'',
' Deleting resources from namespace \'existing-ns\'',
]);

out = await cli.exec(`kubectl get namespace existing-ns`);
Expand Down
14 changes: 7 additions & 7 deletions cli-tests/tests/flow/pg-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ test.describe('Everest CLI install', async () => {

await out.assertSuccess();
await out.outContainsNormalizedMany([
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespaces (everest-operators)',
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespace \'everest-operators\'',
'Thank you for installing Everest',
]);
});
Expand Down
14 changes: 7 additions & 7 deletions cli-tests/tests/flow/pxc-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ test.describe('Everest CLI install', async () => {

await out.assertSuccess();
await out.outContainsNormalizedMany([
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespaces (everest-operators)',
' Installing Everest Helm chart',
' Ensuring Everest API deployment is ready',
' Ensuring Everest operator deployment is ready',
' Ensuring OLM components are ready',
' Ensuring Everest CatalogSource is ready',
' Ensuring monitoring stack is ready',
' Provisioning database namespace \'everest-operators\'',
'Thank you for installing Everest',
]);
});
Expand Down
39 changes: 37 additions & 2 deletions commands/accounts/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
accountscli "github.com/percona/everest/pkg/accounts/cli"
"github.com/percona/everest/pkg/cli"
"github.com/percona/everest/pkg/logger"
"github.com/percona/everest/pkg/output"
)

var (
Expand Down Expand Up @@ -53,17 +54,51 @@ func accountsCreatePreRun(cmd *cobra.Command, _ []string) { //nolint:revive
// Copy global flags to config
accountsCreateCfg.Pretty = !(cmd.Flag(cli.FlagVerbose).Changed || cmd.Flag(cli.FlagJSON).Changed)
accountsCreateCfg.KubeconfigPath = cmd.Flag(cli.FlagKubeconfig).Value.String()

// Check username
if accountsCreateOpts.Username != "" {
// Validate provided username for new account.
if err := accountscli.ValidateUsername(accountsCreateOpts.Username); err != nil {
output.PrintError(err, logger.GetLogger(), accountsCreateCfg.Pretty)
os.Exit(1)
}
} else {
// Ask user in interactive mode to provide username for new account.
if username, err := accountscli.PopulateUsername(cmd.Context()); err != nil {
output.PrintError(err, logger.GetLogger(), accountsCreateCfg.Pretty)
os.Exit(1)
} else {
accountsCreateOpts.Username = username
}
}

// Check password
if accountsCreateOpts.Password != "" {
// Validate provided password for new account.
if err := accountscli.ValidatePassword(accountsCreateOpts.Password); err != nil {
output.PrintError(err, logger.GetLogger(), accountsCreateCfg.Pretty)
os.Exit(1)
}
} else {
// Ask user in interactive mode to provide password for new account.
if password, err := accountscli.PopulatePassword(cmd.Context()); err != nil {
output.PrintError(err, logger.GetLogger(), accountsCreateCfg.Pretty)
os.Exit(1)
} else {
accountsCreateOpts.Password = password
}
}
}

func accountsCreateRun(cmd *cobra.Command, _ []string) { //nolint:revive
cliA, err := accountscli.NewAccounts(*accountsCreateCfg, logger.GetLogger())
if err != nil {
logger.GetLogger().Error(err)
output.PrintError(err, logger.GetLogger(), accountsCreateCfg.Pretty)
os.Exit(1)
}

if err := cliA.Create(cmd.Context(), *accountsCreateOpts); err != nil {
logger.GetLogger().Error(err)
output.PrintError(err, logger.GetLogger(), accountsCreateCfg.Pretty)
os.Exit(1)
}
}
Expand Down
Loading
Loading