q-shift / backstage-plugins

Apache License 2.0
3 stars 7 forks source link

Job to calculate the next version fails with errors #66

Closed cmoulliard closed 5 months ago

cmoulliard commented 5 months ago

TODO

Errors reported by the job are:

See: https://github.com/q-shift/backstage-plugins/actions/runs/8422399064/job/23061603148

Run echo "version=$(npm version patch --no-git-tag-version)" >> $GITHUB_OUTPUT

[1](https://github.com/q-shift/backstage-plugins/actions/runs/8422399064/job/23061603148#step:7:1)s
Run VERSION_EXISTS=$(yarn info -s --json @qshift/plugin-quarkus | jq --arg lib_version v1.0.1 '.data.versions | index($lib_version)')
  VERSION_EXISTS=$(yarn info -s --json @qshift/plugin-quarkus | jq --arg lib_version v1.0.1 '.data.versions | index($lib_version)')
  if [ $VERSION_EXISTS != "null" ]; then
    echo "::error ::Version $VERSION_EXISTS already exists."
    exit 1
  fi
  shell: /usr/bin/bash -e {0}
  env:
    TURBOGHA_PORT: 41230
    TURBO_API: http://localhost:41230
    TURBO_TOKEN: turbogha
    TURBO_TEAM: turbogha

0s
Run jq '.version = "v1.0.1"' package.json | sponge package.json
/home/runner/work/_temp/f182f502-324c-4[9](https://github.com/q-shift/backstage-plugins/actions/runs/8422399064/job/23061603148#step:7:9)7d-9f8e-30f6f4536257.sh: line [1](https://github.com/q-shift/backstage-plugins/actions/runs/8422399064/job/23061603148#step:8:1): sponge: command not found
Error: writing output failed: Broken pipe
Error: Process completed with exit code 1[2](https://github.com/q-shift/backstage-plugins/actions/runs/8422399064/job/23061603148#step:8:2)[7](https://github.com/q-shift/backstage-plugins/actions/runs/8422399064/job/23061603148#step:8:7).
cmoulliard commented 5 months ago

To fix the issue with the node package version, I suggest that we calculate the version using the package.json file of the first plugin workspace.

          echo "Current git branch is: $(git branch --show-current)"
          git pull
          echo "version=v$(npm pkg get version | tr -d '\"')" >> $GITHUB_OUTPUT

==>

          echo "Current git branch is: $(git branch --show-current)"
          git pull
          echo "version=v$(npm pkg get version -w @qshift/plugin-quarkus" >> $GITHUB_OUTPUT

This command will return

{
  "@qshift/plugin-quarkus": "0.1.27"
}

Remark: We could improve, in a separate PR, this job to release each plugin separately and to get for each plugin their version!

cmoulliard commented 5 months ago
  • line 1: sponge: command not found

That should be fixed using

- name: Install sponge tools
  run: sudo apt-get install -y moreutils
cmoulliard commented 5 months ago

Still another issue to be fixed and reported by the job: https://github.com/q-shift/backstage-plugins/actions/runs/8423330594/job/23064699796

Run echo "version=$(npm version patch -w @qshift/plugin-quarkus --no-git-tag-version)" >> $GITHUB_OUTPUT

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: rollup-plugin-dts@4.2.3
npm WARN Found: typescript@5.2.2
npm WARN node_modules/typescript
npm WARN   dev typescript@"~5.2.0" from the root project
npm WARN   7 more (eslint-plugin-deprecation, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer typescript@"^4.1" from rollup-plugin-dts@4.2.3
npm WARN node_modules/rollup-plugin-dts
npm WARN   rollup-plugin-dts@"^4.0.1" from @backstage/cli@0.25.2
npm WARN   node_modules/@backstage/cli
npm WARN 
npm WARN Conflicting peer dependency: typescript@4.[9](https://github.com/q-shift/backstage-plugins/actions/runs/8423330594/job/23064699796#step:8:9).5
npm WARN node_modules/typescript
npm WARN   peer typescript@"^4.1" from rollup-plugin-dts@4.2.3
npm WARN   node_modules/rollup-plugin-dts
npm WARN     rollup-plugin-dts@"^4.0.1" from @backstage/cli@0.[25](https://github.com/q-shift/backstage-plugins/actions/runs/8423330594/job/23064699796#step:8:26).2
npm WARN     node_modules/@backstage/cli

We can reproduce the issue locally

npm version patch -w @qshift/plugin-quarkus --no-git-tag-version
@qshift/plugin-quarkus
v0.1.28
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: rollup-plugin-dts@4.2.3
npm WARN Found: typescript@5.2.2
npm WARN node_modules/typescript
npm WARN   dev typescript@"~5.2.0" from the root project
npm WARN   7 more (eslint-plugin-deprecation, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer typescript@"^4.1" from rollup-plugin-dts@4.2.3
npm WARN node_modules/rollup-plugin-dts
npm WARN   rollup-plugin-dts@"^4.0.1" from @backstage/cli@0.25.2
npm WARN   node_modules/@backstage/cli
npm WARN 
npm WARN Conflicting peer dependency: typescript@4.9.5
npm WARN node_modules/typescript
npm WARN   peer typescript@"^4.1" from rollup-plugin-dts@4.2.3
npm WARN   node_modules/rollup-plugin-dts
npm WARN     rollup-plugin-dts@"^4.0.1" from @backstage/cli@0.25.2
npm WARN     node_modules/@backstage/cli

added 11 packages, removed 12 packages, and changed 5 packages in 4s

352 packages are looking for funding
  run `npm fund` for details

Note: I dont really understand why some packages were: added 11 packages, removed 12 packages, and changed 5 packages in 4s !

When we execute the command npm version ..., then package.json is updated

   "name": "@qshift/plugin-quarkus",
-  "version": "0.1.27",
+  "version": "0.1.28",

but a package-lock.json is created and by consequence yarn.lock is also changed :-(

diff --git a/plugins/quarkus/package.json b/plugins/quarkus/package.json
index c9ba338..12613b9 100644
--- a/plugins/quarkus/package.json
+++ b/plugins/quarkus/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@qshift/plugin-quarkus",
-  "version": "0.1.27",
+  "version": "0.1.28",
   "main": "src/index.ts",
   "types": "src/index.ts",
   "license": "Apache-2.0",
diff --git a/yarn.lock b/yarn.lock
index 62b3989..9f1146e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -9,7 +9,7 @@

 "@adobe/css-tools@^4.3.2":
   version "4.3.3"
-  resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.3.tgz#90749bde8b89cd41764224f5aac29cd4138f75ff"
+  resolved "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.3.tgz"
   integrity sha512-rE0Pygv0sEZ4vBWHlAgJLGDU7Pm8xoO6p3wsEceb7GYAjScrOHpEo8KK/eVkAcnSM+slAEtXjA2JpdjLp4fJQQ==

 "@ampproject/remapping@^2.2.0":
@@ -72,7 +72,7 @@
     "@aws-sdk/util-utf8-browser" "^3.0.0"
     tslib "^1.11.1"

-"@aws-crypto/sha256-js@3.0.0", "@aws-crypto/sha256-js@^3.0.0":

This is really weird !!

cmoulliard commented 5 months ago

Got another issue Error: Invalid format 'v0.1.28 with job: https://github.com/q-shift/backstage-plugins/actions/runs/8423885881/job/23066566934

Run echo "version=$(npm version patch -w @qshift/plugin-quarkus --no-workspaces-update --no-git-tag-version)" >> $GITHUB_OUTPUT
  echo "version=$(npm version patch -w @qshift/plugin-quarkus --no-workspaces-update --no-git-tag-version)" >> $GITHUB_OUTPUT
  shell: /usr/bin/bash -e {0}
  env:
    TURBOGHA_PORT: 41[2](https://github.com/q-shift/backstage-plugins/actions/runs/8423885881/job/23066566934#step:8:2)[3](https://github.com/q-shift/backstage-plugins/actions/runs/8423885881/job/23066566934#step:8:3)0
    TURBO_API: http://localhost:[4](https://github.com/q-shift/backstage-plugins/actions/runs/8423885881/job/23066566934#step:8:4)1230
    TURBO_TOKEN: turbogha
    TURBO_TEAM: turbogha

Error: Unable to process file command 'output' successfully.
Error: Invalid format 'v0.1.28'