阅读背景:

为什么Cloudbees Jenkins因MySQL的Access拒绝错误而间歇性失败?

来源:互联网 

We have setup Cloudbees Jenkins to run integration test job whenever it detects a commit in Github. But for some strange reason, some intermittent builds fail with the following error:

我们已经设置Cloudbees Jenkins在Github中检测到提交时运行集成测试作业。但由于某些奇怪的原因,一些间歇性构建失败并出现以下错误:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

ERROR 1045(28000):用户'root'@'localhost'拒绝访问(使用密码:YES)

In our Integration Test job, we do the following:

在我们的集成测试工作中,我们执行以下操作:

  1. Drop MySQL database if it exists.
  2. 删除MySQL数据库(如果存在)。

  3. Create a new DB for Integration Tests.
  4. 为集成测试创建新数据库。

  5. Run Integration Tests (Junit)
  6. 运行集成测试(Junit)

We had set the password for MySQL admin once to 'mysql' for the root user -- by executing a shell command in the job. Later we removed it because it failed the next time, giving us an indication that the password doesn't need to be set everytime by the job.

我们通过在作业中执行shell命令,为root用户设置了一次MySQL admin的密码为'mysql'。之后我们将其删除,因为它下次失败了,这表明每次作业都不需要设置密码。

Any inputs on why this might be happening would help.

关于为什么会发生这种情况的任何意见都会有所帮助。

1 个解决方案

#1


0  

Cloudbees platform uses a slave pool, and your build may occur on a node it already has been built on (allocation algorithm tries to gives you such one, so that you get all dependencies already provisioned) but you sometime will have build to start on a fresh new node. So your build needs to be fully reproducible in both situations.

Cloudbees平台使用一个从属池,你的构建可能发生在它已构建的节点上(分配算法试图给你这样一个,这样你就可以获得已经配置的所有依赖项)但是你有时会在一个节点上开始构建新鲜的新节点。因此,您的构建需要在两种情况下都可以完全重现。

Possible workaround is to make this pasword initialization conditional to some way for you to detect the DB is already setup, or to enforce a full reset so you can safely run the init command on every build

可能的解决方法是使这个pasword初始化有条件以某种方式检测已经设置的数据库,或强制执行完全重置,以便您可以安全地在每个构建上运行init命令


分享到: