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

3 kind dev environment #38

Merged
merged 62 commits into from
Apr 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
f1ad360
adding clusteradm integration
ilan-pinto Apr 6, 2022
abaabb8
chore: validating command exists in async manner
TomerFi Apr 7, 2022
ececa9a
added promise
ilan-pinto Apr 10, 2022
bb15787
chore: replaced verification utility method from cback to promise to …
TomerFi Apr 10, 2022
15aa6a0
added async
ilan-pinto Apr 11, 2022
dbfb54b
added async
ilan-pinto Apr 11, 2022
9d866b3
added async
ilan-pinto Apr 11, 2022
68034f9
added async
ilan-pinto Apr 11, 2022
157e7c6
refactor: refactor of code base
TomerFi Apr 11, 2022
4de105f
test: added unit test cases for the shell utility functions
TomerFi Apr 11, 2022
bafffac
test: added extra layer of suite for clarification
TomerFi Apr 11, 2022
b841049
chore: fixed missing svg
TomerFi Apr 11, 2022
97273b2
test: added tests cases for the environment utilities
TomerFi Apr 11, 2022
8df30f5
fix: fixed the clusteradm version command, pinned to client version
TomerFi Apr 11, 2022
ebd6c11
build local env draft
ilan-pinto Apr 12, 2022
ea03734
fix: replaced info message box with error new project path exists
TomerFi Apr 12, 2022
53b5179
test: added tests cases for the clusteradm version utility function
TomerFi Apr 12, 2022
eeabeb4
refactor: update message display boxes and contents for the create pr…
TomerFi Apr 12, 2022
9cc02a4
test: added test cases comments for documentation
TomerFi Apr 12, 2022
b129d32
test: added code coverage reports
TomerFi Apr 12, 2022
1f2dee9
docs: update the contibuting guidelines
TomerFi Apr 12, 2022
ae166bc
local shell command
ilan-pinto Apr 14, 2022
6985ca8
refactor: refactored the new project command
TomerFi Apr 14, 2022
51524d8
refactor: refactored the verify environment commands
TomerFi Apr 14, 2022
9b9360e
merge
ilan-pinto Apr 14, 2022
c9a8262
merged tomers
ilan-pinto Apr 14, 2022
5f18c9d
test: added filesystem utility functions unit tests
TomerFi Apr 14, 2022
aa10a0c
test: typos in test cases names
TomerFi Apr 14, 2022
ac70c17
test: refactored the integration tests
TomerFi Apr 14, 2022
d375a09
propose: notification button
vbelouso Apr 14, 2022
d663bdb
chore: fixed dynamic url download of missing tools
TomerFi Apr 14, 2022
6eae541
shell.ts
ilan-pinto Apr 14, 2022
695b1cf
test: typo and convinient script
TomerFi Apr 15, 2022
3a52bd6
test: added chai helpers for the integration tests
TomerFi Apr 15, 2022
b08d4c8
refactor env build
ilan-pinto Apr 15, 2022
c9ee549
build local env working version
ilan-pinto Apr 17, 2022
16af9af
added env tests
ilan-pinto Apr 18, 2022
6fe773b
fixed review + added promise all
ilan-pinto Apr 19, 2022
2e4dbfe
added async execution for shell commands
ilan-pinto Apr 19, 2022
1bb657f
chore: fixed vscode launch configuration
TomerFi Apr 19, 2022
af195c5
test: it helpers, switch assertion custom method to chainable method
TomerFi Apr 19, 2022
3890ad3
refactor: refactor the create development environment command
TomerFi Apr 19, 2022
ef2b7ea
docs: update readme and some small log lines/comments
TomerFi Apr 20, 2022
59e532e
chore: fixed the grep command from os switches
TomerFi Apr 20, 2022
d1a593f
style: small style fixes
TomerFi Apr 20, 2022
263c489
test: added unit tests for the build environment utility function
TomerFi Apr 20, 2022
b47e4b0
chore: small refactoring to the large buildEnvironment utility function
TomerFi Apr 20, 2022
f64ac12
refactor: refactored the build environment utility function one again
TomerFi Apr 20, 2022
553ae10
style: style fixes
TomerFi Apr 20, 2022
a96a89b
test: added test cases
TomerFi Apr 20, 2022
6bcc43d
Merge pull request #39 from TomerFi/3-kind-dev-environment-dev
ilan-pinto Apr 21, 2022
de6f1a0
test: added unit tests for the build environment utility functions
TomerFi Apr 21, 2022
e85e77b
test: fix tests failing on windows runner
TomerFi Apr 22, 2022
6db5cdf
test: fixed windows failing tests again
TomerFi Apr 22, 2022
e3a535c
style: lint and style fixes
TomerFi Apr 22, 2022
8fc6542
test: clarify file test assertions
TomerFi Apr 22, 2022
0e77184
test: clarify file test assertions2
TomerFi Apr 22, 2022
b9d8d77
test: added integration tests for the create environment command
TomerFi Apr 24, 2022
64fb530
test: added more integration tests for the create environment command
TomerFi Apr 24, 2022
dea4add
test: added integration tests for the verify tools command
TomerFi Apr 24, 2022
af8b656
chore: removed clusteradm-version command
TomerFi Apr 25, 2022
3ee7e06
ci: fixed vsix names
TomerFi Apr 25, 2022
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
33 changes: 28 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
{
"root": true,
"extends": "eslint:recommended",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/await-thenable": "error",
//"@typescript-eslint/ban-ts-comment": "warn",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-unnecessary-type-constraint": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-as-const": "error",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/restrict-template-expressions": "error",
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/naming-convention": "warn",
"@typescript-eslint/semi": "warn",
"curly": "warn",
"eqeqeq": "warn",
"no-throw-literal": "warn",
"semi": "off"
"no-async-promise-executor": "off",
"no-throw-literal": "warn",
"no-undef":"off",
"no-unused-vars": "off",
"sort-imports":"warn"
},
"ignorePatterns": [
"out",
Expand Down
51 changes: 41 additions & 10 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to oc-vscode-extension

All contributions are welcomed, thank you!
All contributions are welcome, thank you!

## Useful Links

Expand All @@ -20,16 +20,21 @@ All you need is [VSCode][2] and [NodeJS][0].
### Project Layout

- [src][10] contains the source code for the extension.
- [integration-tests][11] contains the sources for integration testing.
- [snippets][12] contains the snippets offered by the extension.
- [templates][13] contains template files for orchestrating new projects.
- [test-workspace][14] used for integration testing, git is keeping it and ignoring its content.
- [tests][11] contains the sources for the unit tests.
- [integration-tests][12] contains the sources for integration tests.
- [snippets][13] contains the snippets offered by the extension.
- [templates][14] contains template files for orchestrating new projects.
- [images][15] contains various images used throughout the project.
- [test-workspace][16] used for integration testing, git is keeping it and ignoring its content.

### NPM Scripts

- `npm install` will install all the required modules for the project.
- `npm run lint` will lint all _typescript_ sources.
- `npm run build` will lint and compile the project.
- `npm run tests` will run the unit tests.
- `npm run tests:cov` will run the unit tests and verify and summarize the code coverage.
- `npm run tests:cov-rep` will run the unit tests and verify the coverage creating an HTML coverage report.
- `npm run build` will lint, compile, test, and verify the code coverage for the project.
- `npm run clean:build` will remove any pre-compiled sources before building.
- `npm run integration-tests` will run the integration tests.
- `npm run clean` will remove the compiled sources
Expand All @@ -38,6 +43,27 @@ All you need is [VSCode][2] and [NodeJS][0].
- `npm run clean:all` will execute the above three clean scripts.
- `npm run vsce:package` will build the VSIX package.

### Coding Guidelines

For maintainability, readability, and testing purposes, as well as for the overall robustness of this project,
we separate the various _vscode_ integrations from their underlying implementations.</br>

For example, at the time of writing this, _vscode_ integrations reside in the [commands package][17] and the
underlying implementations reside in the [utils package][18].</br>
Take the layout of the package with a pinch of salt, but also take the following couple of rules of thumb under
consideration while contributing code:

- The _vscode_ integration part should be as small as possible, and functions should be perceived as wrappers for
the underlying implementations.
- The underlying implementations should be completely decoupled from _vscode_'s API.

In regards to testing,</br>
_vscode_'s integration should be tested within the context of [integration tests][12],</br>
the underlying implementations can, and probably should be tested within the context of [unit tests][11].

As for commits and pull requests, we prefer [conventional commit messages][4], but we do not enforce it yet.
Please be as informative as possible when opening pull requests.

### Launch Configurations

- _Run Extension_ will run the extension in a separate _vscode instance_.
Expand All @@ -48,9 +74,14 @@ All you need is [VSCode][2] and [NodeJS][0].
[1]: https://code.visualstudio.com/api
[2]: https://code.visualstudio.com/
[3]: https://github.com/ilan-pinto/ocm-vscode-extension/releases/tag/early-access
[4]: https://www.conventionalcommits.org/
<!-- CODE LINKS -->
[10]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/src
[11]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/integration-tests
[12]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/snippets
[13]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/templates
[14]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/test-workspace
[11]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/tests
[12]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/integration-tests
[13]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/snippets
[14]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/templates
[15]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/images
[16]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/test-workspace
[17]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/src/commands
[18]: https://github.com/ilan-pinto/ocm-vscode-extension/tree/main/src/utils
9 changes: 7 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ jobs:
path: .vscode-test
key: ${{ runner.os }}-vscode-test-${{ hashFiles('package.json') }}

- name: Run unit tests
run: npm test

- name: Run integration tests linux
if: runner.os == 'Linux'
run: xvfb-run -a npm run integration-tests
Expand All @@ -51,5 +54,7 @@ jobs:
run: npm run integration-tests

- name: Create a VSIX package for target ${{ matrix.target }}
run: |
npm run vsce:package -- --target ${{ matrix.target }}
run: >
npm run vsce:package --
--target ${{ matrix.target }}
--out ocm-vscode-extension-${{ matrix.target }}-dev.vsix
9 changes: 7 additions & 2 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ jobs:
- name: Install project modules
run: npm i

- name: Run unit tests
run: npm test

- name: Create VSIX package
run: |
npm run vsce:package -- --target ${{ matrix.target }}
run: >
npm run vsce:package --
--target ${{ matrix.target }}
--out ocm-vscode-extension-${{ matrix.target }}-early-access.vsix

- name: Upload VSIX package as artifact
uses: actions/upload-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.nyc_output
.vscode-test
coverage
node_modules
out
# note the order of the next test-workspace records
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/integration-tests/suite/index",
"--extensionTestsPath=${workspaceFolder}/out/integration-tests/suite",
"${workspaceFolder}/test-workspace"
],
"outFiles": [
Expand Down
5 changes: 5 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
.git/**
.github/**
.nyc_output/**
.vscode/**
.vscode-test/**
coverage/**
images/**
integration-tests/**
out/integration-tests/**
src/**
test-workspace/**
tests/**
out/tests/**
.editorconfig
.eslintrc.json
.gitignore
Expand All @@ -15,3 +19,4 @@ tsconfig.json
**/*.ts
**/*.vsix
!images/icon.png
!images/icon-black.svg
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ The `ocm-vscode-extension` helps quickly create Open Cluster Management (OCM) ap

![new-project][11]

- Create a local environment using [kind][5], [clusteradm][6], and [kubectl][7]:
- Verify the existence of the required tools.
- Create as many [kind][5] clusters as you need.
- Initialize the _hub cluster_ using [clusteradm][6], and [kubectl][7].
- Send join requests from the _managed clusters_ to the _hub cluster_ using [clusteradm][6], and [kubectl][7].
- Accept the join requests from the _hub cluster_ using [clusteradm][6], and [kubectl][7].

## Installation

This extension is still in development and is available as pre-release development snapshots only.</br>
Expand All @@ -40,6 +47,9 @@ See our [Contributing Guidelines][3] for more information.
[2]: https://github.com/open-cluster-management-io/clusteradm
[3]: https://github.com/ilan-pinto/ocm-vscode-extension/contribute
[4]: https://github.com/ilan-pinto/ocm-vscode-extension/releases/tag/early-access
[5]: https://kind.sigs.k8s.io/
[6]: https://github.com/open-cluster-management-io/clusteradm
[7]: https://kubernetes.io/docs/tasks/tools/
<!-- GIFS -->
[10]: https://raw.githubusercontent.com/ilan-pinto/ocm-vscode-extension/main/images/snippets-from-palette.gif
[11]: https://raw.githubusercontent.com/ilan-pinto/ocm-vscode-extension/main/images/new-project.gif
1 change: 1 addition & 0 deletions images/icon-black.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions integration-tests/runSuite.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as path from 'path';
import * as fse from 'fs-extra';
import * as path from 'path';
import { runTests } from '@vscode/test-electron';

async function main() {
async function main(): Promise<void> {
try {
// the folder containing the extension manifest package.json, passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath: string = path.resolve(__dirname, '../../');
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/suite.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as path from 'path';
import * as Mocha from 'mocha';
import * as glob from 'glob';
import * as path from 'path';

export function run(): Promise<void> {
// Create the mocha test
const mocha = new Mocha({
ui: 'tdd',
color: true
color: true,
slow: 600
});

const testsRoot: string = path.join(__dirname, 'test-files');
Expand Down
Loading