Skip to content
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?] Build step throws error requesting that the updated workflow file be committed despite this already having been done #374

Open
SolP-Aleios opened this issue Oct 14, 2022 · 9 comments

Comments

@SolP-Aleios
Copy link

When running my workflow I'm currently receiving the following error:

Screenshot 2022-10-14 at 12 24 26

Prior to this step I changed to the workflows directory shown in the error and ran 'ls' to verify that the deploy.yml file is present, which it is.

Screenshot 2022-10-14 at 12 28 09

Looking at where this error is thrown in pipeline.ts, shown above, this leads me to believe that "this.workflowFile.toYaml()" is somehow different to "readFileSync(this.workflowPath, 'utf8')".

Any idea what the cause of this might be?

@kaizencc
Copy link
Contributor

Hi @SolP-Aleios! Uh oh, lets get to the bottom of this.

  • Is the error happening locally or in github actions? it better not be happening locally...
  • what version of cdk-pipelines-github are you using, both locally and on github actions?

My shot in the dark: is it possible that you have a dependency on cdk-pipelines-github that allows github actions to grab the latest, while locally you are not on the latest? We just added a generated comment to the top of the deploy.yml file, and it's possible that your local env doesn't have the latest version while github action does.

@SolP-Aleios
Copy link
Author

SolP-Aleios commented Oct 14, 2022

Hi @kaizencc, thanks for the quick response!

  • This error is happening in github actions.
  • I was running an older version of cdk pipelines github but have now updated to the latest and verified that it is being used in Github Actions. Unfortunately the issue persists.

Could the issue possibly be to do with how I am passing in the workflowPath? This is how it's written currently:

workflowPath: join(__dirname, '../../../.github/workflows/deploy.yml'),

The deploy.yml generates locally correctly when I run 'cdk synth' though which makes me think it may be a problem elsewhere.

@kaizencc
Copy link
Contributor

@SolP-Aleios Did this work before, and suddenly stop working? Or never worked?

You should be able to print pipeline.workflowFile.toYaml() on your own to see what the result of that call is. And then compare it to the deploy.yml you have locally.

You can also omit workflowPath entirely, since you are using the default path anyway, and see if that solves the problem. I don't think what you have shouldn't work, so if using the default workflow path fixes the issue then I have to dive deeper into understanding why your path didn't work. Let me know!

@SolP-Aleios
Copy link
Author

SolP-Aleios commented Oct 17, 2022

@kaizencc This has never worked thus far.

Comparing the results of pipeline.workflowFile.toYaml() and the deploy.yml generated locally when cdk synth is run, both are equivalent up to the Upload cdk.out step. However, this is where the file generated with toYaml() ends, whereas the deploy.yml generated locally via cdk sytnh contains extra jobs named Assets-FileAsset1, Assets-FileAsset2 etc, up to Assets-FileAsset14. Do you have an idea why this might be the case? Should we expect these other jobs to be there or not?

I don't think we are using the default path for workflowPath at the moment as our stack is defined within a subdirectory of the project and we need our .github/workflows directory to be in the project root. Not passing a workflowPath results in this directory being generated in the wrong place.

@christophgysin
Copy link
Contributor

@SolP-Aleios Aere you using any JsonPatch escape hatches?

@SolP-Aleios
Copy link
Author

@christophgysin No escape hatches at all

@hikeeba
Copy link

hikeeba commented Jan 29, 2023

I'm having the same issue. Using CDK in C# with the NuGet package Cdklabs.CdkPipelinesGitHub version 0.3.115. cdk synth works just fine locally.

Error is:

Unhandled exception. System.Exception: Error: Please commit the updated workflow file ../../../../../home/runner/work/Camping/Camping/.github/workflows/Dev-Deploy.yml when you change your pipeline definition.

@hikeeba
Copy link

hikeeba commented Jan 29, 2023

Also not using the default workflow path because the CDK code is in a subfolder in the repo. Seems like we'll have to disable this diff check until this gets fixed.

@paulmartins
Copy link

paulmartins commented Feb 7, 2023

Same issue on my side using the default workflow path and cdk-pipelines-github version 0.3.125.
Anyone know how we could easily disable this diff check ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants