詹金斯在读取Bitbucket回购的内容时看到了什么?

时间:2018-04-19 22:54:06

标签: git jenkins bitbucket jenkins-plugins jenkins-pipeline

Jenkins安装在本地网络内的本地服务器中。它需要连接到也在我们的本地网络中运行的Bitbucket Server实例。

我们在Jenkins中创建了一个 Bitbucket团队/项目,并将其配置为接触Bitbucker服务器实例。当 Bitbucket团队/项目在Jenkins中运行时,它能够成功连接到Bitbucket Server本地实例中的正确存储库。它能够列出链接的Bitbucket存储库中每个分支的名称。但它无法找到Jenkinsfile。

  

如何在查找Jenkins文件时找出Jenkins在目录结构中实际看到的内容?知道Jenkins看到的内容会使得更容易找出要为配置输入的语法。

代码从this GitHub repository下载。如您所见,Jenkins文件位于jenkins/Jenkinsfile目录中,即使Jenkins似乎无法在该位置找到它。当我们将Jenkins配置为在Jenkinsfile而不是jenkins/Jenkinsfile查找Jenkins文件时,我们会收到类似的错误。

以下是 Bitbucket团队/项目运行时生成的日志:

Started
[Thu Apr 19 22:20:10 GMT 2018] Starting organization scan...
[Thu Apr 19 22:20:10 GMT 2018] Updating actions...
Looking up team details of JPE...
Connecting to http://<local-bitbucket-server-ip>:7990 using CredentialName/******
Team: Jenkins Pipeline Examples
[Thu Apr 19 22:20:10 GMT 2018] Consulting Bitbucket Team/Project
Connecting to http://<local-bitbucket-server-ip>:7990 using CredentialName/******
Looking up repositories of team JPE
Proposing simple-python-pyinstaller-app
Connecting to http://<local-bitbucket-server-ip>:7990 using CredentialName/******
Repository type: Git
Looking up JPE/simple-python-pyinstaller-app for branches
Checking branch py-issue-branch-example from JPE/simple-python-pyinstaller-app
      ‘jenkins/Jenkinsfile’ not found
    Skipped
Checking branch master from JPE/simple-python-pyinstaller-app
      ‘jenkins/Jenkinsfile’ not found
    Skipped
Checking branch feature/py-feature-branch-example from JPE/simple-python-pyinstaller-app
      ‘jenkins/Jenkinsfile’ not found
    Skipped

  3 branches were processed
Looking up JPE/simple-python-pyinstaller-app for pull requests

  0 pull requests were processed
1 repositories were processed
[Thu Apr 19 22:20:10 GMT 2018] Finished organization scan. Scan took 0.21 sec
Finished: SUCCESS  

1 个答案:

答案 0 :(得分:1)

当您转到Jenkins工作时,您应该能够查看工作区。这是它检查存储库的地方,它将显示Jenkins“看到”的确切内容。

Jenkins设置了一个环境变量$ WORKSPACE,它是工作空间目录的绝对路径。这可以帮助您确保在搜索文件时您想要的位置。