before_sha = null
Created by: rustjson
curl localhost:3000/ci/api/v1/builds/register.json
This to get a pending build. but return this:
"before_sha":"0000000000000000000000000000000000000000","allow_git_fetch":true,"project_name":"Jason / Abced","options":{},"timeout":3600,"variables":
In the database:
mysql> select * from ci_commits limit 1\G;
*************************** 1. row ***************************
id: 1
project_id: NULL
ref: NULL
sha: e382b257ef3275a3b40d2977691e7153aa32dcb7
before_sha: NULL
push_data: NULL
created_at: 2015-11-17 02:56:11
updated_at: 2015-11-17 02:56:12
tag: 0
yaml_errors: Undefined yaml error
committed_at: 2015-11-17 02:56:11
gl_project_id: 10
1 row in set (0.00 sec)
Code:
gitlab-ce/app/models/project.rb:775:in `ensure_ci_commit`
gitlab-ce/app/services/ci/create_commit_service.rb:19:in `execute'
gitlab-ce/lib/ci/api/commits.rb:55:in `block (2 levels) in <class:Commits>'
By using byebug, I am pretty sure this was the place where ci_build
was being created. But I believe ci_commits.create(sha: sha)
won't write before_sha
and this was the reason while I finally got a NULL
.
BTW, I invoke this API manually, cause I did't found out which trigger invoked this API when I am pushing commits.