From 0b76e465c1bb81f3bff98e7fa767bf16ca40f5ff Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 08:26:17 +0100 Subject: [PATCH 01/35] Lock file maintenance (#3562) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | 🔧 This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration 📅 **Schedule**: Branch creation - "before 4am on Monday" (UTC), Automerge - "before 4am" (UTC). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/woodpecker-ci/woodpecker). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- docs/pnpm-lock.yaml | 74 ++++++++++++++-------------- web/pnpm-lock.yaml | 115 ++++++++++++++++++++++---------------------- 2 files changed, 95 insertions(+), 94 deletions(-) diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml index 4ffd8ec46..ef93a5fbf 100644 --- a/docs/pnpm-lock.yaml +++ b/docs/pnpm-lock.yaml @@ -20,13 +20,13 @@ importers: version: 3.1.1(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@docusaurus/preset-classic': specifier: ^3.1.0 - version: 3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3) + version: 3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3) '@easyops-cn/docusaurus-search-local': specifier: ^0.40.1 version: 0.40.1(@docusaurus/theme-common@3.1.1)(@docusaurus/types@3.1.1)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@mdx-js/react': specifier: ^3.0.0 - version: 3.0.1(@types/react@18.2.69)(react@18.2.0) + version: 3.0.1(@types/react@18.2.70)(react@18.2.0) '@svgr/webpack': specifier: ^8.1.0 version: 8.1.0(typescript@5.4.3) @@ -69,7 +69,7 @@ importers: version: 20.11.30 '@types/react': specifier: ^18.2.67 - version: 18.2.69 + version: 18.2.70 '@types/react-helmet': specifier: ^6.1.11 version: 6.1.11 @@ -100,7 +100,7 @@ importers: version: 3.1.1(react-dom@18.2.0)(react@18.2.0) '@docusaurus/theme-classic': specifier: ^3.0.0 - version: 3.1.1(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) + version: 3.1.1(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@docusaurus/types': specifier: ^3.0.0 version: 3.1.1(react-dom@18.2.0)(react@18.2.0) @@ -1481,7 +1481,7 @@ packages: resolution: {integrity: sha512-+sbxb71sWre+PwDK7X2T8+bhS6clcVMLwBPznX45Qu6opJcgRjAp7gYSDzVFp187J+feSj5dNBN1mJoi6ckkUQ==} dev: false - /@docsearch/react@3.6.0(@algolia/client-search@4.22.1)(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0): + /@docsearch/react@3.6.0(@algolia/client-search@4.22.1)(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0): resolution: {integrity: sha512-HUFut4ztcVNmqy9gp/wxNbC7pTOHhgVVkHVGCACTuLhUKUhKAF9KYHJtMiLUJxEqiFLQiuri1fWF8zqwM/cu1w==} peerDependencies: '@types/react': '>= 16.8.0 < 19.0.0' @@ -1501,7 +1501,7 @@ packages: '@algolia/autocomplete-core': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1)(search-insights@2.13.0) '@algolia/autocomplete-preset-algolia': 1.9.3(@algolia/client-search@4.22.1)(algoliasearch@4.22.1) '@docsearch/css': 3.6.0 - '@types/react': 18.2.69 + '@types/react': 18.2.70 algoliasearch: 4.22.1 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -1676,7 +1676,7 @@ packages: '@docusaurus/react-loadable': 5.5.2(react@18.2.0) '@docusaurus/types': 3.1.1(react-dom@18.2.0)(react@18.2.0) '@types/history': 4.7.11 - '@types/react': 18.2.69 + '@types/react': 18.2.70 '@types/react-router-config': 5.0.11 '@types/react-router-dom': 5.3.3 react: 18.2.0 @@ -1979,7 +1979,7 @@ packages: - webpack-cli dev: false - /@docusaurus/preset-classic@3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3): + /@docusaurus/preset-classic@3.1.1(@algolia/client-search@4.22.1)(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3): resolution: {integrity: sha512-jG4ys/hWYf69iaN/xOmF+3kjs4Nnz1Ay3CjFLDtYa8KdxbmUhArA9HmP26ru5N0wbVWhY+6kmpYhTJpez5wTyg==} engines: {node: '>=18.0'} peerDependencies: @@ -1995,9 +1995,9 @@ packages: '@docusaurus/plugin-google-gtag': 3.1.1(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@docusaurus/plugin-google-tag-manager': 3.1.1(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@docusaurus/plugin-sitemap': 3.1.1(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) - '@docusaurus/theme-classic': 3.1.1(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) + '@docusaurus/theme-classic': 3.1.1(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@docusaurus/theme-common': 3.1.1(@docusaurus/types@3.1.1)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) - '@docusaurus/theme-search-algolia': 3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3) + '@docusaurus/theme-search-algolia': 3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3) '@docusaurus/types': 3.1.1(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 react-dom: 18.2.0(react@18.2.0) @@ -2028,11 +2028,11 @@ packages: peerDependencies: react: '*' dependencies: - '@types/react': 18.2.69 + '@types/react': 18.2.70 prop-types: 15.8.1 react: 18.2.0 - /@docusaurus/theme-classic@3.1.1(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3): + /@docusaurus/theme-classic@3.1.1(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3): resolution: {integrity: sha512-GiPE/jbWM8Qv1A14lk6s9fhc0LhPEQ00eIczRO4QL2nAQJZXkjPG6zaVx+1cZxPFWbAsqSjKe2lqkwF3fGkQ7Q==} engines: {node: '>=18.0'} peerDependencies: @@ -2051,7 +2051,7 @@ packages: '@docusaurus/utils': 3.1.1(@docusaurus/types@3.1.1) '@docusaurus/utils-common': 3.1.1(@docusaurus/types@3.1.1) '@docusaurus/utils-validation': 3.1.1(@docusaurus/types@3.1.1) - '@mdx-js/react': 3.0.1(@types/react@18.2.69)(react@18.2.0) + '@mdx-js/react': 3.0.1(@types/react@18.2.70)(react@18.2.0) clsx: 2.1.0 copy-text-to-clipboard: 3.2.0 infima: 0.2.0-alpha.43 @@ -2100,7 +2100,7 @@ packages: '@docusaurus/utils': 3.1.1(@docusaurus/types@3.1.1) '@docusaurus/utils-common': 3.1.1(@docusaurus/types@3.1.1) '@types/history': 4.7.11 - '@types/react': 18.2.69 + '@types/react': 18.2.70 '@types/react-router-config': 5.0.11 clsx: 2.1.0 parse-numeric-range: 1.3.0 @@ -2128,14 +2128,14 @@ packages: - vue-template-compiler - webpack-cli - /@docusaurus/theme-search-algolia@3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3): + /@docusaurus/theme-search-algolia@3.1.1(@algolia/client-search@4.22.1)(@docusaurus/types@3.1.1)(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0)(typescript@5.4.3): resolution: {integrity: sha512-tBH9VY5EpRctVdaAhT+b1BY8y5dyHVZGFXyCHgTrvcXQy5CV4q7serEX7U3SveNT9zksmchPyct6i1sFDC4Z5g==} engines: {node: '>=18.0'} peerDependencies: react: ^18.0.0 react-dom: ^18.0.0 dependencies: - '@docsearch/react': 3.6.0(@algolia/client-search@4.22.1)(@types/react@18.2.69)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0) + '@docsearch/react': 3.6.0(@algolia/client-search@4.22.1)(@types/react@18.2.70)(react-dom@18.2.0)(react@18.2.0)(search-insights@2.13.0) '@docusaurus/core': 3.1.1(@docusaurus/types@3.1.1)(debug@4.3.4)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) '@docusaurus/logger': 3.1.1 '@docusaurus/plugin-content-docs': 3.1.1(debug@4.3.4)(react-dom@18.2.0)(react@18.2.0)(typescript@5.4.3) @@ -2195,7 +2195,7 @@ packages: dependencies: '@mdx-js/mdx': 3.0.1 '@types/history': 4.7.11 - '@types/react': 18.2.69 + '@types/react': 18.2.70 commander: 5.1.0 joi: 17.12.2 react: 18.2.0 @@ -2656,14 +2656,14 @@ packages: transitivePeerDependencies: - supports-color - /@mdx-js/react@3.0.1(@types/react@18.2.69)(react@18.2.0): + /@mdx-js/react@3.0.1(@types/react@18.2.70)(react@18.2.0): resolution: {integrity: sha512-9ZrPIU4MGf6et1m1ov3zKf+q9+deetI51zprKB1D/z3NOb+rUxxtEl3mCjW5wTGh6VhRdwPueh1oRzi6ezkA8A==} peerDependencies: '@types/react': '>=16' react: '>=16' dependencies: '@types/mdx': 2.0.12 - '@types/react': 18.2.69 + '@types/react': 18.2.70 react: 18.2.0 /@napi-rs/wasm-runtime@0.1.2: @@ -3406,31 +3406,31 @@ packages: /@types/react-helmet@6.1.11: resolution: {integrity: sha512-0QcdGLddTERotCXo3VFlUSWO3ztraw8nZ6e3zJSgG7apwV5xt+pJUS8ewPBqT4NYB1optGLprNQzFleIY84u/g==} dependencies: - '@types/react': 18.2.69 + '@types/react': 18.2.70 dev: true /@types/react-router-config@5.0.11: resolution: {integrity: sha512-WmSAg7WgqW7m4x8Mt4N6ZyKz0BubSj/2tVUMsAHp+Yd2AMwcSbeFq9WympT19p5heCFmF97R9eD5uUR/t4HEqw==} dependencies: '@types/history': 4.7.11 - '@types/react': 18.2.69 + '@types/react': 18.2.70 '@types/react-router': 5.1.20 /@types/react-router-dom@5.3.3: resolution: {integrity: sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==} dependencies: '@types/history': 4.7.11 - '@types/react': 18.2.69 + '@types/react': 18.2.70 '@types/react-router': 5.1.20 /@types/react-router@5.1.20: resolution: {integrity: sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==} dependencies: '@types/history': 4.7.11 - '@types/react': 18.2.69 + '@types/react': 18.2.70 - /@types/react@18.2.69: - resolution: {integrity: sha512-W1HOMUWY/1Yyw0ba5TkCV+oqynRjG7BnteBB+B7JmAK7iw3l2SW+VGOxL+akPweix6jk2NNJtyJKpn4TkpfK3Q==} + /@types/react@18.2.70: + resolution: {integrity: sha512-hjlM2hho2vqklPhopNkXkdkeq6Lv8WSZTpr7956zY+3WS5cfYUewtCzsJLsbW5dEv3lfSeQ4W14ZFeKC437JRQ==} dependencies: '@types/prop-types': 15.7.12 '@types/scheduler': 0.16.8 @@ -3963,7 +3963,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001600 - electron-to-chromium: 1.4.715 + electron-to-chromium: 1.4.717 node-releases: 2.0.14 update-browserslist-db: 1.0.13(browserslist@4.23.0) @@ -4926,8 +4926,8 @@ packages: /ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - /electron-to-chromium@1.4.715: - resolution: {integrity: sha512-XzWNH4ZSa9BwVUQSDorPWAUQ5WGuYz7zJUNpNif40zFCiCl20t8zgylmreNmn26h5kiyw2lg7RfTmeMBsDklqg==} + /electron-to-chromium@1.4.717: + resolution: {integrity: sha512-6Fmg8QkkumNOwuZ/5mIbMU9WI3H2fmn5ajcVya64I5Yr5CcNmO7vcLt0Y7c96DCiMO5/9G+4sI2r6eEvdg1F7A==} /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -4983,8 +4983,8 @@ packages: resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} - /es-module-lexer@1.4.2: - resolution: {integrity: sha512-7nOqkomXZEaxUDJw21XZNtRk739QvrPSoZoRtbsEfcii00vdzZUh6zh1CQwHhrib8MdEtJfv5rJiGeb4KuV/vw==} + /es-module-lexer@1.5.0: + resolution: {integrity: sha512-pqrTKmwEIgafsYZAGw9kszYzmagcE/n4dbgwGWLEXg7J4QFJVQRBld8j3Q3GNez79jzxZshq0bcT962QHOghjw==} /es6-promise@3.3.1: resolution: {integrity: sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==} @@ -4996,7 +4996,7 @@ packages: webpack: ^4.40.0 || ^5.0.0 dependencies: esbuild: 0.20.2 - get-tsconfig: 4.7.2 + get-tsconfig: 4.7.3 loader-utils: 2.0.4 webpack: 5.91.0 webpack-sources: 1.4.3 @@ -5163,8 +5163,8 @@ packages: signal-exit: 3.0.7 strip-final-newline: 2.0.0 - /express@4.19.1: - resolution: {integrity: sha512-K4w1/Bp7y8iSiVObmCrtq8Cs79XjJc/RU2YYkZQ7wpUu5ZyZ7MtPHkqoMz4pf+mgXfNvo2qft8D9OnrH2ABk9w==} + /express@4.19.2: + resolution: {integrity: sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==} engines: {node: '>= 0.10.0'} dependencies: accepts: 1.3.8 @@ -5469,8 +5469,8 @@ packages: resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} engines: {node: '>=10'} - /get-tsconfig@4.7.2: - resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} + /get-tsconfig@4.7.3: + resolution: {integrity: sha512-ZvkrzoUA0PQZM6fy6+/Hce561s+faD1rsNwhnO5FelNjyy7EMGJ3Rz1AQ8GYDWjhRs/7dBLOEJvhK8MiEJOAFg==} dependencies: resolve-pkg-maps: 1.0.0 dev: false @@ -9605,7 +9605,7 @@ packages: compression: 1.7.4 connect-history-api-fallback: 2.0.0 default-gateway: 6.0.3 - express: 4.19.1 + express: 4.19.2 graceful-fs: 4.2.11 html-entities: 2.5.2 http-proxy-middleware: 2.0.6(@types/express@4.17.21)(debug@4.3.4) @@ -9667,7 +9667,7 @@ packages: browserslist: 4.23.0 chrome-trace-event: 1.0.3 enhanced-resolve: 5.16.0 - es-module-lexer: 1.4.2 + es-module-lexer: 1.5.0 eslint-scope: 5.1.1 events: 3.3.0 glob-to-regexp: 0.4.1 diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index ae6b0eeac..454b89913 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -57,7 +57,7 @@ dependencies: devDependencies: '@iconify/json': specifier: ^2.2.171 - version: 2.2.195 + version: 2.2.196 '@types/lodash': specifier: ^4.14.202 version: 4.17.0 @@ -75,10 +75,10 @@ devDependencies: version: 7.5.8 '@typescript-eslint/eslint-plugin': specifier: ^7.0.0 - version: 7.3.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0)(typescript@5.4.2) + version: 7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.2) '@typescript-eslint/parser': specifier: ^7.0.0 - version: 7.3.1(eslint@8.57.0)(typescript@5.4.2) + version: 7.4.0(eslint@8.57.0)(typescript@5.4.2) '@vitejs/plugin-vue': specifier: ^5.0.3 version: 5.0.4(vite@5.2.6)(vue@3.4.21) @@ -93,13 +93,13 @@ devDependencies: version: 15.0.0(eslint-plugin-import@2.29.1)(eslint@8.57.0) eslint-config-airbnb-typescript: specifier: ^18.0.0 - version: 18.0.0(@typescript-eslint/eslint-plugin@7.3.1)(@typescript-eslint/parser@7.3.1)(eslint-plugin-import@2.29.1)(eslint@8.57.0) + version: 18.0.0(@typescript-eslint/eslint-plugin@7.4.0)(@typescript-eslint/parser@7.4.0)(eslint-plugin-import@2.29.1)(eslint@8.57.0) eslint-config-prettier: specifier: ^9.1.0 version: 9.1.0(eslint@8.57.0) eslint-plugin-import: specifier: ^2.29.1 - version: 2.29.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0) + version: 2.29.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0) eslint-plugin-prettier: specifier: ^5.1.3 version: 5.1.3(eslint-config-prettier@9.1.0)(eslint@8.57.0)(prettier@3.2.5) @@ -111,7 +111,7 @@ devDependencies: version: 12.0.0(eslint@8.57.0) eslint-plugin-vue: specifier: ^9.20.1 - version: 9.23.0(eslint@8.57.0) + version: 9.24.0(eslint@8.57.0) eslint-plugin-vue-scoped-css: specifier: ^2.7.2 version: 2.8.0(eslint@8.57.0)(vue-eslint-parser@9.4.2) @@ -639,8 +639,8 @@ packages: resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} dev: true - /@iconify/json@2.2.195: - resolution: {integrity: sha512-oDO79OGefkm/F4xeRDWSiigxsf7yMJAHRzyOoqmkrerUDJ/5JxRSsezUJhYlVarbRFdaBLGh7joJwtLO5mAmXw==} + /@iconify/json@2.2.196: + resolution: {integrity: sha512-hRZ0pq77N+mkAbZvFi/pfsKcspA8PyGSASc6zQoq6n/RSLxb8xAgORatVHyDl0ow7shcS+dvyiZI8xmr6yI2WA==} dependencies: '@iconify/types': 2.0.0 pathe: 1.1.2 @@ -969,8 +969,8 @@ packages: resolution: {integrity: sha512-g9gZnnXVq7gM7v3tJCWV/qw7w+KeOlSHAhgF9RytFyifW6AF61hdT2ucrYhPq9hLs5JIryeupHV3qGk95dH9ow==} dev: false - /@typescript-eslint/eslint-plugin@7.3.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw==} + /@typescript-eslint/eslint-plugin@7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-yHMQ/oFaM7HZdVrVm/M2WHaNPgyuJH4WelkSVEWSSsir34kxW2kDJCxlXRhhGWEsMN0WAW/vLpKfKVcm8k+MPw==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 @@ -981,11 +981,11 @@ packages: optional: true dependencies: '@eslint-community/regexpp': 4.10.0 - '@typescript-eslint/parser': 7.3.1(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/scope-manager': 7.3.1 - '@typescript-eslint/type-utils': 7.3.1(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/utils': 7.3.1(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/visitor-keys': 7.3.1 + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/scope-manager': 7.4.0 + '@typescript-eslint/type-utils': 7.4.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/utils': 7.4.0(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/visitor-keys': 7.4.0 debug: 4.3.4 eslint: 8.57.0 graphemer: 1.4.0 @@ -998,8 +998,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@7.3.1(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-Rq49+pq7viTRCH48XAbTA+wdLRrB/3sRq4Lpk0oGDm0VmnjBrAOVXH/Laalmwsv2VpekiEfVFwJYVk6/e8uvQw==} + /@typescript-eslint/parser@7.4.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-ZvKHxHLusweEUVwrGRXXUVzFgnWhigo4JurEj0dGF1tbcGh6buL+ejDdjxOQxv6ytcY1uhun1p2sm8iWStlgLQ==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1008,10 +1008,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 7.3.1 - '@typescript-eslint/types': 7.3.1 - '@typescript-eslint/typescript-estree': 7.3.1(typescript@5.4.2) - '@typescript-eslint/visitor-keys': 7.3.1 + '@typescript-eslint/scope-manager': 7.4.0 + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.2) + '@typescript-eslint/visitor-keys': 7.4.0 debug: 4.3.4 eslint: 8.57.0 typescript: 5.4.2 @@ -1019,16 +1019,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@7.3.1: - resolution: {integrity: sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag==} + /@typescript-eslint/scope-manager@7.4.0: + resolution: {integrity: sha512-68VqENG5HK27ypafqLVs8qO+RkNc7TezCduYrx8YJpXq2QGZ30vmNZGJJJC48+MVn4G2dCV8m5ZTVnzRexTVtw==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.3.1 - '@typescript-eslint/visitor-keys': 7.3.1 + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/visitor-keys': 7.4.0 dev: true - /@typescript-eslint/type-utils@7.3.1(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw==} + /@typescript-eslint/type-utils@7.4.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-247ETeHgr9WTRMqHbbQdzwzhuyaJ8dPTuyuUEMANqzMRB1rj/9qFIuIXK7l0FX9i9FXbHeBQl/4uz6mYuCE7Aw==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1037,8 +1037,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 7.3.1(typescript@5.4.2) - '@typescript-eslint/utils': 7.3.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.2) + '@typescript-eslint/utils': 7.4.0(eslint@8.57.0)(typescript@5.4.2) debug: 4.3.4 eslint: 8.57.0 ts-api-utils: 1.3.0(typescript@5.4.2) @@ -1047,13 +1047,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types@7.3.1: - resolution: {integrity: sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw==} + /@typescript-eslint/types@7.4.0: + resolution: {integrity: sha512-mjQopsbffzJskos5B4HmbsadSJQWaRK0UxqQ7GuNA9Ga4bEKeiO6b2DnB6cM6bpc8lemaPseh0H9B/wyg+J7rw==} engines: {node: ^18.18.0 || >=20.0.0} dev: true - /@typescript-eslint/typescript-estree@7.3.1(typescript@5.4.2): - resolution: {integrity: sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ==} + /@typescript-eslint/typescript-estree@7.4.0(typescript@5.4.2): + resolution: {integrity: sha512-A99j5AYoME/UBQ1ucEbbMEmGkN7SE0BvZFreSnTd1luq7yulcHdyGamZKizU7canpGDWGJ+Q6ZA9SyQobipePg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: typescript: '*' @@ -1061,8 +1061,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 7.3.1 - '@typescript-eslint/visitor-keys': 7.3.1 + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/visitor-keys': 7.4.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -1074,8 +1074,8 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@7.3.1(eslint@8.57.0)(typescript@5.4.2): - resolution: {integrity: sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ==} + /@typescript-eslint/utils@7.4.0(eslint@8.57.0)(typescript@5.4.2): + resolution: {integrity: sha512-NQt9QLM4Tt8qrlBVY9lkMYzfYtNz8/6qwZg8pI3cMGlPnj6mOpRxxAm7BMJN9K0AiY+1BwJ5lVC650YJqYOuNg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: eslint: ^8.56.0 @@ -1083,9 +1083,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.15 '@types/semver': 7.5.8 - '@typescript-eslint/scope-manager': 7.3.1 - '@typescript-eslint/types': 7.3.1 - '@typescript-eslint/typescript-estree': 7.3.1(typescript@5.4.2) + '@typescript-eslint/scope-manager': 7.4.0 + '@typescript-eslint/types': 7.4.0 + '@typescript-eslint/typescript-estree': 7.4.0(typescript@5.4.2) eslint: 8.57.0 semver: 7.6.0 transitivePeerDependencies: @@ -1093,11 +1093,11 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@7.3.1: - resolution: {integrity: sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw==} + /@typescript-eslint/visitor-keys@7.4.0: + resolution: {integrity: sha512-0zkC7YM0iX5Y41homUUeW1CHtZR01K3ybjM1l6QczoMuay0XKtrb93kv95AxUGwdjGr64nNqnOCwmEl616N8CA==} engines: {node: ^18.18.0 || >=20.0.0} dependencies: - '@typescript-eslint/types': 7.3.1 + '@typescript-eslint/types': 7.4.0 eslint-visitor-keys: 3.4.3 dev: true @@ -1453,7 +1453,7 @@ packages: hasBin: true dependencies: caniuse-lite: 1.0.30001600 - electron-to-chromium: 1.4.715 + electron-to-chromium: 1.4.717 node-releases: 2.0.14 update-browserslist-db: 1.0.13(browserslist@4.23.0) dev: true @@ -1760,8 +1760,8 @@ packages: domhandler: 5.0.3 dev: true - /electron-to-chromium@1.4.715: - resolution: {integrity: sha512-XzWNH4ZSa9BwVUQSDorPWAUQ5WGuYz7zJUNpNif40zFCiCl20t8zgylmreNmn26h5kiyw2lg7RfTmeMBsDklqg==} + /electron-to-chromium@1.4.717: + resolution: {integrity: sha512-6Fmg8QkkumNOwuZ/5mIbMU9WI3H2fmn5ajcVya64I5Yr5CcNmO7vcLt0Y7c96DCiMO5/9G+4sI2r6eEvdg1F7A==} dev: true /emoji-regex@8.0.0: @@ -1947,21 +1947,21 @@ packages: dependencies: confusing-browser-globals: 1.0.11 eslint: 8.57.0 - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0) + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0) object.assign: 4.1.5 object.entries: 1.1.8 semver: 7.6.0 dev: true - /eslint-config-airbnb-typescript@18.0.0(@typescript-eslint/eslint-plugin@7.3.1)(@typescript-eslint/parser@7.3.1)(eslint-plugin-import@2.29.1)(eslint@8.57.0): + /eslint-config-airbnb-typescript@18.0.0(@typescript-eslint/eslint-plugin@7.4.0)(@typescript-eslint/parser@7.4.0)(eslint-plugin-import@2.29.1)(eslint@8.57.0): resolution: {integrity: sha512-oc+Lxzgzsu8FQyFVa4QFaVKiitTYiiW3frB9KYW5OWdPrqFc7FzxgB20hP4cHMlr+MBzGcLl3jnCOVOydL9mIg==} peerDependencies: '@typescript-eslint/eslint-plugin': ^7.0.0 '@typescript-eslint/parser': ^7.0.0 eslint: ^8.56.0 dependencies: - '@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0)(typescript@5.4.2) - '@typescript-eslint/parser': 7.3.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/eslint-plugin': 7.4.0(@typescript-eslint/parser@7.4.0)(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.2) eslint: 8.57.0 eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.29.1)(eslint@8.57.0) transitivePeerDependencies: @@ -1987,7 +1987,7 @@ packages: - supports-color dev: true - /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.3.1)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): + /eslint-module-utils@2.8.1(@typescript-eslint/parser@7.4.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0): resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} engines: {node: '>=4'} peerDependencies: @@ -2008,7 +2008,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 7.3.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.2) debug: 3.2.7 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 @@ -2016,7 +2016,7 @@ packages: - supports-color dev: true - /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.3.1)(eslint@8.57.0): + /eslint-plugin-import@2.29.1(@typescript-eslint/parser@7.4.0)(eslint@8.57.0): resolution: {integrity: sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==} engines: {node: '>=4'} peerDependencies: @@ -2026,7 +2026,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 7.3.1(eslint@8.57.0)(typescript@5.4.2) + '@typescript-eslint/parser': 7.4.0(eslint@8.57.0)(typescript@5.4.2) array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 array.prototype.flat: 1.3.2 @@ -2035,7 +2035,7 @@ packages: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.3.1)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@7.4.0)(eslint-import-resolver-node@0.3.9)(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.13.1 is-glob: 4.0.3 @@ -2110,14 +2110,15 @@ packages: - supports-color dev: true - /eslint-plugin-vue@9.23.0(eslint@8.57.0): - resolution: {integrity: sha512-Bqd/b7hGYGrlV+wP/g77tjyFmp81lh5TMw0be9093X02SyelxRRfCI6/IsGq/J7Um0YwB9s0Ry0wlFyjPdmtUw==} + /eslint-plugin-vue@9.24.0(eslint@8.57.0): + resolution: {integrity: sha512-9SkJMvF8NGMT9aQCwFc5rj8Wo1XWSMSHk36i7ZwdI614BU7sIOR28ZjuFPKp8YGymZN12BSEbiSwa7qikp+PBw==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.2.0 || ^7.0.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) eslint: 8.57.0 + globals: 13.24.0 natural-compare: 1.4.0 nth-check: 2.1.1 postcss-selector-parser: 6.0.16 From c2a84645125196e458f570bed414c4cfff1d29a6 Mon Sep 17 00:00:00 2001 From: Anbraten <6918444+anbraten@users.noreply.github.com> Date: Thu, 28 Mar 2024 10:36:39 +0100 Subject: [PATCH 02/35] Fix cli version comparison and improve setup command (#3518) --- cli/common/hooks.go | 4 +- cli/setup/setup.go | 9 ++++- cli/setup/token_fetcher.go | 15 ++++++++ cli/setup/ui/ask.go | 79 +++++++------------------------------- cli/setup/ui/confirm.go | 68 ++++---------------------------- cli/update/types.go | 15 ++++---- cli/update/updater.go | 47 ++++++++++++----------- cli/update/updater_test.go | 61 +++++++++++++++++++++++++++++ go.mod | 9 +++-- go.sum | 10 ++++- web/src/views/cli/Auth.vue | 3 +- 11 files changed, 155 insertions(+), 165 deletions(-) create mode 100644 cli/update/updater_test.go diff --git a/cli/common/hooks.go b/cli/common/hooks.go index 5ff2a1242..5febcfa13 100644 --- a/cli/common/hooks.go +++ b/cli/common/hooks.go @@ -37,7 +37,7 @@ func Before(c *cli.Context) error { log.Debug().Msg("Checking for updates ...") - newVersion, err := update.CheckForUpdate(waitForUpdateCheck, true) + newVersion, err := update.CheckForUpdate(waitForUpdateCheck, false) if err != nil { log.Error().Err(err).Msgf("Failed to check for updates") return @@ -58,7 +58,7 @@ func After(_ *cli.Context) error { select { case <-waitForUpdateCheck.Done(): // When the actual command already finished, we still wait 250ms for the update check to finish - case <-time.After(time.Millisecond * 250): + case <-time.After(time.Millisecond * 500): log.Debug().Msg("Update check stopped due to timeout") cancelWaitForUpdate(errors.New("update check timeout")) } diff --git a/cli/setup/setup.go b/cli/setup/setup.go index b114cf750..bdacd0127 100644 --- a/cli/setup/setup.go +++ b/cli/setup/setup.go @@ -13,8 +13,10 @@ import ( // Command exports the setup command. var Command = &cli.Command{ - Name: "setup", - Usage: "setup the woodpecker-cli for the first time", + Name: "setup", + Usage: "setup the woodpecker-cli for the first time", + Args: true, + ArgsUsage: "[server-url]", Flags: []cli.Flag{ &cli.StringFlag{ Name: "server-url", @@ -45,6 +47,9 @@ func setup(c *cli.Context) error { } serverURL := c.String("server-url") + if serverURL == "" { + serverURL = c.Args().First() + } if serverURL == "" { serverURL, err = ui.Ask("Enter the URL of the woodpecker server", "https://ci.woodpecker-ci.org", true) diff --git a/cli/setup/token_fetcher.go b/cli/setup/token_fetcher.go index e96772cac..59be6b08d 100644 --- a/cli/setup/token_fetcher.go +++ b/cli/setup/token_fetcher.go @@ -10,6 +10,7 @@ import ( "runtime" "time" + "github.com/charmbracelet/huh/spinner" "github.com/gin-gonic/gin" "github.com/rs/zerolog/log" ) @@ -37,13 +38,27 @@ func receiveTokenFromUI(c context.Context, serverURL string) (string, error) { return "", err } + spinnerCtx, spinnerDone := context.WithCancelCause(c) + go func() { + err = spinner.New(). + Title("Waiting for token ..."). + Context(spinnerCtx). + Run() + if err != nil { + return + } + }() + // wait for token to be received or timeout select { case token := <-tokenReceived: + spinnerDone(nil) return token, nil case <-c.Done(): + spinnerDone(nil) return "", c.Err() case <-time.After(5 * time.Minute): + spinnerDone(nil) return "", errors.New("timed out waiting for token") } } diff --git a/cli/setup/ui/ask.go b/cli/setup/ui/ask.go index 2fa8c539e..eea4b2b00 100644 --- a/cli/setup/ui/ask.go +++ b/cli/setup/ui/ask.go @@ -1,79 +1,26 @@ package ui import ( - "fmt" + "errors" "strings" - "github.com/charmbracelet/bubbles/textinput" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/huh" ) -type askModel struct { - prompt string - required bool - textInput textinput.Model - err error -} - -func (m askModel) Init() tea.Cmd { - return textinput.Blink -} - -func (m askModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - var cmd tea.Cmd - - switch msg := msg.(type) { - case tea.KeyMsg: - switch msg.Type { - case tea.KeyEnter: - if !m.required || (m.required && strings.TrimSpace(m.textInput.Value()) != "") { - return m, tea.Quit - } - case tea.KeyCtrlC, tea.KeyEsc: - return m, tea.Quit - } - default: - return m, cmd - } - - m.textInput, cmd = m.textInput.Update(msg) - return m, cmd -} - -func (m askModel) View() string { - return fmt.Sprintf( - "%s\n\n%s\n\n%s", - m.prompt, - m.textInput.View(), - "(esc to quit)", - ) + "\n" -} - func Ask(prompt, placeholder string, required bool) (string, error) { - ti := textinput.New() - ti.Placeholder = placeholder - ti.Focus() - ti.CharLimit = 156 - ti.Width = 40 - - p := tea.NewProgram(askModel{ - prompt: prompt, - textInput: ti, - required: required, - err: nil, - }) - - _m, err := p.Run() + var input string + err := huh.NewInput(). + Title(prompt). + Value(&input). + Placeholder(placeholder).Validate(func(s string) error { + if required && strings.TrimSpace(s) == "" { + return errors.New("required") + } + return nil + }).Run() if err != nil { return "", err } - m, ok := _m.(askModel) - if !ok { - return "", fmt.Errorf("unexpected model: %T", _m) - } - - text := strings.TrimSpace(m.textInput.Value()) - - return text, nil + return strings.TrimSpace(input), nil } diff --git a/cli/setup/ui/confirm.go b/cli/setup/ui/confirm.go index 350fdb2e4..1a7dfa494 100644 --- a/cli/setup/ui/confirm.go +++ b/cli/setup/ui/confirm.go @@ -1,71 +1,19 @@ package ui import ( - "fmt" - - "github.com/charmbracelet/bubbles/textinput" - tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/huh" ) -type confirmModel struct { - confirmed bool - prompt string - err error -} - -func (m confirmModel) Init() tea.Cmd { - return textinput.Blink -} - -func (m confirmModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - var cmd tea.Cmd - - switch msg := msg.(type) { - case tea.KeyMsg: - if msg.Runes != nil { - switch msg.Runes[0] { - case 'y': - m.confirmed = true - return m, tea.Quit - case 'n': - m.confirmed = false - return m, tea.Quit - } - } - - switch msg.Type { - case tea.KeyCtrlC, tea.KeyEsc: - return m, tea.Quit - } - default: - return m, nil - } - - return m, cmd -} - -func (m confirmModel) View() string { - return fmt.Sprintf( - "%s y / n (esc to quit)", - m.prompt, - ) + "\n" -} - func Confirm(prompt string) (bool, error) { - p := tea.NewProgram(confirmModel{ - prompt: prompt, - err: nil, - }) - - _m, err := p.Run() + var confirm bool + err := huh.NewConfirm(). + Title(prompt). + Affirmative("Yes!"). + Negative("No."). + Value(&confirm).Run() if err != nil { return false, err } - m, ok := _m.(confirmModel) - if !ok { - return false, fmt.Errorf("unexpected model: %T", _m) - } - - return m.confirmed, nil + return confirm, err } diff --git a/cli/update/types.go b/cli/update/types.go index 35ae99181..7f2bf6b77 100644 --- a/cli/update/types.go +++ b/cli/update/types.go @@ -1,11 +1,9 @@ package update -type GithubRelease struct { - TagName string `json:"tag_name"` - Assets []struct { - Name string `json:"name"` - BrowserDownloadURL string `json:"browser_download_url"` - } `json:"assets"` +type VersionData struct { + Latest string `json:"latest"` + Next string `json:"next"` + RC string `json:"rc"` } type NewVersion struct { @@ -13,4 +11,7 @@ type NewVersion struct { AssetURL string } -const githubReleaseURL = "https://api.github.com/repos/woodpecker-ci/woodpecker/releases/latest" +const ( + woodpeckerVersionURL = "https://woodpecker-ci.org/version.json" + githubBinaryURL = "https://github.com/woodpecker-ci/woodpecker/releases/download/v%s/woodpecker-cli_%s_%s.tar.gz" +) diff --git a/cli/update/updater.go b/cli/update/updater.go index dce5b5d1c..41d6eb3b8 100644 --- a/cli/update/updater.go +++ b/cli/update/updater.go @@ -10,6 +10,7 @@ import ( "os" "path" "runtime" + "strings" "github.com/rs/zerolog/log" @@ -17,14 +18,18 @@ import ( ) func CheckForUpdate(ctx context.Context, force bool) (*NewVersion, error) { + return checkForUpdate(ctx, woodpeckerVersionURL, force) +} + +func checkForUpdate(ctx context.Context, versionURL string, force bool) (*NewVersion, error) { log.Debug().Msgf("Current version: %s", version.String()) - if version.String() == "dev" && !force { - log.Debug().Msgf("Skipping update check for development version") + if (version.String() == "dev" || strings.HasPrefix(version.String(), "next-")) && !force { + log.Debug().Msgf("Skipping update check for development & next versions") return nil, nil } - req, err := http.NewRequestWithContext(ctx, "GET", githubReleaseURL, nil) + req, err := http.NewRequestWithContext(ctx, "GET", versionURL, nil) if err != nil { return nil, err } @@ -39,34 +44,32 @@ func CheckForUpdate(ctx context.Context, force bool) (*NewVersion, error) { return nil, errors.New("failed to fetch the latest release") } - var release GithubRelease - if err := json.NewDecoder(resp.Body).Decode(&release); err != nil { + var versionData VersionData + if err := json.NewDecoder(resp.Body).Decode(&versionData); err != nil { return nil, err } + upstreamVersion := versionData.Latest + if strings.HasPrefix(version.String(), "next-") { + upstreamVersion = versionData.Next + } else if strings.HasSuffix(version.String(), "rc-") { + upstreamVersion = versionData.RC + } + + installedVersion := strings.TrimPrefix(version.Version, "v") + upstreamVersion = strings.TrimPrefix(upstreamVersion, "v") + // using the latest release - if release.TagName == version.String() && !force { + if installedVersion == upstreamVersion && !force { + log.Debug().Msgf("No new version available") return nil, nil } - log.Debug().Msgf("Latest version: %s", release.TagName) - - assetURL := "" - fileName := fmt.Sprintf("woodpecker-cli_%s_%s.tar.gz", runtime.GOOS, runtime.GOARCH) - for _, asset := range release.Assets { - if fileName == asset.Name { - assetURL = asset.BrowserDownloadURL - log.Debug().Msgf("Found asset for the current OS and arch: %s", assetURL) - break - } - } - - if assetURL == "" { - return nil, errors.New("no asset found for the current OS") - } + log.Debug().Msgf("New version available: %s", upstreamVersion) + assetURL := fmt.Sprintf(githubBinaryURL, upstreamVersion, runtime.GOOS, runtime.GOARCH) return &NewVersion{ - Version: release.TagName, + Version: upstreamVersion, AssetURL: assetURL, }, nil } diff --git a/cli/update/updater_test.go b/cli/update/updater_test.go new file mode 100644 index 000000000..a2855ac8e --- /dev/null +++ b/cli/update/updater_test.go @@ -0,0 +1,61 @@ +package update + +import ( + "context" + "io" + "net/http" + "net/http/httptest" + "os" + "testing" + + "go.woodpecker-ci.org/woodpecker/v2/version" +) + +func TestCheckForUpdate(t *testing.T) { + version.Version = "1.0.0" + fixtureHandler := func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/version.json" { + http.NotFound(w, r) + return + } + + _, _ = io.WriteString(w, `{"latest": "1.0.1", "next": "1.0.2", "rc": "1.0.3"}`) + } + ts := httptest.NewServer(http.HandlerFunc(fixtureHandler)) + defer ts.Close() + + newVersion, err := checkForUpdate(context.Background(), ts.URL+"/version.json", false) + if err != nil { + t.Fatalf("Failed to check for updates: %v", err) + } + + if newVersion == nil || newVersion.Version != "1.0.1" { + t.Fatalf("Expected a new version 1.0.1, got: %s", newVersion) + } +} + +func TestDownloadNewVersion(t *testing.T) { + downloadFilePath := "/woodpecker-cli_linux_amd64.tar.gz" + + fixtureHandler := func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != downloadFilePath { + http.NotFound(w, r) + return + } + + _, _ = io.WriteString(w, `blob`) + } + ts := httptest.NewServer(http.HandlerFunc(fixtureHandler)) + defer ts.Close() + + file, err := downloadNewVersion(context.Background(), ts.URL+downloadFilePath) + if err != nil { + t.Fatalf("Failed to download new version: %v", err) + } + + if file == "" { + t.Fatalf("Expected a file path, got: %s", file) + } + + _ = os.Remove(file) +} diff --git a/go.mod b/go.mod index cb7e010d0..2d7056dd1 100644 --- a/go.mod +++ b/go.mod @@ -12,8 +12,8 @@ require ( github.com/bmatcuk/doublestar/v4 v4.6.1 github.com/caddyserver/certmagic v0.20.0 github.com/cenkalti/backoff/v4 v4.2.1 - github.com/charmbracelet/bubbles v0.18.0 - github.com/charmbracelet/bubbletea v0.25.0 + github.com/charmbracelet/huh v0.3.0 + github.com/charmbracelet/huh/spinner v0.0.0-20240306161957-71f31c155b08 github.com/distribution/reference v0.5.0 github.com/docker/cli v24.0.9+incompatible github.com/docker/docker v24.0.9+incompatible @@ -81,7 +81,10 @@ require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bytedance/sonic v1.10.2 // indirect + github.com/catppuccin/go v0.2.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/charmbracelet/bubbles v0.18.0 // indirect + github.com/charmbracelet/bubbletea v0.25.0 // indirect github.com/charmbracelet/lipgloss v0.9.1 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect @@ -137,7 +140,7 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/morikuni/aec v1.0.0 // indirect - github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect + github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect diff --git a/go.sum b/go.sum index 6edbfdcb3..27e1b5e43 100644 --- a/go.sum +++ b/go.sum @@ -40,6 +40,8 @@ github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZF github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4= github.com/caddyserver/certmagic v0.20.0 h1:bTw7LcEZAh9ucYCRXyCpIrSAGplplI0vGYJ4BpCQ/Fc= github.com/caddyserver/certmagic v0.20.0/go.mod h1:N4sXgpICQUskEWpj7zVzvWD41p3NYacrNoZYiRM2jTg= +github.com/catppuccin/go v0.2.0 h1:ktBeIrIP42b/8FGiScP9sgrWOss3lw0Z5SktRoithGA= +github.com/catppuccin/go v0.2.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= @@ -48,6 +50,10 @@ github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/ github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw= github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM= github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg= +github.com/charmbracelet/huh v0.3.0 h1:CxPplWkgW2yUTDDG0Z4S5HH8SJOosWHd4LxCvi0XsKE= +github.com/charmbracelet/huh v0.3.0/go.mod h1:fujUdKX8tC45CCSaRQdw789O6uaCRwx8l2NDyKfC4jA= +github.com/charmbracelet/huh/spinner v0.0.0-20240306161957-71f31c155b08 h1:kO5eMMxyCJ6m7gdpGQ7OomrMdfsKVPgC4aB/focl/HE= +github.com/charmbracelet/huh/spinner v0.0.0-20240306161957-71f31c155b08/go.mod h1:nrBG0YEHaxdbqHXW1xvG1hPqkuac9Eg7RTMvogiXuz0= github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg= github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= @@ -345,8 +351,8 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= -github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= -github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= +github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= diff --git a/web/src/views/cli/Auth.vue b/web/src/views/cli/Auth.vue index fd5b1c793..bc4da4648 100644 --- a/web/src/views/cli/Auth.vue +++ b/web/src/views/cli/Auth.vue @@ -1,7 +1,7 @@