Jenkins正被用于从具有Git子模块的Git仓库构建工件。子模块与父项目不在同一个repo中,甚至不在同一端点。问题是父repo检查正常,因为凭证ssh密钥A与主/父repo相关联,但不出意外,在子模块上失败,因为凭证ssh密钥B与Jenkins&的repo没有关联#39;观点。
令人惊讶的是Jenkins对Git子模块没有更好的开箱即用支持;贡献的时间。
答案 0 :(得分:1)
是的,这很容易做到。您可以创建pub / private密钥对,并将其设置为github deploy key(如果不使用git hub,则将其设置为使用的密钥集)。您可以将其添加为Jenkins凭据(前提是已安装凭据插件)。
public function index(Request $request) {
if($request->isMethod('post')){
$search_first_name = $request->search_first_name;
$search_last_name = $request->search_last_name;
$search_email = $request->search_email;
$search_round_number = $request->search_round_number;
$search_location = $request->search_location;
$options = Input::get('dropdown');
if($options == 'recommendation' || 'source') {
$recOrSource = Input::get('options');
unset($options);
}
$search_from_date = $request->search_from_date;
$search_to_date = $request->search_to_date;
$candidate = DB::table('candidates')
->when($search_first_name, function ($query) use ($search_first_name) {
return $query->where('first_name', 'like', '%' . $search_first_name . '%');
})
->when($search_last_name, function ($query) use ($search_last_name) {
return $query->where('last_name', 'like', '%' . $search_last_name . '%');
})
->when($search_email, function ($query) use ($search_email) {
return $query->where('email', $search_email);
})
->when($search_round_number, function ($query) use ($search_round_number) {
return $query->where('round_number', $search_round_number);
})
->when($search_location, function ($query) use ($search_location) {
return $query->where('location', $search_location);
})
->when($options, function ($query) use ($options,$search_from_date,$search_to_date ) {
return $query->whereBetween($options, array($search_from_date, $search_to_date));
})
->when($recOrSource, function ($query) use ($recOrSource,$search_from_date,$search_to_date ) {
return $query->where(!empty($recOrSource))->whereBetween('created_at', array($search_from_date, $search_to_date));
})
->orderBy('first_name', 'asc')
->orderBy('last_name', 'asc')
->get();
Session::flash('inputs', [
'search_first_name' => $search_first_name,
'search_last_name' => $search_last_name,
'search_email' => $search_email,
'search_round_number' => $search_round_number,
'search_from_date' => $search_from_date,
'search_to_date' => $search_to_date,
'search_location' => $search_location
]);
}else{
Session::forget('inputs');
$candidate = Candidate::orderBy('first_name', 'asc')
->orderBy('last_name', 'asc')
->get();
}
return view('/candidates/index', [
'candidate' => $candidate
]);
该ID映射到下面的 credentialsId
Username: git@github.com
Private Key: the private key for that key set
Passphrase: whatever passphrase you used
ID: aws-jenkins-github-deploykey (just an example name)
Description: some useful text
运行此流水线代码时,它将在分支中检出存储库,提交等到工作目录。您还可以指定目录。
因此,您可以使用它来签出一堆仓库并为其使用特定分支。