Jenkins uses the Snky plugin, scans the code and gets the following error
Could not parse generated json report file.
hecking out Revision 20975c2ae7c716f256cbb51f711285cc881f4609 (refs/remotes/origin/develop)
> git config core.sparsecheckout # timeout=1200
> git checkout -f 20975c2ae7c716f256cbb51f711285cc881f4609 # timeout=1200
Commit message: "delete test code"
> git rev-list --no-walk 20975c2ae7c716f256cbb51f711285cc881f4609 # timeout=1200
Snyk installation is UP-TO-DATE
Testing for known issues...
>
/var/lib/jenkins/tools/io.snyk.jenkins.tools.SnykInstallation/DevelopSnyk/node_modules/.bin/snyk test --json --severity-threshold=low --org=KRIS --project-name=KRISADMIN_4.6
**Could not parse generated json report file.**
Build step 'Invoke Snyk Security task' changed build result to FAILURE
Build step 'Invoke Snyk Security task' marked build as failure
Finished: FAILURE
Related
Running as SYSTEM
Building in workspace /Users/mac/.jenkins/workspace/trainSchedule
The recommended git tool is: NONE
No credentials specified
git rev-parse --resolve-git-dir /Users/mac/.jenkins/workspace/trainSchedule/.git # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins # timeout=10
Fetching upstream changes from https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins
git --version # timeout=10
git --version # 'git version 2.30.1 (Apple Git-130)'
git fetch --tags --force --progress -- https://github.com/linuxacademy/cicd-pipeline-train-schedule-jenkins +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/master^{commit} # timeout=10
Checking out Revision 1603f84d1f50794623c71673920fc3111280045f (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f 1603f84d1f50794623c71673920fc3111280045f # timeout=10
Commit message: "specify a newer version of node and npm"
First time build. Skipping changelog.
[Gradle] - Launching build.
[trainSchedule] $ /Users/mac/.jenkins/workspace/trainSchedule/gradlew build
FAILURE: Build failed with an exception.
What went wrong:
Could not determine java version from '19'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Archiving artifacts
Finished: FAILURE
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.
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.
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.
I am writing my first Jenkins pipeline. Its basic goal for now is just to sequentially run a bunch of jobs in a pipeline, to which I will later add different functionality. I am trying to use propagate: false so I can handle specific failures myself, instead of the pipeline exiting with an error as soon as a job fails. Note that in the code snippet I'm showing 2 different approaches I've tried (job a and job b. In reality there are about a dozen jobs) that basically return the same stacktrace. I'm stumped. If I try it in the pipeline's script box, it works. But if I do it in the jenkinsfile I get an error.
EDIT: forgot to mention - jenkins version - 2.7.4
Code:
#!groovy
def SUCCESS_LIST = ["SUCCESS", "UNSTABLE"]
stage "Unit Tests"
node ('k8s'){
echo 'Running unit tests..'
currentBuild.result = "SUCCESS"
a = build job 'Some Unit Tests', propagate: false
b = build("Other System Unit Tests"), propagate: false
jobsList<Object> = [a, b]
// check if there was a failure. if so - mark job as 'failed'.
for (job in jobsList){
if (!SUCCESS_LIST.contains(job.result)) {
//currentBuild.result = "FAILURE"
mail to: amos#company_mail.com, subject: 'The Pipeline failed at unit-tests'
}
}
}
stacktrace:
Started by user Amos B
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/my-company/companyone.git # timeout=10
Fetching upstream changes from https://github.com/my-company/companyone.git
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username automation#my-company.com # timeout=10
> git config --local credential.helper store --file=/tmp/git6347898027159980380.credentials # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/my-company/companyone.git +refs/heads/*:refs/remotes/origin/*
> git config --local --remove-section credential # timeout=10
> git rev-parse refs/remotes/origin/develop^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/develop^{commit} # timeout=10
Checking out Revision 5d349a17a9ee89d340b63db92a71e159780ea7ad (refs/remotes/origin/develop)
> git config core.sparsecheckout # timeout=10
> git checkout -f 5d349a17a9ee89d340b63db92a71e159780ea7ad
> git rev-list 65a8a33381ae18a1aefdd57a7d64fd3a475407fb # timeout=10
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 8: expecting '}', found ',' # line 8, column 49.
ild job 'Knowledge Unit Tests', propagat
^
1 error
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.ErrorCollector.addFatalError(ErrorCollector.java:150)
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:120)
at org.codehaus.groovy.control.ErrorCollector.addError(ErrorCollector.java:132)
at org.codehaus.groovy.control.SourceUnit.addError(SourceUnit.java:360)
at org.codehaus.groovy.antlr.AntlrParserPlugin.transformCSTIntoAST(AntlrParserPlugin.java:145)
at org.codehaus.groovy.antlr.AntlrParserPlugin.parseCST(AntlrParserPlugin.java:111)
at org.codehaus.groovy.control.SourceUnit.parse(SourceUnit.java:237)
at org.codehaus.groovy.control.CompilationUnit$1.call(CompilationUnit.java:167)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:931)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:410)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:373)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:213)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:410)
Finished: FAILURE
It's the exact same error no matter which syntax (a or b) is used. what am I missing?
You should do this to call other jobs from your pipeline. The lack of a colon after job is throwing the error:
build job: 'job-name'