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

Concurrent runs still failing. #536

Closed
squarefrog opened this issue Sep 16, 2022 · 2 comments
Closed

Concurrent runs still failing. #536

squarefrog opened this issue Sep 16, 2022 · 2 comments

Comments

@squarefrog
Copy link
Contributor

squarefrog commented Sep 16, 2022

We're still struggling with concurrent Danger runs, even after the changes in #530

We get a little further this time, but somehow either Danger JS or Danger Swift is trying to write to the same location. I've run a test with two pipelines on the mac, with debug enabled.

The first fails:

2022-09-16T13:26:35.491Z danger:process_runner Preparing to run: .build/debug/danger-swift,runner,/snapshot/danger-js/distribution/commands/danger-ci.js,--process,.build/debug/danger-swift,--passURLForDSL,-i,danger_ci,-f,--cwd,../
2022-09-16T13:26:35.491Z danger:runDangerSubprocess Running sub-process: danger-swift - runner,/snapshot/danger-js/distribution/commands/danger-ci.js,--process,.build/debug/danger-swift,--passURLForDSL,-i,danger_ci,-f,--cwd,../
2022-09-16T13:26:35.500Z danger:runDangerSubprocess Started passing in STDIN via the URL: danger://dsl//var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json
2022-09-16T13:26:35.500Z danger:runDangerSubprocess Passed DSL in via STDIN
Ran with: /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/8B52C17F-7357-4BF2-BC85-5FB55F2448AC/_tmp_dangerfile.swift runner /snapshot/danger-js/distribution/commands/danger-ci.js --process .build/debug/danger-swift --passURLForDSL -i danger_ci -f --cwd ../ /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/8B52C17F-7357-4BF2-BC85-5FB55F2448AC/danger-response.json
ERROR: could not find DSL JSON at path: /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json
Launching Danger Swift runner (v3.14.0)
Got URL for JSON: /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json
Created a temporary file for the Dangerfile DSL at: /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json
Running Dangerfile at: Dangerfile.swift
Preparing to compile
Running: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift --driver-mode=swift -L /private/tmp/gitlab-runner-builds/245930/Danger/.build/debug -I /private/tmp/gitlab-runner-builds/245930/Danger/.build/debug -lDangerDeps /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/8B52C17F-7357-4BF2-BC85-5FB55F2448AC/_tmp_dangerfile.swift runner /snapshot/danger-js/distribution/commands/danger-ci.js --process .build/debug/danger-swift --passURLForDSL -i danger_ci -f --cwd ../ /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/8B52C17F-7357-4BF2-BC85-5FB55F2448AC/danger-response.json
Completed evaluation
ERROR: Dangerfile eval failed at Dangerfile.swift
ERROR: Could not get the results JSON file at /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/8B52C17F-7357-4BF2-BC85-5FB55F2448AC/danger-response.json

While the second completes fine:

2022-09-16T13:26:35.135Z danger:process_runner Preparing to run: .build/debug/danger-swift,runner,/snapshot/danger-js/distribution/commands/danger-ci.js,--process,.build/debug/danger-swift,--passURLForDSL,-i,danger_ci,-f,--cwd,../
2022-09-16T13:26:35.135Z danger:runDangerSubprocess Running sub-process: danger-swift - runner,/snapshot/danger-js/distribution/commands/danger-ci.js,--process,.build/debug/danger-swift,--passURLForDSL,-i,danger_ci,-f,--cwd,../
2022-09-16T13:26:35.162Z danger:runDangerSubprocess Started passing in STDIN via the URL: danger://dsl//var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json
2022-09-16T13:26:35.162Z danger:runDangerSubprocess Passed DSL in via STDIN
Ran with: /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/C31A4E15-B2D0-4622-AA41-EC29822D0386/_tmp_dangerfile.swift runner /snapshot/danger-js/distribution/commands/danger-ci.js --process .build/debug/danger-swift --passURLForDSL -i danger_ci -f --cwd ../ /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json /var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/C31A4E15-B2D0-4622-AA41-EC29822D0386/danger-response.json
Decoding the DSL into Swift types
Setting up to dump results
Sending results back to Danger
Sending results back to Danger
2022-09-16T13:26:59.330Z danger:runDangerSubprocess Got JSON URL from STDOUT, results are at: 
danger-results://var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger/C31A4E15-B2D0-4622-AA41-EC29822D0386/danger-response.json
Launching Danger Swift runner (v3.14.0)

Notice theres a URL which is identical in both runs: danger://dsl//var/folders/0h/c4gthkj13sz3hb1z4fwpnd3c0000gp/T/danger-dsl.json

I'm happy to look into this, but I'm not entirely sure if this a problem with Danger JS or Swift. If you wouldn't mind taking a look and giving me a clue, I'd get cracking.

@squarefrog
Copy link
Contributor Author

Actually, I think I see the issue on DangerJS:

  const sendDSLToSubprocess = () => {
    if (exec.options.passURLForDSL) {
      const resultsPath = join(tmpdir(), "danger-dsl.json")
      writeFileSync(resultsPath, dslJSONString, "utf8")
      const url = `danger://dsl/${resultsPath}`
      d(`Started passing in STDIN via the URL: ${url}`)
      child.stdin.write(url)
      child.stdin.end()
    } else {
      d(`Started passing in STDIN`)
      child.stdin.write(dslJSONString)
      child.stdin.end()
    }
    d(`Passed DSL in via STDIN`)
  }

https://github.com/danger/danger-js/blob/a6b40e953ff318c6230bf0f09152e4ba58cd567f/source/commands/utils/runDangerSubprocess.ts#L55-L69

@squarefrog
Copy link
Contributor Author

After more research, it's clear this is an issue in danger-js so I've opened an issue there instead.

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

1 participant