Jenkins卡在sh命令中

yvgpqqbh  于 2022-11-02  发布在  Jenkins
关注(0)|答案(2)|浏览(334)

以下是我在添加为管道请求时的脚本

  1. pipeline {
  2. agent any
  3. stages {
  4. stage('Version check') {
  5. steps {
  6. sh "flutter --version"
  7. }
  8. }
  9. }
  10. }

这是Jenkins的控制台

  1. Started by user Akshay Gupta
  2. [Pipeline] Start of Pipeline
  3. [Pipeline] node
  4. Running on Jenkins in /var/lib/jenkins/workspace/FirstPipeline
  5. [Pipeline] {
  6. [Pipeline] stage
  7. [Pipeline] { (Version check)
  8. [Pipeline] sh

编辑2在我的终端上使用sudo ufw allow 8080命令并更改管道代码后,错误仍然相同。我可以做些什么吗

  1. pipeline {
  2. agent any
  3. stages {
  4. stage('Version check') {
  5. steps {
  6. sh "flutter --version --no-version-check"
  7. }
  8. }
  9. }
  10. }
  11. [Pipeline] Start of Pipeline
  12. [Pipeline] node
  13. Running on Jenkins in /var/lib/jenkins/workspace/FirstPipeline
  14. [Pipeline] {
  15. [Pipeline] stage
  16. [Pipeline] { (Version check)
  17. [Pipeline] sh
  18. process apparently never started in /var/lib/jenkins/workspace/FirstPipeline@tmp/durable-7c931453
  19. (running Jenkins temporarily with -Dorg.jenkinsci.plugins.durabletask.BourneShellScript.LAUNCH_DIAGNOSTICS=true might make the problem clearer)
  20. [Pipeline] }
  21. [Pipeline] // stage
  22. [Pipeline] }
  23. [Pipeline] // node
  24. [Pipeline] End of Pipeline
  25. ERROR: script returned exit code -2
  26. Finished: FAILURE

编辑3

在这里,我通过从configure系统文件中删除path变量解决了这个问题,它正在执行shell脚本,但现在我的管道脚本看起来像这样

  1. pipeline {
  2. agent any
  3. environment {
  4. flutter = "/home/stack/Desktop/developer/flutter/bin/flutter"
  5. }
  6. stages {
  7. stage('GIT PULL') {
  8. steps {
  9. git branch: 'main', url: 'https://github.com/AkshayStackSum/demo_flutter_app_to_jenkins.git'
  10. }
  11. }
  12. stage('CLEAN') {
  13. steps {
  14. sh "${flutter} clean"
  15. }
  16. }
  17. stage('PUB GET') {
  18. steps {
  19. sh "${flutter} pub get"
  20. }
  21. }
  22. }
  23. }

我的错误看起来像这样

  1. Started by user unknown or anonymous
  2. [Pipeline] Start of Pipeline
  3. [Pipeline] node
  4. Running on Jenkins in /var/lib/jenkins/workspace/MyPipeline
  5. [Pipeline] {
  6. [Pipeline] withEnv
  7. [Pipeline] {
  8. [Pipeline] stage
  9. [Pipeline] { (GIT PULL)
  10. [Pipeline] git
  11. The recommended git tool is: NONE
  12. No credentials specified
  13. > git rev-parse --resolve-git-dir /var/lib/jenkins/workspace/MyPipeline/.git # timeout=10
  14. Fetching changes from the remote Git repository
  15. > git config remote.origin.url https://github.com/AkshayStackSum/demo_flutter_app_to_jenkins.git # timeout=10
  16. Fetching upstream changes from https://github.com/AkshayStackSum/demo_flutter_app_to_jenkins.git
  17. > git --version # timeout=10
  18. > git --version # 'git version 2.25.1'
  19. > git fetch --tags --force --progress -- https://github.com/AkshayStackSum/demo_flutter_app_to_jenkins.git +refs/heads/*:refs/remotes/origin/* # timeout=10
  20. > git rev-parse refs/remotes/origin/main^{commit} # timeout=10
  21. Checking out Revision 3076ef00fb2b7330735759edc957f471a8712117 (refs/remotes/origin/main)
  22. > git config core.sparsecheckout # timeout=10
  23. > git checkout -f 3076ef00fb2b7330735759edc957f471a8712117 # timeout=10
  24. > git branch -a -v --no-abbrev # timeout=10
  25. > git branch -D main # timeout=10
  26. > git checkout -b main 3076ef00fb2b7330735759edc957f471a8712117 # timeout=10
  27. Commit message: "flutter project initiated"
  28. > git rev-list --no-walk 3076ef00fb2b7330735759edc957f471a8712117 # timeout=10
  29. [Pipeline] }
  30. [Pipeline] // stage
  31. [Pipeline] stage
  32. [Pipeline] { (CLEAN)
  33. [Pipeline] sh
  34. + /home/stack/Desktop/developer/flutter/bin/flutter clean
  35. fatal: detected dubious ownership in repository at '/home/stack/Desktop/developer/flutter'
  36. To add an exception for this directory, call:
  37. git config --global --add safe.directory /home/stack/Desktop/developer/flutter
  38. rm: cannot remove '/home/stack/Desktop/developer/flutter/version': Permission denied
  39. [Pipeline] }
  40. [Pipeline] // stage
  41. [Pipeline] stage
  42. [Pipeline] { (PUB GET)
  43. Stage "PUB GET" skipped due to earlier failure(s)
  44. [Pipeline] }
  45. [Pipeline] // stage
  46. [Pipeline] }
  47. [Pipeline] // withEnv
  48. [Pipeline] }
  49. [Pipeline] // node
  50. [Pipeline] End of Pipeline
  51. ERROR: script returned exit code 1
  52. Finished: FAILURE

Edit 4因此,经过多次尝试,我在一个git项目中取得了成功,但现在我正在使用另一个repo,它显示了这种错误它在本地工作正常,启动应用程序时没有任何冲突,但它抛出了这种错误我只是在我以前的groovy脚本中更改了git集线器repo。

  1. n":"2.1.3","environment":{"sdk":">=2.0.0-dev.61 <3.0.0"},"dependencies":{"matcher":">=0.12.5 <0.13.0","meta":">=1.0.0 <2.0.0"},"dev_dependencies":{"path":">=1.0.0 <2.0.0","test":">=1.2.0 <2.0.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/2.1.3.tar.gz","archive_sha256":"16169b1cc79f01d9c47fe05b5670b87cbf7f5cfc77757369f245c36a6ae2b290","published":"2020-02-28T22:37:37.337683Z"},{"version":"2.1.4","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"2.1.4","environment":{"sdk":">=2.0.0-dev.61 <3.0.0"},"dependencies":{"matcher":">=0.12.5 <0.13.0","meta":">=1.0.0 <2.0.0"},"dev_dependencies":{"path":">=1.0.0 <2.0.0","test":">=1.2.0 <2.0.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/2.1.4.tar.gz","archive_sha256":"5aebd0ad81fc83c6be79d93ceaa3371d60c1eac06dd34b07c0d06974032edfb3","published":"2020-10-26T21:34:46.463591Z"},{"version":"2.1.4+1","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"2.1.4+1","environment":{"sdk":">=2.0.0-dev.61 <3.0.0"},"dependencies":{"matcher":">=0.12.5 <0.13.0","meta":">=1.0.0 <2.0.0"},"dev_dependencies":{"path":">=1.0.0 <2.0.0","test":">=1.2.0 <2.0.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/2.1.4%2B1.tar.gz","archive_sha256":"be9c6c979a6bf7b8deb3437f3119b13588ff36ce4ff59492b7773e12bdc6bc70","published":"2020-10-26T21:49:20.979008Z"},{"version":"2.1.5","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"2.1.5","environment":{"sdk":">=2.0.0-dev.61 <3.0.0"},"dependencies":{"matcher":">=0.12.5 <0.13.0","meta":">=1.0.0 <2.0.0"},"dev_dependencies":{"path":">=1.0.0 <2.0.0","test":">=1.2.0 <2.0.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/2.1.5.tar.gz","archive_sha256":"e83f7ad1e6375da1400b54eea8793bba804d1731d68c5694490bf9296cd3ca24","published":"2020-11-06T00:38:09.398682Z"},{"version":"3.0.0-nullsafety","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"3.0.0-nullsafety","environment":{"sdk":">=2.10.0 <3.0.0"},"dependencies":{"matcher":"^0.12.10-nullsafety","meta":"^1.3.0-nullsafety"},"dev_dependencies":{"path":"^1.8.0-nullsafety","test":"^1.16.0-nullsafety"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.0-nullsafety.tar.gz","archive_sha256":"467a81931eae537f7ed06d836204b5f2541d4cdd804f30e5def9ebf5930c11eb","published":"2020-11-06T01:14:42.006624Z"},{"version":"3.0.0-nullsafety.1","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"3.0.0-nullsafety.1","environment":{"sdk":">=2.10.0 <3.0.0"},"dependencies":{"matcher":"^0.12.10-nullsafety","meta":"^1.3.0-nullsafety"},"dev_dependencies":{"path":"^1.8.0-nullsafety","test":"^1.16.0-nullsafety"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.0-nullsafety.1.tar.gz","archive_sha256":"430e3eb6e642a790b304a90fb1444330466de9228192729c60739fd30ca96039","published":"2020-11-06T01:32:45.901741Z"},{"version":"3.0.0-nullsafety.2","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"3.0.0-nullsafety.2","environment":{"sdk":">=2.12.0-0 <3.0.0"},"dependencies":{"matcher":"^0.12.10-nullsafety.3","meta":"^1.3.0-nullsafety.6"},"dev_dependencies":{"path":"^1.8.0-nullsafety.3","test":"^1.16.0-nullsafety.8"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.0-nullsafety.2.tar.gz","archive_sha256":"48c610a3ade7bda69efaa5de716943d9902d7571ebb10f4a9c4e0896d25a98b5","published":"2020-11-06T02:09:57.515226Z"},{"version":"3.0.0-nullsafety.3","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","homepage":"https://github.com/google/quiver-dart","version":"3.0.0-nullsafety.3","environment":{"sdk":">=2.12.0-0 <3.0.0"},"dependencies":{"matcher":"^0.12.10-nullsafety.3"},"dev_dependencies":{"path":"^1.8.0-nullsafety.3","test":"^1.16.0-nullsafety.8"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.0-nullsafety.3.tar.gz","archive_sha256":"c30db7270f24a0135d4ae116c41b459e6269922691d810fe21461b495568d2cf","published":"2021-01-15T19:41:37.921126Z"},{"version":"3.0.0","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","repository":"https://github.com/google/quiver-dart","version":"3.0.0","environment":{"sdk":">=2.12.0-0 <3.0.0"},"dependencies":{"matcher":"^0.12.10"},"dev_dependencies":{"path":"^1.8.0","test":"^1.16.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.0.tar.gz","archive_sha256":"ca3ae1a9b6c2a7712f6818c8ce6bbcc6cf999115f4fb51b1fa8b7bfe1037d70e","published":"2021-02-17T18:37:19.196841Z"},{"version":"3.0.1","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","repository":"https://github.com/google/quiver-dart","version":"3.0.1","environment":{"sdk":">=2.12.0-0 <3.0.0"},"dependencies":{"matcher":"^0.12.10"},"dev_dependencies":{"path":"^1.8.0","test":"^1.16.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.1.tar.gz","archive_sha256":"5e592c348a6c528fb8deb7cc7d85a7097ce65bf2349121ad004d1fc5d5905eaa","published":"2021-04-06T16:37:06.849276Z"},{"version":"3.0.1+1","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","repository":"https://github.com/google/quiver-dart","version":"3.0.1+1","environment":{"sdk":">=2.12.0-0 <3.0.0"},"dependencies":{"matcher":"^0.12.10"},"dev_dependencies":{"path":"^1.8.0","test":"^1.16.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.0.1%2B1.tar.gz","archive_sha256":"616b691d1c8f5c53b7b39ce3542f6a25308d7900bf689d0210e72a644a10387e","published":"2021-10-15T05:01:19.034255Z"},{"version":"3.1.0","pubspec":{"name":"quiver","description":"Quiver is a set of utility libraries for Dart that makes using many Dart libraries easier and more convenient, or adds additional functionality.","repository":"https://github.com/google/quiver-dart","version":"3.1.0","environment":{"sdk":">=2.12.0-0 <3.0.0"},"dependencies":{"matcher":"^0.12.10"},"dev_dependencies":{"path":"^1.8.0","test":"^1.16.0"}},"archive_url":"https://pub.dartlang.org/packages/quiver/versions/3.1.0.tar.gz","archive_sha256":"93982981971e812c94d4a6fa3a57b89f9ec12b38b6380cd3c1370c3b01e4580e","published":"2022-05-03T20:32:16.263955Z"}],"_fetchedAt":"2022-09-05T11:11:10.482766"}
  2. SLVR: fact: no versions of google_sign_in match >5.4.1 <6.0.0
  3. SLVR: conflict: no versions of google_sign_in match >5.4.1 <6.0.0
  4. SLVR: derived: not google_sign_in >5.4.1 <6.0.0
  5. SLVR: conflict: google_sign_in 5.4.1 requires Flutter SDK version >=2.8.0
  6. SLVR: ! google_sign_in 5.4.1 is partially satisfied by not google_sign_in >5.4.1 <6.0.0
  7. SLVR: ! which is caused by "no versions of google_sign_in match >5.4.1 <6.0.0"
  8. SLVR: ! thus: google_sign_in ^5.4.1 is forbidden
  9. SLVR: ! google_sign_in ^5.4.1 is satisfied by google_sign_in ^5.4.1
  10. SLVR: ! which is caused by "flutter_boiler_plate depends on google_sign_in ^5.4.1"
  11. SLVR: ! thus: version solving failed
  12. SLVR: Version solving took 0:00:01.065682 seconds.
  13. | Tried 1 solutions.
  14. FINE: Resolving dependencies finished (1.1s).
  15. ERR : The current Flutter SDK version is 0.0.0-unknown.
  16. |
  17. | Because google_sign_in 5.4.1 requires Flutter SDK version >=2.8.0 and no versions of google_sign_in match >5.4.1 <6.0.0, google_sign_in ^5.4.1 is forbidden.
  18. | So, because flutter_boiler_plate depends on google_sign_in ^5.4.1, version solving failed.
  19. FINE: Exception type: SolveFailure
  20. FINE: package:pub/src/solver/version_solver.dart 311:5 VersionSolver._resolveConflict
  21. | package:pub/src/solver/version_solver.dart 132:27 VersionSolver._propagate
  22. | package:pub/src/solver/version_solver.dart 96:11 VersionSolver.solve.<fn>
  23. | ===== asynchronous gap ===========================
  24. | dart:async Future.catchError
  25. | package:pub/src/utils.dart 109:52 captureErrors.wrappedCallback
  26. | package:stack_trace Chain.capture
  27. | package:pub/src/utils.dart 122:11 captureErrors
  28. | package:pub/src/command.dart 189:13 PubCommand.run
  29. | package:args/command_runner.dart 209:27 CommandRunner.runCommand
  30. | package:pub/src/command_runner.dart 176:24 PubCommandRunner.runCommand
  31. | package:pub/src/command_runner.dart 161:20 PubCommandRunner.run
  32. | package:dartdev/dartdev.dart 45:56 runDartdev
  33. | /b/s/w/ir/cache/builder/sdk/pkg/dartdev/bin/dartdev.dart 11:9 main
  34. ---- End log transcript ----
  35. pub get failed (1; ---- End log transcript ----)
j13ufse2

j13ufse21#

我想flutter --version会调用HTTP来确定是否有可用的更新。所以这一定需要时间,或者请求被防火墙阻止了?
请尝试执行以下操作。

  1. flutter --version --no-version-check
xt0899hw

xt0899hw2#

  1. + /home/stack/Desktop/developer/flutter/bin/flutter clean
  2. fatal: detected dubious ownership in repository at '/home/stack/Desktop/developer/flutter'
  3. To add an exception for this directory, call:
  4. git config --global --add safe.directory /home/stack/Desktop/developer/flutter
  5. rm: cannot remove '/home/stack/Desktop/developer/flutter/version': Permission denied

edit3中异常的这一部分实际上是答案的一个 * 部分 *。
您的Jenkins示例没有删除该文件夹中的文件或目录的权限。
您可以尝试使用以下命令更改文件夹所有权:
sudo chown jenkins:jenkins /pathto/folder

相关问题