我们的项目仓库非常大(2.5GB)。因此,在脚本化管道中的 checkout(scm) 步骤中,代码需要更长的时间从 GIT 克隆。由于 GIT 试图获取整个历史记录,我们面临以下错误。
到目前为止,我已经尝试过 checkout(scm),我在https://jenkins.io/doc/pipeline/steps/workflow-scm-step/中读到 ,有一个名为“深度”的选项,通过它我们只能下载最近的承诺。
但我不知道它的语法。
node(nodeName) {
try {
deleteDir()
checkout(scm)
....
....
}
catch(Exception ex) {
throw ex
}
}
Run Code Online (Sandbox Code Playgroud)
如果克隆时间减少,那将是非常有益的。执行线路结账(scm)后,
我们有时会收到以下错误。
using credential Servicejenkins_build
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository
hudson.plugins.git.GitException: Command "C:\Git\cmd\git fetch --no-tags --progress https://gitlab.com/../../supportforpc.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Enumerating objects: 1
remote: Enumerating objects: 24671, done.
remote: Counting objects: 0% (1/24671)
remote: Counting objects: …Run Code Online (Sandbox Code Playgroud) 我有一个像这样的数组
int A[] = {1, 2, 3, 4, 5, 6, 7}
vector<int> vec;
int index = 0;
for(int i = 0; i < A.size(); i++) {
if(some condition) {
index = i;
}
**vec(A + index, i);**
}
Run Code Online (Sandbox Code Playgroud)
如何将数组转换为从特定索引开始的向量,如上所述?