diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 5c062f2935..b9ce8eaca0 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -40,7 +40,7 @@ jobs: git clone "https://${GH_TOKEN}@github.com/lensapp/lens-ide.git" .lens-ide-overlay rm -rf .lens-ide-overlay/.git cp -r .lens-ide-overlay/* ./ - cp build/package.json.patch . && patch package.json package.json.patch + jq -s '.[0] * .[1]' package.json package.ide.json > package.custom.json && mv package.custom.json package.json displayName: Customize config env: GH_TOKEN: $(LENS_IDE_GH_TOKEN) @@ -62,6 +62,7 @@ jobs: WIN_CSC_KEY_PASSWORD: $(WIN_CSC_KEY_PASSWORD) AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) + BUILD_NUMBER: $(Build.BuildNumber) - job: macOS pool: vmImage: macOS-10.14 @@ -89,7 +90,7 @@ jobs: git clone "https://${GH_TOKEN}@github.com/lensapp/lens-ide.git" .lens-ide-overlay rm -rf .lens-ide-overlay/.git cp -r .lens-ide-overlay/* ./ - cp build/package.json.patch . && patch package.json package.json.patch + jq -s '.[0] * .[1]' package.json package.ide.json > package.custom.json && mv package.custom.json package.json displayName: Customize config env: GH_TOKEN: $(LENS_IDE_GH_TOKEN) @@ -113,6 +114,7 @@ jobs: CSC_KEY_PASSWORD: $(CSC_KEY_PASSWORD) AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) + BUILD_NUMBER: $(Build.BuildNumber) - job: Linux pool: vmImage: ubuntu-16.04 @@ -140,7 +142,7 @@ jobs: git clone "https://${GH_TOKEN}@github.com/lensapp/lens-ide.git" .lens-ide-overlay rm -rf .lens-ide-overlay/.git cp -r .lens-ide-overlay/* ./ - cp build/package.json.patch . && patch package.json package.json.patch + jq -s '.[0] * .[1]' package.json package.ide.json > package.custom.json && mv package.custom.json package.json displayName: Customize config env: GH_TOKEN: $(LENS_IDE_GH_TOKEN) @@ -170,8 +172,4 @@ jobs: env: AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) - - script: make publish-npm - displayName: Publish npm package - condition: "and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))" - env: - NPM_TOKEN: $(NPM_TOKEN) + BUILD_NUMBER: $(Build.BuildNumber) diff --git a/.dependabot/config.yml b/.dependabot/config.yml index a77a36c653..8292c7dde2 100644 --- a/.dependabot/config.yml +++ b/.dependabot/config.yml @@ -15,3 +15,7 @@ updates: versioning-strategy: lockfile-only: false increase: true + ignore: + - dependency-name: * + update-types: + - version-update:semver-major diff --git a/.eslintrc.js b/.eslintrc.js index 4854713f0e..09e6bd3819 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,24 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + const packageJson = require("./package.json"); module.exports = { @@ -27,9 +48,12 @@ module.exports = { sourceType: "module", }, plugins: [ - "unused-imports" + "header", + "unused-imports", + "react-hooks" ], rules: { + "header/header": [2, "./license-header"], "indent": ["error", 2, { "SwitchCase": 1, }], @@ -72,6 +96,7 @@ module.exports = { "plugin:@typescript-eslint/recommended", ], plugins: [ + "header", "unused-imports" ], parserOptions: { @@ -79,6 +104,7 @@ module.exports = { sourceType: "module", }, rules: { + "header/header": [2, "./license-header"], "no-invalid-this": "off", "@typescript-eslint/no-invalid-this": ["error"], "@typescript-eslint/explicit-function-return-type": "off", @@ -127,6 +153,7 @@ module.exports = { ], parser: "@typescript-eslint/parser", plugins: [ + "header", "unused-imports" ], extends: [ @@ -139,6 +166,7 @@ module.exports = { jsx: true, }, rules: { + "header/header": [2, "./license-header"], "no-invalid-this": "off", "@typescript-eslint/no-invalid-this": ["error"], "@typescript-eslint/explicit-function-return-type": "off", @@ -183,7 +211,9 @@ module.exports = { { "blankLine": "always", "prev": "*", "next": "class" }, { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, - ] + ], + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "off" }, } ] diff --git a/.github/PULL_REQUEST_TEMPLATE/default.md b/.github/PULL_REQUEST_TEMPLATE/default.md new file mode 100644 index 0000000000..a54a6ef38c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/default.md @@ -0,0 +1,5 @@ +Fixes # + +**Description of changes:** + +- diff --git a/.github/PULL_REQUEST_TEMPLATE/release.md b/.github/PULL_REQUEST_TEMPLATE/release.md new file mode 100644 index 0000000000..11e5822025 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/release.md @@ -0,0 +1,13 @@ +## Changes since v + +## πŸš€ Features + +* + +## πŸ› Bug Fixes + +* + +## 🧰 Maintenance + +* diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 02ae36727e..f7b3529b74 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -18,13 +18,3 @@ template: | ## Changes since $PREVIOUS_TAG $CHANGES - - ### Download - - - Lens v$RESOLVED_VERSION - Linux - - [AppImage](https://github.com/lensapp/lens/releases/download/v$RESOLVED_VERSION/Lens-$RESOLVED_VERSION.x86_64.AppImage) - - [DEB](https://github.com/lensapp/lens/releases/download/v$RESOLVED_VERSION/Lens-$RESOLVED_VERSION.amd64.deb) - - [RPM](https://github.com/lensapp/lens/releases/download/v$RESOLVED_VERSION/Lens-$RESOLVED_VERSION.x86_64.rpm) - - [Snapcraft](https://snapcraft.io/kontena-lens) - - [Lens v$RESOLVED_VERSION - MacOS](https://github.com/lensapp/lens/releases/download/v$RESOLVED_VERSION/Lens-$RESOLVED_VERSION.dmg) - - [Lens v$RESOLVED_VERSION - Windows](https://github.com/lensapp/lens/releases/download/v$RESOLVED_VERSION/Lens-Setup-$RESOLVED_VERSION.exe) diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.yml new file mode 100644 index 0000000000..daba6a9ca9 --- /dev/null +++ b/.github/workflows/license-header.yml @@ -0,0 +1,26 @@ +name: Check License Header +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + css: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Golang + uses: actions/setup-go@v2 + - name: Install addlicense + run: | + export PATH=${PATH}:`go env GOPATH`/bin + go get -v -u github.com/google/addlicense + - name: Check license headers + run: | + set -e + export PATH=${PATH}:`go env GOPATH`/bin + + addlicense -check -l mit -c "OpenLens Authors" src/**/*.?css diff --git a/.github/workflows/publish-master-npm.yml b/.github/workflows/publish-master-npm.yml new file mode 100644 index 0000000000..2be9721d3e --- /dev/null +++ b/.github/workflows/publish-master-npm.yml @@ -0,0 +1,35 @@ +name: Publish NPM Package `master` +on: + push: + branches: + - master +jobs: + publish: + name: Publish NPM Package `master` + runs-on: ubuntu-latest + if: | + ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'area/extension') }} + strategy: + matrix: + node-version: [12.x] + steps: + - name: Checkout Release + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Using Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Generate NPM package + run: | + make build-npm + + - name: publish new release + run: | + make publish-npm + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_RELEASE_TAG: master diff --git a/.github/workflows/publish-release-npm.yml b/.github/workflows/publish-release-npm.yml new file mode 100644 index 0000000000..5a8bd9aff5 --- /dev/null +++ b/.github/workflows/publish-release-npm.yml @@ -0,0 +1,33 @@ +name: Publish NPM Package Release +on: + release: + types: + - published +jobs: + publish: + name: Publish NPM Package Release + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [12.x] + steps: + - name: Checkout Release + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Using Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Generate NPM package + run: | + make build-npm + + - name: publish new release + if: contains(github.ref, 'refs/tags/v') + run: | + make publish-npm + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/Makefile b/Makefile index cdbcc94f85..fba4e9b98e 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ CMD_ARGS = $(filter-out $@,$(MAKECMDGOALS)) %: @: +NPM_RELEASE_TAG ?= latest EXTENSIONS_DIR = ./extensions extensions = $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), ${dir}) extension_node_modules = $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), ${dir}/node_modules) @@ -14,13 +15,13 @@ else DETECTED_OS := $(shell uname) endif -binaries/client: node_modules - yarn download-bins - node_modules: yarn.lock yarn install --frozen-lockfile --network-timeout=100000 yarn check --verify-tree --integrity +binaries/client: node_modules + yarn download-bins + static/build/LensDev.html: node_modules yarn compile:renderer @@ -37,17 +38,20 @@ dev: binaries/client build-extensions static/build/LensDev.html lint: yarn lint +.PHONY: release-version +release-version: + npm version $(CMD_ARGS) --git-tag-version false + +.PHONY: tag-release +tag-release: + scripts/tag-release.sh + .PHONY: test test: binaries/client yarn run jest $(or $(CMD_ARGS), "src") .PHONY: integration-linux integration-linux: binaries/client build-extension-types build-extensions -# ifdef XDF_CONFIG_HOME -# rm -rf ${XDG_CONFIG_HOME}/.config/Lens -# else -# rm -rf ${HOME}/.config/Lens -# endif yarn build:linux yarn integration @@ -65,21 +69,26 @@ integration-win: binaries/client build-extension-types build-extensions .PHONY: build build: node_modules binaries/client build-extensions + yarn run npm:fix-build-version yarn run compile ifeq "$(DETECTED_OS)" "Windows" - ./node_modules/.bin/electron-builder --publish onTag --x64 --ia32 + yarn run electron-builder --publish onTag --x64 --ia32 else - ./node_modules/.bin/electron-builder --publish onTag + yarn run electron-builder --publish onTag endif -$(extension_node_modules): - cd $(@:/node_modules=) && npm install --no-audit --no-fund +$(extension_node_modules): node_modules + cd $(@:/node_modules=) && ../../node_modules/.bin/npm install --no-audit --no-fund $(extension_dists): src/extensions/npm/extensions/dist - cd $(@:/dist=) && npm run build + cd $(@:/dist=) && ../../node_modules/.bin/npm run build + +.PHONY: clean-old-extensions +clean-old-extensions: + find ./extensions -mindepth 1 -maxdepth 1 -type d '!' -exec test -e '{}/package.json' \; -exec rm -rf {} \; .PHONY: build-extensions -build-extensions: node_modules $(extension_node_modules) $(extension_dists) +build-extensions: node_modules clean-old-extensions $(extension_node_modules) $(extension_dists) .PHONY: test-extensions test-extensions: $(extension_node_modules) @@ -93,7 +102,7 @@ copy-extension-themes: src/extensions/npm/extensions/__mocks__: cp -r __mocks__ src/extensions/npm/extensions/ -src/extensions/npm/extensions/dist: +src/extensions/npm/extensions/dist: node_modules yarn compile:extension-types .PHONY: build-npm @@ -101,12 +110,13 @@ build-npm: build-extension-types copy-extension-themes src/extensions/npm/extens yarn npm:fix-package-version .PHONY: build-extension-types -build-extension-types: src/extensions/npm/extensions/dist +build-extension-types: node_modules src/extensions/npm/extensions/dist .PHONY: publish-npm -publish-npm: build-npm - npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" - cd src/extensions/npm/extensions && npm publish --access=public +publish-npm: node_modules build-npm + ./node_modules/.bin/npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + cd src/extensions/npm/extensions && npm publish --access=public --tag=$(NPM_RELEASE_TAG) + git restore src/extensions/npm/extensions/package.json .PHONY: docs docs: @@ -116,6 +126,7 @@ docs: clean-extensions: $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), rm -rf $(dir)/dist) $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), rm -rf $(dir)/node_modules) + $(foreach dir, $(wildcard $(EXTENSIONS_DIR)/*), rm $(dir)/*.tgz || true) .PHONY: clean-npm clean-npm: diff --git a/RELEASE_GUIDE.md b/RELEASE_GUIDE.md index da4bf01d94..5fdc1efa32 100644 --- a/RELEASE_GUIDE.md +++ b/RELEASE_GUIDE.md @@ -2,10 +2,20 @@ Lens releases are built by CICD automatically on git tags. The typical release process flow is the following: -1. Create a release branch `release/v{version}` from `master` branch or from existing release branch (for example, `release/v3.5`) on patch releases. -2. Update changelog in `static/RELEASE_NOTES.md` and bump version in `package.json`. -3. Create PR and put change log in description field. -4. After the PR is accepted, create a tag from release branch. -5. Push tag to GitHub. -6. Publish automatically created GitHub release. -7. Merge the release PR after the release is published and delete the release branch from GitHub. \ No newline at end of file +1. From a clean and up to date `master` run `make release-version ` where `` is one of the following: + - `major` + - `minor` + - `patch` + - `premajor` + - `preminor` + - `prepatch` + - `prerelease [--preid=]` + - where `` is generally one of: + - `alpha` + - `beta` + - `rc` +1. Create PR (git should have printed a link to GitHub in the console) with the contents of all the accepted PRs since the last release. +1. After the PR is accepted and passes CI. Go to the same branch and run `make tag-release` +1. Once CI passes again go to the releases tab on GitHub, create a new release from the tag that was created, make sure that the change log is the same as that of the PR. +1. Merge the release PR after the release is published. GitHub should delete the branch once it is merged. +1. If you have just released a new major or minor version then create a new `vMAJOR.MINOR` branch from that same tag and push it to master. This will be the target for future patch releases and shouldn't be deleted. diff --git a/__mocks__/@linguiMacro.ts b/__mocks__/@linguiMacro.ts deleted file mode 100644 index a1154b42dd..0000000000 --- a/__mocks__/@linguiMacro.ts +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = { - Trans: ({ children }: { children: React.ReactNode }) => children, - t: (message: string) => message -}; diff --git a/__mocks__/electron.ts b/__mocks__/electron.ts index 1b531fb8d7..0a369eea4e 100644 --- a/__mocks__/electron.ts +++ b/__mocks__/electron.ts @@ -1,4 +1,24 @@ -module.exports = { +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +export default { require: jest.fn(), match: jest.fn(), app: { diff --git a/__mocks__/imageMock.ts b/__mocks__/imageMock.ts index f053ebf797..f80e118413 100644 --- a/__mocks__/imageMock.ts +++ b/__mocks__/imageMock.ts @@ -1 +1,22 @@ -module.exports = {}; +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +export default {}; diff --git a/__mocks__/styleMock.ts b/__mocks__/styleMock.ts index f053ebf797..375355db28 100644 --- a/__mocks__/styleMock.ts +++ b/__mocks__/styleMock.ts @@ -1 +1,21 @@ -module.exports = {}; +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +export default {}; diff --git a/build/build_tray_icon.ts b/build/build_tray_icon.ts index 3aded6fdf5..9669783631 100644 --- a/build/build_tray_icon.ts +++ b/build/build_tray_icon.ts @@ -1,5 +1,23 @@ -// Generate tray icons from SVG to PNG + different sizes and colors (B&W) -// Command: `yarn build:tray-icons` +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ import path from "path"; import sharp from "sharp"; import jsdom from "jsdom"; diff --git a/build/download_helm.ts b/build/download_helm.ts index 7a3dc62a72..703684066b 100644 --- a/build/download_helm.ts +++ b/build/download_helm.ts @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ import { helmCli } from "../src/main/helm/helm-cli"; helmCli.ensureBinary(); diff --git a/build/download_kubectl.ts b/build/download_kubectl.ts index f046b23e30..819b73dd02 100644 --- a/build/download_kubectl.ts +++ b/build/download_kubectl.ts @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ import packageInfo from "../package.json"; import fs from "fs"; import request from "request"; @@ -5,6 +25,7 @@ import md5File from "md5-file"; import requestPromise from "request-promise-native"; import { ensureDir, pathExists } from "fs-extra"; import path from "path"; +import { noop } from "../src/common/utils"; class KubectlDownloader { public kubectlVersion: string; @@ -26,7 +47,7 @@ class KubectlDownloader { method: "HEAD", uri: this.url, resolveWithFullResponse: true - }).catch((error) => { console.log(error); }); + }).catch(console.error); if (response.headers["etag"]) { return response.headers["etag"].replace(/"/g, ""); @@ -42,7 +63,7 @@ class KubectlDownloader { const hash = md5File.sync(this.path); const etag = await this.urlEtag(); - if(hash == etag) { + if (hash == etag) { console.log("Kubectl md5sum matches the remote etag"); return true; @@ -56,13 +77,10 @@ class KubectlDownloader { } public async downloadKubectl() { - const exists = await this.checkBinary(); - - if(exists) { - console.log("Already exists and is valid"); - - return; + if (await this.checkBinary()) { + return console.log("Already exists and is valid"); } + await ensureDir(path.dirname(this.path), 0o755); const file = fs.createWriteStream(this.path); @@ -76,18 +94,16 @@ class KubectlDownloader { stream.on("complete", () => { console.log("kubectl binary download finished"); - // eslint-disable-next-line @typescript-eslint/no-empty-function - file.end(() => {}); + file.end(noop); }); stream.on("error", (error) => { console.log(error); - // eslint-disable-next-line @typescript-eslint/no-empty-function - fs.unlink(this.path, () => {}); - throw(error); + fs.unlink(this.path, noop); + throw error; }); - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { file.on("close", () => { console.log("kubectl binary download closed"); fs.chmod(this.path, 0o755, (err) => { @@ -116,4 +132,3 @@ downloads.forEach((dlOpts) => { console.log(`Downloading: ${JSON.stringify(dlOpts)}`); downloader.downloadKubectl().then(() => downloader.checkBinary().then(() => console.log("Download complete"))); }); - diff --git a/build/notarize.js b/build/notarize.js index ef4144993c..959f526ddd 100644 --- a/build/notarize.js +++ b/build/notarize.js @@ -1,3 +1,23 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ const { notarize } = require("electron-notarize"); exports.default = async function notarizing(context) { diff --git a/build/set_build_version.ts b/build/set_build_version.ts new file mode 100644 index 0000000000..13d46d4ff3 --- /dev/null +++ b/build/set_build_version.ts @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +import * as fs from "fs"; +import * as path from "path"; +import appInfo from "../package.json"; +import semver from "semver"; +import fastGlob from "fast-glob"; + +const packagePath = path.join(__dirname, "../package.json"); +const versionInfo = semver.parse(appInfo.version); +const buildNumber = process.env.BUILD_NUMBER || "1"; +let buildChannel = "alpha"; + +if (versionInfo.prerelease) { + if (versionInfo.prerelease.includes("alpha")) { + buildChannel = "alpha"; + } else { + buildChannel = "beta"; + } + appInfo.version = `${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}-${buildChannel}.${versionInfo.prerelease[1]}.${buildNumber}`; +} else { + appInfo.version = `${appInfo.version}-latest.${buildNumber}`; +} + + +fs.writeFileSync(packagePath, `${JSON.stringify(appInfo, null, 2)}\n`); + +const extensionManifests = fastGlob.sync(["extensions/*/package.json"]); + +for (const manifestPath of extensionManifests) { + const packagePath = path.join(__dirname, "..", manifestPath); + + import(packagePath).then((packageInfo) => { + packageInfo.default.version = `${versionInfo.raw}.${Date.now()}`; + fs.writeFileSync(packagePath, `${JSON.stringify(packageInfo.default, null, 2)}\n`); + }); +} diff --git a/build/set_npm_version.ts b/build/set_npm_version.ts index 9b433349fb..c0b24b54a6 100644 --- a/build/set_npm_version.ts +++ b/build/set_npm_version.ts @@ -1,9 +1,41 @@ +/** + * Copyright (c) 2021 OpenLens Authors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ import * as fs from "fs"; import * as path from "path"; import packageInfo from "../src/extensions/npm/extensions/package.json"; import appInfo from "../package.json"; +import { SemVer } from "semver"; +import { execSync } from "child_process"; -const packagePath = path.join(__dirname, "../src/extensions/npm/extensions/package.json"); +const { NPM_RELEASE_TAG = "latest" } = process.env; +const version = new SemVer(appInfo.version); -packageInfo.version = appInfo.version; -fs.writeFileSync(packagePath, `${JSON.stringify(packageInfo, null, 2)}\n`); +if (NPM_RELEASE_TAG !== "latest") { + const gitRef = execSync("git rev-parse --short HEAD", { + encoding: "utf-8", + }); + + version.inc("prerelease", `git.${gitRef.trim()}`); +} + +packageInfo.version = version.format(); + +fs.writeFileSync(path.join(__dirname, "../src/extensions/npm/extensions/package.json"), `${JSON.stringify(packageInfo, null, 2)}\n`); diff --git a/docs/CNAME b/docs/CNAME index 12bc650410..f51f3799f9 100644 --- a/docs/CNAME +++ b/docs/CNAME @@ -1 +1 @@ -docs.k8slens.dev +api-docs.k8slens.dev diff --git a/docs/README.md b/docs/README.md index 1a13ddb6a9..f98403eb75 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,21 +1,46 @@ -# Overview +# Lens Extension API -Lens is the most powerful Kubernetes IDE on the market. It is a standalone application, and it is available on macOS, Windows, and Linux. Some of the benefits of using Lens include: +Customize and enhance the Lens experience with the Lens Extension API. +Use the extension API to create menus or page content. +The same extension API was used to create many of Lens's core features. +To install your first extension you should goto the [extension page](lens://app/extensions) in lens. -* Confidence that your clusters are properly setup and configured. -* Increased visibility, real time statistics, log streams, and hands-on troubleshooting capabilities. -* The ability to work with your clusters quickly and easily, radically improving productivity and the speed of business. +This documentation describes: -Watch this introductory video to see Lens in action: +* How to build, run, test, and publish an extension. +* How to take full advantage of the Lens Extension API. +* Where to find [guides](extensions/guides/README.md) and [code samples](https://github.com/lensapp/lens-extension-samples) to help get you started. -[![Screenshot](img/lens-intro-video-screenshot.png)](https://www.youtube.com/watch?v=eeDwdVXattc) +## What Extensions Can Do -**Note:** Use CTRL+click (on Windows and Linux) or CMD+click (on MacOS) to open the above in a new tab +Here are some examples of what you can achieve with the Extension API: + +* Add custom components & views in the UI - Extending the Lens Workbench + +For an overview of the Lens Extension API, refer to the [Common Capabilities](extensions/capabilities/common-capabilities.md) page. [Extension Guides Overview](extensions/guides/README.md) also includes a list of code samples and guides that illustrate various ways of using the Lens Extension API. + +## How to Build Extensions + +Here is what each section of the Lens Extension API docs can help you with: + +* **Getting Started** teaches fundamental concepts for building extensions with the Hello World sample. +* **Extension Capabilities** dissects Lens's Extension API into smaller categories and points you to more detailed topics. +* **Extension Guides** includes guides and code samples that explain specific usages of Lens Extension API. +* **Testing and Publishing** includes in-depth guides on various extension development topics, such as testing and publishing extensions. +* **API Reference** contains exhaustive references for the Lens Extension API, Contribution Points, and many other topics. + +## What's New + +Just like Lens itself, the extension API updates on a monthly cadence, rolling out new features with every release. + +Keep up with Lens and the Lens Extension API by reviewing the [release notes](https://github.com/lensapp/lens/releases). + +## Looking for Help + +If you have questions for extension development, try asking on the [Lens Dev Slack](http://k8slens.slack.com/). It's a public chatroom for Lens developers, where Lens team members chime in from time to time. + +To provide feedback on the documentation or issues with the Lens Extension API, create new issues at [lensapp/lens](https://github.com/lensapp/lens/issues). Please use the labels `area/documentation` and/or `area/extension`. ## Downloading Lens [Download Lens](https://github.com/lensapp/lens/releases) for macOS, Windows, or Linux. - -## Quick Start - -Get up and running quickly by learning to [add clusters](clusters/adding-clusters.md). diff --git a/docs/clusters/adding-clusters.md b/docs/clusters/adding-clusters.md deleted file mode 100644 index c9a533a700..0000000000 --- a/docs/clusters/adding-clusters.md +++ /dev/null @@ -1,22 +0,0 @@ -# Adding Clusters - -Add clusters by clicking the **Add Cluster** button in the left-side menu. - -1. Click the **Add Cluster** button (indicated with a '+' icon). Or [click here](lens://app/cluster). -2. Enter the path to your kubeconfig file. You'll need to have a kubeconfig file for the cluster you want to add. You can either browse for the path from the file system or or enter it directly. - -Selected [cluster contexts](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#context) are added as a separate item in the left-side cluster menu to allow you to operate easily on multiple clusters and/or contexts. - -**NOTE**: Any cluster that you added manually will not be merged into your kubeconfig file. - -![Add Cluster](images/add-cluster.png) - -For more information on kubeconfig see [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). - -To see your currently-enabled config with `kubectl`, enter `kubectl config view --minify --raw` in your terminal. - -When connecting to a cluster, make sure you have a valid and working kubeconfig for the cluster. Following lists known "gotchas" in some authentication types used in kubeconfig with Lens app. - -## Exec auth plugins - -When using [exec auth](https://kubernetes.io/docs/reference/access-authn-authz/authentication/#configuration) plugins make sure the paths that are used to call any binaries are full paths as Lens app might not be able to call binaries with relative paths. Make also sure that you pass all needed information either as arguments or env variables in the config, Lens app might not have all login shell env variables set automatically. diff --git a/docs/clusters/images/add-cluster.png b/docs/clusters/images/add-cluster.png deleted file mode 100644 index fa7b632026..0000000000 Binary files a/docs/clusters/images/add-cluster.png and /dev/null differ diff --git a/docs/clusters/images/cluster-context-menu.png b/docs/clusters/images/cluster-context-menu.png deleted file mode 100644 index d733840df3..0000000000 Binary files a/docs/clusters/images/cluster-context-menu.png and /dev/null differ diff --git a/docs/clusters/images/cluster-settings-features.png b/docs/clusters/images/cluster-settings-features.png deleted file mode 100644 index 3a8066309d..0000000000 Binary files a/docs/clusters/images/cluster-settings-features.png and /dev/null differ diff --git a/docs/clusters/images/cluster-settings-general.png b/docs/clusters/images/cluster-settings-general.png deleted file mode 100644 index d7de0a1a35..0000000000 Binary files a/docs/clusters/images/cluster-settings-general.png and /dev/null differ diff --git a/docs/clusters/images/cluster-settings-removal.png b/docs/clusters/images/cluster-settings-removal.png deleted file mode 100644 index badcbcc6e0..0000000000 Binary files a/docs/clusters/images/cluster-settings-removal.png and /dev/null differ diff --git a/docs/clusters/images/cluster-settings-status.png b/docs/clusters/images/cluster-settings-status.png deleted file mode 100644 index af8e939e35..0000000000 Binary files a/docs/clusters/images/cluster-settings-status.png and /dev/null differ diff --git a/docs/clusters/images/cluster-settings.png b/docs/clusters/images/cluster-settings.png deleted file mode 100644 index 27a4a72ff9..0000000000 Binary files a/docs/clusters/images/cluster-settings.png and /dev/null differ diff --git a/docs/clusters/images/remove-cluster.png b/docs/clusters/images/remove-cluster.png deleted file mode 100644 index bcaa69c44a..0000000000 Binary files a/docs/clusters/images/remove-cluster.png and /dev/null differ diff --git a/docs/clusters/removing-clusters.md b/docs/clusters/removing-clusters.md deleted file mode 100644 index 3ec0d3a1cd..0000000000 --- a/docs/clusters/removing-clusters.md +++ /dev/null @@ -1,12 +0,0 @@ -# Removing Clusters - -Remove Lens clusters using the context menu that appears when you right-click the cluster in the left-side menu that you want to remove. - -To remove a cluster from your cluster list: - -1. Right-click the name of the cluster in the left-side menu that you want to remove. -2. Click **Remove**. - -**NOTE**: This will only remove the cluster from your Lens cluster list. It will not affect your actual Kubernetes cluster or its configuration. - -![Remove Cluster](images/remove-cluster.png) \ No newline at end of file diff --git a/docs/clusters/settings.md b/docs/clusters/settings.md deleted file mode 100644 index 351c0babeb..0000000000 --- a/docs/clusters/settings.md +++ /dev/null @@ -1,75 +0,0 @@ -# Settings - -It is easy to configure Lens Clusters to your liking through its various settings. - -1. Right-click the name of the cluster in the left-side menu that you want to open the settings for. -2. Click **Settings**. - -![Cluster settings](images/cluster-context-menu.png) - -## Status - -Overview of the cluster status - -### Cluster Status - -Cluster status information including the detected distribution, kernel version, API endpoint, and online status - -![Cluster settings status](images/cluster-settings-status.png) - -## General - -General cluster settings - -### Cluster Name - -The cluster name is inheritated by default from the kubeconfig file. Change the cluster name to another value by updating it here. Note that doing so does not update your kubeconfig file. - -### Workspace - -This is the Lens workspace that the cluster is associated with. Change workspaces by selecting a different workspace from the dropdown menu. Create a new workspace by clicking **workspace** in "Define cluster workspace" above the dropdown menu. This option will take you the workspaces editor. Create a new workspace and then navigate back to cluster settings. - -### Cluster Icon - -Lens randomly generates an icon to associate with each newly-created cluster. Use this setting to choose your own icon. - -### HTTP Proxy - -Some users will need to define an HTTP proxy for communicating with the Kubernetes API. Use this setting to do so. - -### Prometheus - -Lens can be configured to query a Prometheus server installed in the cluster. Select a query format by choosing either to auto-detect or from the following configurations: - -* Lens -* Helm Operator -* Prometheus Operator -* Stacklight - -To learn more about custom Prometheus configurations, please refer to this [guide](https://github.com/lensapp/lens/blob/master/troubleshooting/custom-prometheus.md). - -### Working Directory - -Use this field to set the terminal working directory. The default is `$HOME`. - -![Cluster settings general](images/cluster-settings-general.png) - -## Features - -Additional Lens features that can be installed by the user - -### Metrics - -Enable timeseries data visualization (Prometheus stack) for your cluster. Install this only if you don't have existing Prometheus stack installed. - -### User Mode - -User Mode feature enables non-admin users to see namespaces they have access to. This is achieved by configuring RBAC rules so that every authenticated user is granted to list namespaces. - -![Cluster settings features](images/cluster-settings-features.png) - -## Removal - -Use this setting to remove the current cluster. - -![Cluster settings removal](images/cluster-settings-removal.png) diff --git a/docs/contributing/README.md b/docs/contributing/README.md deleted file mode 100644 index 6cf7053fb8..0000000000 --- a/docs/contributing/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Contributing - -There are multiple ways you can contribute to Lens. Even if you are not a developer, you can still contribute. We are always looking for assistance with creating or updating documentation, testing the application, reporting, and troubleshooting issues. - -Here are some ways you can contribute! - -* [Development](./development.md) – Help make Lens better. -* [Maintaining the Project](./maintainers.md) – Become a community maintainer and help us maintain the project. -* [Extension Development](../extensions) – Add integrations via Lens Extensions. -* [Documentation](./documentation.md) – Help improve Lens documentation. -* [Promotion](./promotion.md) – Show your support, be an ambassador to Lens, write blogs, and make videos! - -If you are an influencer, blogger, or journalist, feel free to [spread the word](./promotion.md)! - -## Code of Conduct - -This project adheres to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct. By participating and contributing to Lens, you are expected to uphold this code. Please report unacceptable behaviour to info@k8slens.dev. diff --git a/docs/contributing/development.md b/docs/contributing/development.md deleted file mode 100644 index 89a9b898cd..0000000000 --- a/docs/contributing/development.md +++ /dev/null @@ -1,43 +0,0 @@ -# Development - -Thank you for taking the time to make a contribution to Lens. The following document is a set of guidelines and instructions for contributing to Lens. - -When contributing to this repository, please consider first discussing the change you wish to make by opening an issue. - -## Recommended Reading: - -- [TypeScript](https://www.typescriptlang.org/docs/home.html) (front-end/back-end) -- [ReactJS](https://reactjs.org/docs/getting-started.html) (front-end, ui) -- [MobX](https://mobx.js.org/) (app-state-management, back-end/front-end) -- [ElectronJS](https://www.electronjs.org/docs) (chrome/node) -- [NodeJS](https://nodejs.org/dist/latest-v12.x/docs/api/) (api docs) - -## Local Development Environment - -> Prerequisites: Nodejs v12, make, yarn - -* `make dev` - builds and starts the app -* `make clean` - cleanup local environment build artifacts - -### Developing on Windows - -On Windows we only support [Git Bash](https://gitforwindows.org/) (or similar shell) for running commands. - -## Github Workflow - -We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), so all code changes are tracked via Pull Requests. -A detailed guide on the recommended workflow can be found below: - -* [Github Workflow](./github_workflow.md) - -## Code Testing - -All submitted PRs go through a set of tests and reviews. You can run most of these tests *before* a PR is submitted. -In fact, we recommend it, because it will save on many possible review iterations and automated tests. -The testing guidelines can be found here: - -* [Contributor's Guide to Testing](./testing.md) - -## License - -By contributing, you agree that your contributions will be licensed as described in [LICENSE](https://github.com/lensapp/lens/blob/master/LICENSE). diff --git a/docs/contributing/documentation.md b/docs/contributing/documentation.md deleted file mode 100644 index 501c57779f..0000000000 --- a/docs/contributing/documentation.md +++ /dev/null @@ -1,33 +0,0 @@ -# Documentation - -We are glad to see you're interested in contributing to the Lens documentation. If this is the first Open Source project you've contributed to, we strongly suggest reading GitHub's excellent guide: [How to Contribute to Open Source](https://opensource.guide/how-to-contribute). - -## Finding Documentation Issues to Work On - -You can find a list of open documentation-related issues [here](https://github.com/lensapp/lens/issues?q=is%3Aopen+is%3Aissue+label%3Aarea%2Fdocumentation). When you find something you would like to work on: - -1. Express your interest to start working on an issue via comments. -2. One of the maintainers will assign the issue for you. -3. You can start working on the issue. When you're done, simply submit a pull request. - -## Requirements for Documentation Pull Requests - -When you create a new pull request, we expect some requirements to be met. - -* Follow this naming convention for Pull Requests: - * When adding new documentation, add `New Documentation:` before the title. E.g. `New Documentation: Getting Started` - * When fixing documentation, add `Fix Documentation:` before the title. E.g. `Fix Documentation: Getting Started` - * When updating documentation, add `Update Documentation:` before the title. E.g. `Update Documentation: Getting Started` -* If your Pull Request closes an issue, you must write `Closes #ISSUE_NUMBER` where the ISSUE_NUMBER is the number in the end of the link url or the relevent issue. This will link your pull request to the issue, and when it is merged, the issue will close. -* For each pull request made, we run tests to check if there are any broken links, the markdown formatting is valid, and the linter is passing. - - -## Testing Documentation Site Locally - -Run a local instance of `mkdocs` in a docker container for developing the Lens Documentation. - -> Prerequisites: docker, yarn - -* `make docs` - local build and serve of mkdocs with auto update enabled - -Go to [localhost:8000](http://127.0.0.1:8000). diff --git a/docs/contributing/github_workflow.md b/docs/contributing/github_workflow.md deleted file mode 100644 index 3509645b47..0000000000 --- a/docs/contributing/github_workflow.md +++ /dev/null @@ -1,148 +0,0 @@ -# Github Workflow - - -- [Fork The Project](#fork-the-project) -- [Adding the Forked Remote](#adding-the-forked-remote) -- [Create & Rebase Your Feature Branch](#create--rebase-your-feature-branch) -- [Commit & Push](#commit--push) -- [Open a Pull Request](#open-a-pull-request) - - [Get a code review](#get-a-code-review) - - [Squash commits](#squash-commits) - - [Push Your Final Changes](#push-your-final-changes) - - -This guide assumes you have already cloned the upstream repo to your system via git clone. - -## Fork The Project - -1. Go to [http://github.com/lensapp/lens](http://github.com/lensapp/lens) -2. On the top, right-hand side, click on "fork" and select your username for the fork destination. - -## Adding the Forked Remote - -``` -export GITHUB_USER={ your github's username } - -cd $WORKDIR/lens -git remote add $GITHUB_USER git@github.com:${GITHUB_USER}/lens.git - -# Prevent push to Upstream -git remote set-url --push origin no_push - -# Set your fork remote as a default push target -git push --set-upstream $GITHUB_USER master -``` - -Your remotes should look something like this: - -``` -➜ git remote -v -origin https://github.com/lensapp/lens (fetch) -origin no_push (push) -my_fork git@github.com:{ github_username }/lens.git (fetch) -my_fork git@github.com:{ github_username }/lens.git (push) -``` - -## Create & Rebase Your Feature Branch - -Create a feature branch: - -``` -git branch -b my_feature_branch -``` - -Rebase your branch: - -``` -git fetch origin - -git rebase origin/master -Current branch my_feature_branch is up to date. -``` - -Please don't use `git pull` instead of the above `fetch / rebase`. `git pull` does a merge, which leaves merge commits. These make the commit history messy and violate the principle that commits ought to be individually understandable and useful. - -## Commit & Push - -Commit and sign your changes: - -``` -git commit -m "my commit title" --signoff -``` - -You can go back and edit/build/test some more, then `commit --amend` in a few cycles. - -When ready, push your changes to your fork's repository: - -``` -git push --set-upstream my_fork my_feature_branch -``` - -## Open a Pull Request - -See [Github Docs](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork). - -### Get a code review - -Once your pull request has been opened it will be assigned to one or more reviewers, and will go through a series of smoke tests. - -Commit changes made in response to review comments should be added to the same branch on your fork. - -Very small PRs are easy to review. Very large PRs are very difficult to review. - -### Squashing Commits -Commits on your branch should represent meaningful milestones or units of work. -Small commits that contain typo fixes, rebases, review feedbacks, etc should be squashed. - -To do that, it's best to perform an [interactive rebase](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History): - -#### Example -If you PR has 3 commits, count backwards from your last commit using `HEAD~3`: -``` -git rebase -i HEAD~3 -``` -Output would be similar to this: -``` -pick f7f3f6d Changed some code -pick 310154e fixed some typos -pick a5f4a0d made some review changes - -# Rebase 710f0f8..a5f4a0d onto 710f0f8 -# -# Commands: -# p, pick = use commit -# r, reword = use commit, but edit the commit message -# e, edit = use commit, but stop for amending -# s, squash = use commit, but meld into previous commit -# f, fixup = like "squash", but discard this commit's log message -# x, exec = run command (the rest of the line) using shell -# b, break = stop here (continue rebase later with 'git rebase --continue') -# d, drop = remove commit -# l, label