What's causing my Multibranch Pipeline to fail its scan? - jenkins

I'm trying to set up a Multibranch pipeline in Jenkins with Bitbucket as the SCM. When I try to "Scan Multibranch Pipeline Now" this is the resulting console log.
> git --version # 'git version 2.36.0.windows.1'
using GIT_SSH to set credentials
> C:/Program Files/Git/cmd/git.exe ls-remote -h -- ssh://git(repo name here).git # timeout=10
Fetching upstream changes from origin
> C:/Program Files/Git/cmd/git.exe config --get remote.origin.url # timeout=10
using GIT_SSH to set credentials
> C:/Program Files/Git/cmd/git.exe fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: [Mon Jun 27 11:02:32 PDT 2022] Could not fetch branches from source 3387233e-6185-46fa-a65c-0d4072f28149
[Mon Jun 27 11:02:32 PDT 2022] Finished branch indexing. Indexing took 7.8 sec
FATAL: Failed to recompute children of MultiBranch Test
hudson.plugins.git.GitException: Command "C:/Program Files/Git/cmd/git.exe fetch --tags --force --progress --prune -- origin +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: Repository not found
The requested repository does not exist, or you do not have permission to access it.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
at jenkins.plugins.git.AbstractGitSCMSource$8.run(AbstractGitSCMSource.java:602)
at jenkins.plugins.git.AbstractGitSCMSource$8.run(AbstractGitSCMSource.java:588)
at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:394)
at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:350)
at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:588)
at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:641)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:166)
at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Finished: FAILURE
Originally, the multibranch was able to scan the repo and find the branches with Jenkinsfiles, but now that no longer works. In the first multibranch test which scanned and created pipelines for branches, when I try to build those branches it fails the build with the same error as above "repository not found".
I have a successful single Pipeline working for the same repository, specifically the develop branch. It is able to build on commits and pull the jenkinsfile from the repo, so it doesnt seem there is an access issue, but that is what the Multibranch pipeline is running into.
--------UPDATE-----------
Randomly, the scan worked. We are not sure what/if any changes prompted the sudden correct performance.

Related

Why does this "complicated" git clone/checkout cause gitversion to fail?

I have the following pipeline syntax code in a Jenkinsfile to clone a git repo:
checkout([$class: 'GitSCM',
branches: [[name: "${branch}"]],
doGenerateSubmoduleConfigurations: false,
extensions: [[$class: 'SubmoduleOption',
disableSubmodules: false,
parentCredentials: false,
recursiveSubmodules: true,
reference: '',
trackingSubmodules: false],
[$class: 'LocalBranch',
localBranch: ""],
[$class: 'RelativeTargetDirectory',
relativeTargetDir: relative_dir]],
submoduleCfg: [],
userRemoteConfigs: [[credentialsId: cred_id,
url: git_url]]])
Following is the output of one instance of this Jenkins job, which reveals the git commands used to clone a repo:
> git init /home/user/workspace/CICD/PRJ/repo/PRJ/repo/121/src # timeout=10
Fetching upstream changes from ssh://git#bitbucket.company.com:7999/PRJ/repo.git
> git --version # timeout=10
using GIT_SSH to set credentials user - ssh username with private key.
> git fetch --tags --progress -- ssh://git#bitbucket.company.com:7999/PRJ/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url ssh://git#bitbucket.company.com:7999/PRJ/repo.git # timeout=10
> git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10
> git config remote.origin.url ssh://git#bitbucket.company.com:7999/PRJ/repo.git # timeout=10
Fetching upstream changes from ssh://git#bitbucket.company.com:7999/PRJ/repo.git
using GIT_SSH to set credentials user - ssh username with private key.
> git fetch --tags --progress -- ssh://git#bitbucket.company.com:7999/PRJ/repo.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git rev-parse refs/remotes/origin/feature/hcf^{commit} # timeout=10
> git rev-parse refs/remotes/origin/refs/heads/feature/hcf^{commit} # timeout=10
Checking out Revision 37b9492373951ab0b4c70fa64a3320be58133e0e (refs/remotes/origin/feature/hcf)
> git config core.sparsecheckout # timeout=10
> git checkout -f 37b9492373951ab0b4c70fa64a3320be58133e0e # timeout=10
> git branch -a -v --no-abbrev # timeout=10
> git checkout -b feature/hcf 37b9492373951ab0b4c70fa64a3320be58133e0e # timeout=10
Commit message: "Uncomment set_fault"
> git rev-list --no-walk 59ce67929be6c901975596db509de7a72b3c557a # timeout=10
This same Jenkinsfile automatically applies git tags using gitversion like so:
docker run -u $(id -u ${USER}):$(id -g ${USER}) --rm -v "$(pwd):/repo" artifactory.company.com/gittools/gitversion:5.7.1 /repo
The above methods of git cloning and using gitversion to generate new git tags has been working fine for several months without incident.
Problem:
Today, gitversion failed unexpectedly when this Jenkins job was run to build a git branch that I cannot see anything unique about (versus the many successfully-built branches).
The error, below, seems to indicate an inability to identify development or release branches, which are dev and master, respectively, in our case.
+ docker run -u 1172002866:1172000513 --rm -v /home/user/workspace/CICD/PRJ/repo/PRJ/repo/121/src:/repo artifactory.company.com/gittools/gitversion:5.7.1 /repo
INFO [01/26/22 23:30:14:02] Working directory: /repo
INFO [01/26/22 23:30:14:26] Project root is: /repo/
INFO [01/26/22 23:30:14:26] DotGit directory is: /repo/.git
INFO [01/26/22 23:30:14:59] Begin: Loading version variables from disk cache
INFO [01/26/22 23:30:14:59] Cache file /repo/.git/gitversion_cache/AF7963E4F79300A465EFC56DBA14B2B679307C08.yml not found.
INFO [01/26/22 23:30:14:59] End: Loading version variables from disk cache (Took: 1.50ms)
INFO [01/26/22 23:30:14:61] Using latest commit on specified branch
INFO [01/26/22 23:30:14:62] Begin: Attempting to inherit branch configuration from parent branch
INFO [01/26/22 23:30:14:65] Begin: Finding branch source of 'feature/hcf'
INFO [01/26/22 23:30:14:66] End: Finding branch source of 'feature/hcf' (Took: 15.87ms)
INFO [01/26/22 23:30:14:67] Begin: Getting branches containing the commit '37b9492'.
INFO [01/26/22 23:30:14:67] Trying to find direct branches.
INFO [01/26/22 23:30:14:67] No direct branches found, searching through all branches.
INFO [01/26/22 23:30:14:67] Searching for commits reachable from 'origin/dev'.
INFO [01/26/22 23:30:14:69] The branch 'origin/dev' has no matching commits.
INFO [01/26/22 23:30:14:69] Searching for commits reachable from 'origin/master'.
INFO [01/26/22 23:30:14:70] The branch 'origin/master' has no matching commits.
INFO [01/26/22 23:30:14:70] Searching for commits reachable from 'origin/release-npm2'.
INFO [01/26/22 23:30:14:70] The branch 'origin/release-npm2' has no matching commits.
INFO [01/26/22 23:30:14:70] Searching for commits reachable from 'origin/release-npm3'.
INFO [01/26/22 23:30:14:71] The branch 'origin/release-npm3' has no matching commits.
INFO [01/26/22 23:30:14:71] Searching for commits reachable from 'origin/release-5944.0'.
INFO [01/26/22 23:30:14:72] The branch 'origin/release-5944.0' has no matching commits.
INFO [01/26/22 23:30:14:72] Searching for commits reachable from 'origin/release-5944.1'.
INFO [01/26/22 23:30:14:73] The branch 'origin/release-5944.1' has no matching commits.
INFO [01/26/22 23:30:14:73] End: Getting branches containing the commit '37b9492'. (Took: 63.52ms)
INFO [01/26/22 23:30:14:73] Found possible parent branches:
INFO [01/26/22 23:30:14:74] End: Attempting to inherit branch configuration from parent branch (Took: 116.47ms)
ERROR [01/26/22 23:30:14:82] An unexpected error occurred:
System.InvalidOperationException: Gitversion could not determine which branch to treat as the development branch (default is 'develop') nor releaseable branch (default is 'main' or 'master'), either locally or remotely. Ensure the local clone and checkout match the requirements or considering using 'GitVersion Dynamic Repositories'
at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList`1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 137
at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(IBranch targetBranch, ICommit currentCommit, Config configuration, IList`1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 47
at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 40
at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs:line 38
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 17
at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 32
at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 52
at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 70
INFO [01/26/22 23:30:14:82] Attempting to show the current git graph (please include in issue):
INFO [01/26/22 23:30:14:82] Showing max of 100 commits
INFO [01/26/22 23:30:14:93] * 37b9492 3 minutes ago (HEAD -> feature/hcf, origin/feature/hcf)
What I have tried:
When I manually clone the repo and check out the branch using the above git commands, I can reproduce the gitversion failure.
When I "simplify" my git clone and branch checkout to just:
$ git clone ssh://git#bitbucket.company.com:7999/PRJ/repo.git
$ git checkout feature/hcf
$ docker run -u $(id -u ${USER}):$(id -g ${USER}) --rm -v "$(pwd):/repo" artifactory.company.com/gittools/gitversion:5.7.1 /repo
...then gitversion succeeds and returns an expected value.
Questions:
Can the Jenkinsfile checkout() statement be modified so that it is functionally identical to the "simple" git clone and git checkout statements? There is obviously some salient difference between the two "methods" of cloning from git and checking out branches that is relevant to gitversion.
If possible, I would prefer a solution that uses the Jenkins pipeline checkout() function over a shell script invocation like sh(script:"git clone...") -- but perhaps an experienced answerer can convince me that that preference isn't justified.
Can someone explain how I can determine what is "unique" about this particular git repo or branch? With other repos/branches, the above checkout() statement in our Jenkinsfile continues to work simpatico with the subsequent gitversion invocation. So it would seem there is something unique about this one failing case that I don't know how to determine.
I don't use Jenkins myself, but it looks like the develop branch is missing from its clone of the repository, which may indicate that Jenkins is doing a sparse or shallow clone. As stated in GitVersion's requirements, it needs a full clone of the repository in order to do its calculations.
The reason your git clone && git checkout statements work is because, by default, Git performs a full clone of the repository. What you need to do is instruct Jenkins to do an unshallow clone of the repository. GitVersion's Jenkins documentation lists a number of things you can and should do to have GitVersion work properly:
Advanced clone behaviors
Enable Fetch tags
Enable Honor refspec on intial clone
Check out to matching local branch
Prune stale remote-tracking branches
Specify ref specs
Ref Spec: +refs/heads/*:refs/remotes/#{remote}/*
With the above Jenkins settings tuned correctly, it should work.

Jenkins Job Build Failure

After job build starts in jenkins my git-lab server's memory becomes full. Job is successful after restarting the Jenkins server.Jenkins has become too slow Sometimes Error comes with signal 9 also. Thank-you in advance. I have attached the log of the failed build.
started by user ME
Building in workspace /var/lib/jenkins/workspace/my_Project
using credential ABC
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url git#myrepo:root/My_Project.git # timeout=10
Fetching upstream changes from git#myrepo:root/My_Project.git
> /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials
> /usr/bin/git fetch --tags --progress git#myrepo:root/My_Project.git +refs/heads/*:refs/remotes/origin/*
> /usr/bin/git rev-parse refs/remotes/origin/My_Project_Develop^{commit} # timeout=10
> /usr/bin/git rev-parse refs/remotes/origin/origin/My_Project_Develop^{commit} # timeout=10
Checking out Revision fbd8fcef97895366d1d08bccb22615712d1f9ef0 (refs/remotes/origin/My_Project_Develop)
> /usr/bin/git config core.sparsecheckout # timeout=10
> /usr/bin/git checkout -f fbd8fcef97895366d1d08bccb22615712d1f9ef0
Commit message: "Update features of Software."
> /usr/bin/git rev-list --no-walk fbd8fcef97895366d1d08bccb22615712d1f9ef0 # timeout=10
Checking for pre-build
Executing pre-build step
Checking if email needs to be generated
No emails were triggered.
[My_Project] $ /bin/sh -xe /tmp/jenkins6218118938138193412.sh
+ id -un
root
+ SSH_OPTS='-o StrictHostKeyChecking=no -o ConnectTimeout=5'
+ sudo git checkout My_Project_Develop
Previous HEAD position was fbd8fce... Update features of Software.
Switched to branch 'My_Project_Develop'
Your branch is behind 'origin/My_Project_Develop' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
Build step 'Execute shell' marked build as failure
Discard old builds...
#1040 is removed because status FAILURE is not to be kept
Checking for post-build
Performing post-build step
Checking if email needs to be generated
No emails were triggered.
Finished: FAILURE
You need to pull the My_Project_Develop branch, checkout is only switching to this branch. Your branch is locally behind the server.
The message is clear:
Your branch is behind 'origin/My_Project_Develop' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
Usually this is done by Jenkins. I need more info how you run this job.

Jenkins Blue Ocean fails on GitHub 'git checkout -b branch-name' with status code 128:

following a YT tutorial Getting Started with Blue Ocean's Visual Pipeline Editor, I struggle to proceed further after the second round of modification my Jenkinsfile using the BO Visual Editor.
When I hit the 'Save & run' button, Jenkins BO pipeline starts running, but fails with this:
GitHub has been notified of this commit’s build result
hudson.plugins.git.GitException: Command "git checkout -b blue-ocean-editor 9c164f507fa831c33d44d83e1f458ec50b433f40" returned status code 128:
stdout:
stderr: fatal: A branch named 'blue-ocean-editor' already exists
If you look into my repo and the particular commit(s) Jenkins had been able to create the 'blue-ocean-editor' branch in my initial commit (caused by the new BO pipeline) and also push the next commit "Expand my Blue Ocean pipeline", so I doubt that my Jenkins won't have the right credentials as discussed here.
However there are some timeouts. Not sure how much is this of concern.
Anyway, here's the full output of my BO pipeline:
Branch indexing
Connecting to https://api.github.com using zxxxy/****** (GitHub Access Token)
Obtained Jenkinsfile from 9c164f507fa831c33d44d83e1f458ec50b433f40
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/jobs/HelloWorldProject/branches/blue-ocean-editor/workspace
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
using credential github
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/delphym/HelloWorldProject.git # timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
Resetting working tree
> git reset --hard # timeout=10
> git clean -fdx # timeout=10
Fetching without tags
Fetching upstream changes from https://github.com/delphym/HelloWorldProject.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials GitHub Access Token
> git fetch --no-tags --progress https://github.com/delphym/HelloWorldProject.git +refs/heads/blue-ocean-editor:refs/remotes/origin/blue-ocean-editor # timeout=10
Checking out Revision 9c164f507fa831c33d44d83e1f458ec50b433f40 (blue-ocean-editor)
> git config core.sparsecheckout # timeout=10
> git checkout -f 9c164f507fa831c33d44d83e1f458ec50b433f40 # timeout=10
> git branch -a -v --no-abbrev # timeout=10
> git checkout -b blue-ocean-editor 9c164f507fa831c33d44d83e1f458ec50b433f40 # timeout=10
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
GitHub has been notified of this commit’s build result
hudson.plugins.git.GitException: Command "git checkout -b blue-ocean-editor 9c164f507fa831c33d44d83e1f458ec50b433f40" returned status code 128:
stdout:
stderr: fatal: A branch named 'blue-ocean-editor' already exists.
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2318)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$900(CliGitAPIImpl.java:81)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2627)
Caused: hudson.plugins.git.GitException: Could not checkout blue-ocean-editor with start point 9c164f507fa831c33d44d83e1f458ec50b433f40
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:2649)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1228)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
I wonder what I could be doing wrong. I believe I have pretty much up-to-date Jenkins and all the plugins and OS, but briefly:
OS: Ubuntu Trusty 14.04.6 LTS
Jenkins: Jenkins ver. 2.161 (a bit behind, but I want to switch to the stable releases)
Plugins: Blue Ocean 1.13.2

JIRA plugin on jenkins not set the JIRA_ISSUES variable

I have jenkins job for with GitHub Pull Request Builder.
In build, I added first step to set the JIRA_ISSUE variable.
JIRA: Add related environment variables to build
Extracts JIRA information for the build to environment variables.
Available variables:
JIRA_ISSUES - A comma separated list of issues which are referenced in the version control system changelog
JIRA_URL - Primary URL for the JIRA server
Typical usage:
Add this build step
Use the "Progress JIRA issues by workflow action" or "Move issues matching JQL to the specified version" with JQL like:
issue in (${JIRA_ISSUES})
Second step is to update these jira issues.
<builders>
<hudson.plugins.jira.JiraEnvironmentVariableBuilder plugin="jira#3.0.0"/>
<hudson.plugins.jira.JiraIssueUpdateBuilder plugin="jira#3.0.0">
<jqlSearch>issue in (${JIRA_ISSUES})</jqlSearch>
<workflowActionName>Ready for Review</workflowActionName>
<comment>add comment</comment>
</hudson.plugins.jira.JiraIssueUpdateBuilder>
</builders>
When I create PR, and it trigger the job, it not set JIRA_ISSUES
GitHub pull request #356 of commit 2e2b92d107a5460c4cc593fcab78c63f800d6472, no merge conflicts.
Setting status of 2e2b92d107a5460c4cc593fcab78c63f800d6472 to PENDING with url https://myjenkins.com/job/cicd-myjob-prtest-unittest/69/ and message: 'running tox...'
Using context: tox testing
[EnvInject] - Loading node environment variables.
Building remotely on myslave.node.box.com (linux) in workspace /var/lib/jenkins/workspace/cicd-myjob-prtest-unittest
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://mygithub.com/myuser/myproject.git # timeout=10
Fetching upstream changes from https://mygithub.com/myuser/myproject.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Github Service Account Username with token
> git fetch --tags --progress https://mygithub.com/myuser/myproject.git +refs/pull/*:refs/remotes/origin/pr/*
> git rev-parse refs/remotes/origin/pr/356/merge^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/pr/356/merge^{commit} # timeout=10
Checking out Revision 0ff9e43bbc1385303429f7bcf93fea36e8c455d3 (refs/remotes/origin/pr/356/merge)
> git config core.sparsecheckout # timeout=10
> git checkout -f 0ff9e43bbc1385303429f7bcf93fea36e8c455d3
Commit message: "Merge 2e2b92d107a5460c4cc593fcab78c63f800d6472 into 731994024e723b1257374f521b4784060df9e5b5"
First time build. Skipping changelog.
[JIRA] Setting JIRA_ISSUES to .
[JIRA] Updating issues using workflow action Ready for Review.
[JIRA] JQL: issue in ()
[JIRA] Updating issue MYPROJECT-1234
Setting status of 2e2b92d107a5460c4cc593fcab78c63f800d6472 to SUCCESS with url https://myjenkins.com/job/cicd-myjob-prtest-unittest/69/ and message: 'All is well.
'
Using context: tox testing
Finished: SUCCESS
The [JIRA] Updating issue MYPROJECT-1234 is from publisher
<publishers>
<hudson.plugins.jira.JiraIssueUpdater plugin="jira#3.0.0">
<issueSelector class="hudson.plugins.jira.selector.JqlIssueSelector">
<jql>issue=MYPROJECT-1234</jql>
</issueSelector>
<labels/>
</hudson.plugins.jira.JiraIssueUpdater>
</publishers>
If I look for change log for commit 2e2b92d107a5460c4cc593fcab78c63f800d6472 it has the jira issue in comment and title.
commit 2e2b92d107a5460c4cc593fcab78c63f800d6472 (HEAD -> MYPROJECT-1234, origin/MYPROJECT-1234)
Author: myuser <myuser#mygithub.com>
Date: Tue Aug 21 15:55:41 2018 -0500
MYPROJECT-1234: Tox testing
MYPROJECT-1234 change the data.
Why JiraEnvironmentVariableBuilder is not able to set JIRA_ISSUES to MYPROJECT-1234? while same exists in changelog.

Jenkins and Gitlab don't fetch code

I have a problem when i set my own project.
I start to configure my Jenkins Job, and I done this:
create credential on Jenkins for gitlab user account
create access token on gitlab and use this token in Jenkins to enable it
and this is the job configuration
but when i start a build, after10 minutes i get this error
Started by user admin
Building in workspace /Users/Shared/Jenkins/Home/workspace/xxxxxxxxx
> /usr/bin/git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://gitlab.xxxxxxxxx.git # timeout=10
Fetching upstream changes from https://xxxxxxxx.git
> /usr/bin/git --version # timeout=10
using GIT_ASKPASS to set credentials
> /usr/bin/git fetch --tags --progress https://xxxxxxxxxx.git +refs/heads/*:refs/remotes/origin/*
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://gitlab.xxxxxxx.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:825)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1092)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1123)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:566)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:491)
at hudson.model.Run.execute(Run.java:1737)
at hudson.matrix.MatrixBuild.run(MatrixBuild.java:314)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:421)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --progress https://xxxxxxxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1970)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1689)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:380)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:823)
... 11 more
ERROR: Error fetching remote repo 'origin'
Finished: FAILURE
So... how do i solve this?
I think to solve the question. Follow this guide to add and enable jenkins user http://www.cimgf.com/2015/05/26/setting-up-jenkins-ci-on-a-mac-2/
and, at the moment, works. Thanks all
Check this option "Timeout (in minutes) for clone and fetch operations" under "Advanced Clone Behaviors"
Default time-out is 10min.

Resources