Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Commit

Permalink
Merge branch 'main' into snyk-upgrade-ea5dd6787231bca9525b165c7951bd7e
Browse files Browse the repository at this point in the history
  • Loading branch information
recharte authored Feb 2, 2024
2 parents c13ef54 + b86cb5a commit 220fa01
Show file tree
Hide file tree
Showing 44 changed files with 2,383 additions and 1,100 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @gen1us2k @recharte @oksana-grishchenko @michal-kralik
* @recharte @oksana-grishchenko @michal-kralik
49 changes: 44 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Set up Go release
if: matrix.go-version != 'tip'
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -65,15 +65,15 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
- name: Enable Go build cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
Expand All @@ -87,6 +87,45 @@ jobs:
- name: Install tools
run: make init

- name: Check the latest operator version is used
run: |
go get github.com/percona/everest-operator@main
echo "Checking there is no source code changes"
go mod tidy
git diff --exit-code
- name: Check the latest BE version is used
run: |
go get github.com/percona/percona-everest-backend@main
echo "Checking there is no source code changes"
go mod tidy
git diff --exit-code
- name: Check the Makefile references dev version
run: |
if ! grep -q "RELEASE_VERSION ?= v0.0.0" Makefile; then
echo "default RELEASE_VERSION in Makefile should be 0.0.0"
exit 1
fi
- name: Check the pkg/version/version.go references the dev manifest and catalog
run: |
if ! grep -q 'devCatalogImage = "docker.io/perconalab/everest-catalog:latest"' pkg/version/version.go; then
echo "default CLI release in install.sh should be latest"
exit 1
fi
if ! grep -q 'devManifestURL = "https://raw.githubusercontent.com/percona/percona-everest-backend/main' pkg/version/version.go; then
echo "default BE manifest in install.sh should be taken from main"
exit 1
fi
- name: Check the install.sh references the latest cli release
run: |
if ! grep -q "curl -sL https://github.com/percona/percona-everest-cli/releases/download/latest" install.sh; then
echo "default CLI release in install.sh should be latest"
exit 1
fi
- name: Run linters
uses: reviewdog/action-golangci-lint@v2
with:
Expand Down Expand Up @@ -137,7 +176,7 @@ jobs:

- name: Set up Go release
if: env.GO_VERSION != 'tip'
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

Expand All @@ -152,7 +191,7 @@ jobs:
echo "$GOBIN" >> $GITHUB_PATH
- name: Enable Go modules cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-modules-${{ hashFiles('**/go.sum') }}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FILES = $(shell find . -type f -name '*.go')

RELEASE_VERSION ?= $(shell git describe --always --dirty | cut -b2-)
RELEASE_VERSION ?= v0.0.0-$(shell git rev-parse --short HEAD)
RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD)

LD_FLAGS = -ldflags " \
Expand Down
1 change: 0 additions & 1 deletion cli-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ init: ## Install dependencies
install-operators: ## Install operators to k8s
../bin/everest install \
--skip-wizard \
--monitoring.enable=0

test-cli: ## Run all tests
npx playwright test --project=cli
Expand Down
34 changes: 26 additions & 8 deletions cli-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions cli-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"author": "",
"license": "ISC",
"dependencies": {
"@faker-js/faker": "^8.0.2",
"@faker-js/faker": "^8.2.0",
"@playwright/test": "^1.39.0",
"playwright": "^1.35.1",
"playwright": "^1.39.0",
"semver": "^7.5.4",
"shelljs": "^0.8.5"
},
Expand Down
33 changes: 29 additions & 4 deletions cli-tests/tests/flow/all-operators.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test.describe('Everest CLI install', async () => {

await test.step('run everest install command', async () => {
const out = await cli.everestExecSkipWizard(
`install --monitoring.enable=0 --name=${clusterName} --namespace=percona-everest-all`,
`install --name=${clusterName} --namespace=percona-everest-all`,
);

await out.assertSuccess();
Expand All @@ -50,7 +50,6 @@ test.describe('Everest CLI install', async () => {
'percona-server-mongodb-operator operator has been installed',
'percona-postgresql-operator operator has been installed',
'everest-operator operator has been installed',
'Your new password is',
]);
});

Expand All @@ -65,6 +64,9 @@ test.describe('Everest CLI install', async () => {
await out.outContains(
'name: DISABLE_TELEMETRY\n value: "false"',
);
out = await cli.exec(`kubectl patch service everest --patch '{"spec": {"type": "LoadBalancer"}}' --namespace=percona-everest-all`)

await out.assertSuccess();

out = await cli.everestExecSkipWizardWithEnv('upgrade --namespace=percona-everest-all', 'DISABLE_TELEMETRY=true');
await out.assertSuccess();
Expand All @@ -78,22 +80,33 @@ test.describe('Everest CLI install', async () => {
await out.outContains(
'name: DISABLE_TELEMETRY\n value: "true"',
);
// check that the spec.type is not overrided
out = await cli.exec('kubectl get service/everest --namespace=percona-everest-all -o yaml');
await out.outContains(
'type: LoadBalancer',
);
});
await test.step('run everest install command using a different namespace', async () => {
const install = await cli.everestExecSkipWizard(
`install --monitoring.enable=0 --namespace=different-everest`,
`install --namespace=different-everest`,
);

await install.assertSuccess();

const out = await cli.exec('kubectl get clusterrolebinding everest-admin-cluster-role-binding -o yaml');
let out = await cli.exec('kubectl get clusterrolebinding everest-admin-cluster-role-binding -o yaml');
await out.assertSuccess();

await out.outContainsNormalizedMany([
'namespace: percona-everest-all',
'namespace: different-everest',
]);
await cli.everestExec('uninstall --namespace=different-everest --assume-yes');
// Check that uninstall will fail because there's no everest deployment
out = await cli.everestExec('uninstall --namespace=different-everest --assume-yes');
await out.outErrContainsNormalizedMany([
'no Everest deployment in different-everest namespace',
]);

});

await test.step('uninstall Everest', async () => {
Expand All @@ -110,5 +123,17 @@ test.describe('Everest CLI install', async () => {
]);

});

await test.step('uninstall Everest non existent namespace', async () => {
let out = await cli.everestExec(
`uninstall --namespace=not-exist --assume-yes`,
);

await out.outErrContainsNormalizedMany([
'namespace not-exist is not found',
]);

});

});
});
2 changes: 1 addition & 1 deletion cli-tests/tests/flow/mongodb-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test.describe('Everest CLI install', async () => {

await test.step('run everest install command', async () => {
const out = await cli.everestExecSkipWizard(
`install --operator.mongodb=true --operator.postgresql=false --operator.xtradb-cluster=false --monitoring.enable=0 --name=${clusterName}`,
`install --operator.mongodb=true --operator.postgresql=false --operator.xtradb-cluster=false --name=${clusterName}`,
);

await out.assertSuccess();
Expand Down
4 changes: 2 additions & 2 deletions cli-tests/tests/flow/pg-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test.describe('Everest CLI install', async () => {

await test.step('run everest install command', async () => {
const out = await cli.everestExecSkipWizard(
`install --operator.mongodb=false --operator.postgresql=true --operator.xtradb-cluster=false --monitoring.enable=0 --name=${clusterName}`,
`install --operator.mongodb=false --operator.postgresql=true --operator.xtradb-cluster=false --name=${clusterName}`,
);

await out.assertSuccess();
Expand All @@ -63,7 +63,7 @@ test.describe('Everest CLI install', async () => {
await operator.assertSuccess();

const out = await cli.everestExecSkipWizard(
`install --operator.mongodb=false --operator.postgresql=true --operator.xtradb-cluster=true --monitoring.enable=0 --name=${clusterName}`,
`install --operator.mongodb=false --operator.postgresql=true --operator.xtradb-cluster=true --name=${clusterName}`,
);
const restartedOperator = await cli.exec(`kubectl -n percona-everest get po | grep everest|awk {'print $1'}`);
await restartedOperator.assertSuccess();
Expand Down
3 changes: 1 addition & 2 deletions cli-tests/tests/flow/pxc-operator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ test.describe('Everest CLI install', async () => {

await test.step('run everest install command', async () => {
const out = await cli.everestExecSkipWizard(
`install --operator.mongodb=false --operator.postgresql=false --operator.xtradb-cluster=true --monitoring.enable=0 --name=${clusterName}`,
`install --operator.mongodb=false --operator.postgresql=false --operator.xtradb-cluster=true --name=${clusterName}`,
);

await out.assertSuccess();
await out.outErrContainsNormalizedMany([
'percona-xtradb-cluster-operator operator has been installed',
'everest-operator operator has been installed',
'Everest has been installed. Configuring connection',
]);
});

Expand Down
9 changes: 5 additions & 4 deletions cli-tests/tests/version.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ import { test } from '@fixtures';
test.describe('Everest CLI "version" validation', async () => {
test('version validation', async ({ cli }) => {
const out = await cli.everestExecSilent('version');
const version = await cli.exec('git describe --always --dirty|cut -b2-');
await version.assertSuccess();
const hash = await cli.exec('git rev-parse --short HEAD');

await hash.assertSuccess();
const version = `v0.0.0-${hash.getStdOutLines()[0]}`;

await out.assertSuccess();
await out.outContainsNormalizedMany([
'ProjectName: everestctl',
'Version: ' + version.getStdOutLines()[0],
`Version: ${version}`,
]);
});

});
3 changes: 1 addition & 2 deletions commands/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ func newDeleteCmd(l *zap.SugaredLogger) *cobra.Command {
Use: "delete",
}

// cmd.AddCommand(delete.NewMySQLCmd(l))
cmd.AddCommand(delete.NewClusterCmd(l))
cmd.AddCommand(delete.NewMySQLCmd(l))

return cmd
}
Loading

0 comments on commit 220fa01

Please sign in to comment.