-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(builders): release fails sometimes #599
Comments
I guess, one solution could be to use a |
Thanks @johannesschobel for your report and appreciation! The release process should account for dependencies work when executed sequentially from a GitHub workflow. Actually, @ng-easy/platform is released this way. You can check the CI and release workflows in this repo. Do you notice any outstanding differences? |
More questions:
I'll try to take a closer look tomorrow |
Dear @samuelfernandez , i - more or less - directly copied from this repository, because i found noticed that the lib is used to publish itself (which is really cool!) I noticed, that i used an outdated version (not sure how this one was installed via For now, i got it running via |
Here is a log file of a release that failed: Hope this helps |
I've checked the logs, true it looks weird. The logs show that it fails in the very first package being released, so the problem could be that between the moment of the checkout, and when the release happens, there is a change in master. From the logs it seems that it is not driven by the release process itself, could it be that code was merged in the meantime? Regarding the solution with a matrix, in theory it should not be related. From your logs it shows that the very first package failed, so the matrix should not make a difference, it just handles the dependencies. The release process should be smart enough to know which package is the first to be released. BTW, if you'd want to reduce the time of your npm setup you can give a try to @ng-easy/npm-setup, it caches the npm deps. |
Dear @samuelfernandez , sorry, for the delayed reply. yeah, that is what i noticed as well. The issue is, that after each release, the new version for the library is tagged and added as a commit. Therefore, the I have changed my Maybe you can take a look at this solution? |
That is by design, since for each library the builder relies completely on the semantic release process, so an intermediate commit is needed. I wonder why it works in some cases, and it fails in others. If there are no external factors, any change is pushed to the remote repo, so it should stay in sync. This is a normal workflow in semantic release, actually it is the way that The only change from the matrix approach is that on each step you get the fresh git fetch. I wonder if, prior to the execution of any plugin, the process should fetch latest changes. However it would be hard to repro now that you've moved to the matrix approach. Potential troubleshooting steps:
@johannesschobel would like to pursue that approach? The matrix solution works fine, it just has the issue of needing to maintain the order of release steps according to their dependencies, while the builder has already that logic embedded by using NX deps graph. And obviously the extra time to setup each run. Adding here for reference two issues that highlight how external commits during the release can break it, and also why concurrent releases are not supported semantic-release/semantic-release#993 |
Dear @samuelfernandez , i guess, tagging each lib after the release is the default behavior - and that also makes completely sense. As you have noticed, the issue does not always appear. For example, if had I also found out, when looking at your at the moment, i don't see any way around this issue, do you? Because the Would it help you to figure a proper solution, if i would provide a reproduction repository? All the best |
Not really. Other projects are released grouped with the new workspace release builder
Absolutely! I'll start working on adding some logging so that we are ready on that. Thanks for the nice collaboration @johannesschobel |
Dear @samuelfernandez , Can you please investigate and help me out with this? this is bothering me really, because i cannot be sure that all of my libs are properly published. In case of the matrix build, everything is "green" as well (see here): however, only one lib is properly published to npm: Unfortunately, this library ( Can you please take a look at the repo here and help me out? https://github.com/prisma-utils/prisma-utils |
What you describe goes more in line with my expectations, that the matrix workflow is not related to the issue. I'll investigate further in your repo |
Dear @samuelfernandez , thank you very much.. name: Release Project
on:
workflow_dispatch: # manual release
inputs:
project:
type: choice
description: Project to Release
options:
- prismerge
- nestjs-prisma
- request-parser
jobs:
npm:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- name: Fetch latest base branch
run: git fetch origin main
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Setup NPM
uses: ng-easy/npm-setup@v2
- name: Run Prisma Generate
run: npx prisma generate
- name: Build Package
run: npx nx run ${{ github.event.inputs.project }}:build
- name: Release Package
run: npx nx run ${{ github.event.inputs.project }}:release
env:
CI: true
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} In this setup, i use the On the plus-side it works as expected. On the down-side i need to manually trigger every project that i want to release. ew. |
Even though it requires manual action, I really like the approach of having more control. Depending on your library, you could have different release cadence. It's funny to see how problems trigger imaginative solutions 😛 I'm still planning on adding the logging and forced git pull before each project is released. I hope to address it this week, sorry that I didn't have time before. Thanks for the patience! |
For now, i am quite happy with this approach - lets see how it works in practice. I think, i like the idea of having the possibility to just release one particular library, and do not touch the others. What do you think: |
Sounds good! Happy that now it works |
## [9.0.8](https://github.com/ng-easy/platform/compare/@ng-easy/builders@9.0.7...@ng-easy/builders@9.0.8) (2022-07-16) ### ⬆️ Dependency Updates * ⬆️ update client tooling ([e83215d](e83215d)) ### 🐛 Bug Fixes * **builders:** ⬆️ update @ng-easy/image-config to 5.1.16 [skip ci] ([2f05495](2f05495)) * **builders:** ⬆️ update @ng-easy/image-optimizer to 5.1.16 [skip ci] ([7c5c27d](7c5c27d)) * **builders:** 🐛 fix getting remote commit ([#599](#599)) ([558f671](558f671)) * **builders:** 🐛 fix git command to get remote commit ([#621](#621)) ([e47aaf9](e47aaf9)) * **builders:** 🐛 fix import of execa since it is an ESM module ([#616](#616)) ([a938505](a938505)) * **builders:** 🔊 add logging for git issue ([#599](#599)) ([#615](#615)) ([418abc8](418abc8))
Additional logging added in this release https://github.com/ng-easy/platform/releases/tag/%40ng-easy%2Fbuilders%409.0.8 @johannesschobel can you please try to enable both flags and see if your workflows get fixed? Thanks! |
Dear @samuelfernandez ,
first of all, i would like to thank you for providing this awesome
semantic release
package fornrwl/nx
workspaces. i got it to work and it currently powers my release script that is hosted withinGitHub Actions
🥳However, i noticed, that the release step sometimes fails, especially, when multiple packages should be released at the same time (i.e., there are commits that are not released yet that affect multiple libs).
My
release.yml
file for GitHub Actions looks as follows:The
build
step builds the libsnestjs-prisma
,prismerge
andrequest-parser
in parallel. Afterwards, therelease
step releases each of themsequentially
(i.e., parallel = false).The configuration in the
project.json
file of each lib looks as follows:While it works, sometimes, the CI fails. I noticed, that this happens, when multiple packages should be released within one run of the release action. The error, i get in
GitHub Actions
is as follows:I think (!), the issue is, that the CI automatically generates a new commit for the release. The next run (for the next project), then cannot push again, because the local HEAD (i.e., that was retrieved in the GitHub Action release script) is already behind the main branch.
How can i fix this issue?!
All the best and thanks for your help!
The text was updated successfully, but these errors were encountered: