pluralith-cli icon indicating copy to clipboard operation
pluralith-cli copied to clipboard

Never ending Github Actions

Open pcartas opened this issue 2 years ago • 27 comments

Hi! im using Pluralith with the CI/CD integration for Github Actions, with my personal account. I dont know if it its a billed feature When the job runs this it never finish

    - name: Pluralith Init
      uses: Pluralith/actions/[email protected]
      with:
        terraform-path: ${{env.TF_ACTION_WORKING_DIR}}
        api-key: ${{ secrets.PLURALITH_API_KEY }}
        project-id: ${{ secrets.PLURALITH_PROJECT_ID }}

image and when i stop the job seems like it was expecting for "Org Id" input

pcartas avatar Nov 15 '22 19:11 pcartas

Hi @pcartas thanks for reporting!

We recently released a new version of the CLI that introduced some changes on the init command.

We're currently in the process of updating the GitHub actions to work with the new init command.

Admittedly, we should've updated the actions simultaneously, sorry for the disruption!

We'll push a new release for the GitHub actions that fixes the problem tomorrow, I'll report back here once it's available 👍

DanThePutzer avatar Nov 15 '22 19:11 DanThePutzer

@pcartas the new actions are out and you should be ready to roll!

Please make sure to update to v1.3.0 of our actions and check out the docs. There have been a few small changes. You now need to pass in an org ID and a project ID. There are a few ways to set this up, they are outlined here in point no. 3.

In your case, if you want to keep passing parameters directly inside the action, the new snipped would look something like this (don't forget to set PLURALITH_ORG_ID in your action secret settings):

    - name: Pluralith Init
      uses: Pluralith/actions/[email protected]
      with:
        terraform-path: ${{env.TF_ACTION_WORKING_DIR}}
        api-key: ${{ secrets.PLURALITH_API_KEY }}
        org-id: ${{ secrets.PLURALITH_ORG_ID }}
        project-id: ${{ secrets.PLURALITH_PROJECT_ID }}

It worked great while testing on my end, but let me know if you run into any issues!

DanThePutzer avatar Nov 16 '22 13:11 DanThePutzer

How long does this part usually take? image i made a big refactor, there are many changes

pcartas avatar Nov 16 '22 19:11 pcartas

It actually shouldn't take that long! So I'm assuming something is off

Before the refactor did it usually run in reasonable time?

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

is the first time im using Pluralith so i dont know :(

pcartas avatar Nov 16 '22 19:11 pcartas

Gotcha!

Then I'm assuming its an issue on our end. Is the project a large/complex one?

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

i guess is a mid size project, it has 4 vpc/clusters/load_balancers and 3 microservices for now, we are migrating to terraform and im doing the initial devops of the project, im also new at terraform, i can show you the github action/job if you need

pcartas avatar Nov 16 '22 19:11 pcartas

Hm ok thanks for the info! I'm thinking this might be an issue with our graphing algorithm getting caught in some loop.

Do you have the chance to run pluralith locally and see if you get a diagram there?

You can simply download our desktop app here, should be super quick to get installed, simply hit the download button here: https://docs.pluralith.com/docs/get-started/run-locally

After that you could run pluralith plan in your terraform project. If it takes a very long time there as well, then its a graphing issue for sure!

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

Apologies for the inconvenience btw, we really appreciate the help in debugging! :+1:

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

thanx for the support! and for the patience image the file downloaded is extensionless, how do i install it? im using ubuntu 20.04 and chrome 107.0.5304.87

pcartas avatar Nov 16 '22 19:11 pcartas

Ah yes, our Linux setup is still a bit weird, we have to change that!

It is actually a command line executable. So if you open a terminal, run chmod +x on the file and then just run it as if it was a bash script (simply ./pluralith_linux_installer_amd64_0.1.1) then it should install and the desktop app should open automatically.

If it doesn't open automatically (we've had some issues with that before) simply open the AppImage manually at ~/Pluralith/bin/Pluralith.AppImage

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

image image i guess a confirmation button must appear in the UI

pcartas avatar Nov 16 '22 19:11 pcartas

Ok I'm assuming it stays stuck on the "Generating Diagram" screen right?

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

yes

pcartas avatar Nov 16 '22 19:11 pcartas

Ok then it is definitely a graphing problem, meaning the action itself should be fine!

Now to debug our graphing algorithm we built a dedicated command into our CLI that completely anonymises your plan state and strips out all secrets. Would you be up for running pluralith strip in the same terraform project you just ran pluralith plan in and sharing the stripped and hashed plan state? The file we'd be interested in is in your terraform project in .pluralith/pluralith.state.hashed. Feel free to look over it before to make sure it's all hashed and anonymised!

If you'd send the file to my man @PhiWeber he's the one working on the graphing algorithm and this would be super helpful for him to debug. His email is: [email protected]

DanThePutzer avatar Nov 16 '22 19:11 DanThePutzer

Sended!

pcartas avatar Nov 16 '22 20:11 pcartas

Awesome thanks a lot! We'll report back here when we found something!

DanThePutzer avatar Nov 16 '22 20:11 DanThePutzer

Haven't seen that happen on macOS or Windows lately, I think it must be a Linux-specific bug. I'll dig into it!

We really appreciate the help! 👍

DanThePutzer avatar Nov 16 '22 20:11 DanThePutzer

Btw, which Linux distro are you running?

DanThePutzer avatar Nov 16 '22 20:11 DanThePutzer

image if it helps, i tried colsing the UI and running pluralith plan, this error appears when it tries to open the UI after that it never release the lock and i have force-unlock im using ubuntu Ubuntu 20.04.5 LTS (ubuntu focal)

pcartas avatar Nov 16 '22 20:11 pcartas

i guess github actions now are using ubuntu 22.04

pcartas avatar Nov 16 '22 20:11 pcartas

Yeah I think because you never actually get to the step where the UI draws the diagram, it never sends the signal to the CLI to confirm or cancel the apply (depending on what you would choose in the UI, the prompt to do this only become available after the graph shows up), so the CLI never tells Terraform to terminate. With remote state that means Terraform doesn't get to let go of the lock.

We need to build a fail-safe into the CLI so terraform can terminate properly to avoid the locking issue!

That's actually great input, gotta fix that up, thanks a lot!

DanThePutzer avatar Nov 16 '22 20:11 DanThePutzer

thnx to you! this tool seems very useful, here we are just starting with IaC and a visual tool is a big step to "evangelize" the rest of the team, when they see their own changes graphed they will freak out

pcartas avatar Nov 16 '22 20:11 pcartas

Yes that's exactly the idea behind the product, let people see what they are working with and at the same time always have updated documentation so you never need to draw and maintain it manually 👍

Glad you like where the tool is going! We're still early, so lots of work to do to improve things, but bug reports and feedback like yours help a lot! 🚀

DanThePutzer avatar Nov 16 '22 20:11 DanThePutzer

@pcartas we've made some good progress debugging the project so far. I have a question regarding the plan: is this a pre-apply plan? By that I mean you haven't run terraform apply yet and the infrastructure hasn't been deployed. It would be very helpful if you could create a post-apply plan (first run terraform apply and then run pluralith plan) and send me the hashed plan (run pluralith strip again). Thank you!

PhiWeber avatar Nov 30 '22 08:11 PhiWeber

@PhiWeber Hi! i've made a lot of changes too. Indeed its a pre-apply plan, i've send you the pre-apply plan because the action is a PR action (so the changes are not aproved yet, so there arent applied). I can send you the actual post-apply plan (which is a bit diferent of the previous one)

pcartas avatar Dec 01 '22 12:12 pcartas

@pcartas would be awesome if you could send the pluralith strip-ed post-apply plan to Phi again ([email protected]) 👍

Edit: Phi just told me you already sent it haha, nevermind and thanks!

DanThePutzer avatar Dec 01 '22 13:12 DanThePutzer