Jenkins cannot read json file - docker

I am trying to use postman/newman to auto test my API collection on Jenkins(build on docker),
I have successfully used the following shell (the url is the sample on postman Official website)
newman run "https://www.postman.com/collections/8a0c9bc08f062d12dcda"
but while I change the url to my own collection(I put in my git project),
url : newman run "http://localhost:8080/job/projectName/ws/pm/collection.json"
the eror messqge shows that
+ newman run http://localhost:8080/job/projectName/ws/pm/collection.json
error: collection could not be loaded
the url "http://localhost:8080/job/xxx/ws/pm/collection.json" did not provide valid JSON data
Unexpected token '<' at 1:1
<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fjob%2Fmone
^
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I also tried
url : newman run "localhost:8080/job/projectName/ws/pm/collection.json"
and the error code become
error: collection could not be loaded
unable to read data from file "localhost:8080/job/projectName/ws/pm/collection.json"
ENOENT: no such file or directory, open 'localhost:8080/job/projectName/ws/pm/collection.json'
Anyone can help? Please!!!

I just fix the path and it works!
The path should be pm/collection.json
http://localhost:8080/job/xxx/ws/pm/collection.json is from workspace

Related

bazel could not build anything after i delete some files in my .cache in my home directory

I tried to reinstall bazel, so i deleted all the bazel files in the .cache in my home directory.
After i reinstall bazel using the steps provided on the official website, it always returned me error when i tried to compile something.
the error message is:
ERROR:/home/user/..cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/build_bazel_rules_apple/apple/internal/ios_rules.bzl:164:9: name 'coverage_common' is not defined
ERROR: /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/build_bazel_rules_apple/apple/internal/testing/apple_test_bundle_support.bzl:303:9: name 'coverage_common' is not defined
ERROR: Skipping ':all': while parsing ':all': error loading package '': in /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl: in /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/build_bazel_rules_apple/apple/ios.bzl: in /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/build_bazel_rules_apple/apple/internal/testing/ios_rules.bzl: Extension 'apple/internal/testing/apple_test_bundle_support.bzl' has errors
ERROR: while parsing ':all': error loading package '': in /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/com_github_grpc_grpc/bazel/grpc_build_system.bzl: in /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/build_bazel_rules_apple/apple/ios.bzl: in /home/user/.cache/bazel/_bazel_user/99057f7f4b9c8642f84cd97e14ed25f4/external/build_bazel_rules_apple/apple/internal/testing/ios_rules.bzl: Extension 'apple/internal/testing/apple_test_bundle_support.bzl' has errors
How can i fix these errors?

Why SonarScanner ignores sonar.sources value (You must define the following mandatory properties)?

I would like you to help me with a problem that I have when executing: 'build now', because when I execute it the console output shows a series of failures
One of the failures was and still is, the properties of the file, I have already configured them and it is still giving faults, I have also saved them in the project directory, but nothing keeps failing.
these are the properties which i have in my project
sonar.projectKey=sistema_integracion
sonar.projectName=sistema_integracion
sonar.projectVersion=1.0
sonar.projectDescription=proyecto_asir
sonar.source=C:\Program Files (x86)\Jenkins\workspace\proyecto_integracion\spring_boot\src\main\java\hello
sonar.language=java
sonar.java.binaries=.
sonar.sourceEncoding=UTF-8
sonar.scm.disabled=True
-And these are the flaws , I would appreciate all the help possible.
Thank you so much.
ERROR: Error during SonarQube Scanner execution
ERROR: You must define the following mandatory properties for 'sistema_integracion': sonar.sources
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeeded?
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE
Here is your problem:
ERROR: You must define the following mandatory properties for 'sistema_integracion': sonar.sources
You defined an absolute path:
sonar.source=C:\Program Files (x86)\Jenkins\workspace\proyecto_integracion\spring_boot\src\main\java\hello
The path must be relative. If this is your file structure:
sonar-project.properties
src
\-main
\-java
Then you should set:
sonar.sources=src/main/java

allure-results does not exists in Jenkins

Allure results are generated (xmls) and can be viewed by running allure serve outside the allure-results directory but when configured in Jenkins using the allure results directory with relative path from Jenkins workspace, the allure results are not found. Presumably there is something wrong with the path
[allure_test] $ /Users/me/.jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/Allure_2.7.0/bin/allure generate -c -o /Users/me/.jenkins/workspace/allure_test/allure-report
allure-results does not exists
Report successfully generated to /Users/me/.jenkins/workspace/allure_test/allure-report
Allure report was successfully generated.
Relative Path defined for allure report is
../../repos/partner-portal/target/allure-results
The report is generated but with no results
Here is the solution:
1. Inside your work space (For me it is D:\m\Automation Project\Tests), Create a folder named "target" containing two subfolders "allure-results" and "allure-reports".
In Post Build Actions of Jenkins Project provide these entries.
Results: target/allure-results
Report Path: target/allure-reports
Now run your tests and allure reports will be generated without any issues.
I struggled for over 24 hours and could not sleep whole night just because of this issue. There were no clear instructions related to this and how it works. Finally, I figured it out.
May be its little too late for this answer but could you please create the "allure-results" folder in your workspace (like /Users/me/.jenkins/workspace/allure_test/allure-results)?
After I configure Allure report in jenkins, and using behave command, I finally see following output and saw the working report in my jenkins build plan:
.
.
.
.
D:\PythonProject\PythonBehave>behave -f allure_behave.formatter:AllureFormatter -o C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-results D:\PythonProject\PythonBehave\features
Failing scenarios:
features/example.feature:17 user can search text in google -- #2.2 Incorrect
features/github_login.feature:13 User attempt to login with wrong username and password -- #1.1 InCorrect
features/github_login.feature:14 User attempt to login with wrong username and password -- #1.2 InCorrect
features/github_login.feature:18 User attempt to login with correct username and password
0 features passed, 2 failed, 0 skipped
3 scenarios passed, 4 failed, 0 skipped
12 steps passed, 4 failed, 8 skipped, 0 undefined
Took 3m24.651s
D:\PythonProject\PythonBehave>exit 1
Build step 'Custom Python Builder' marked build as failure
[PythonAllure] $ C:\Users\Alex\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\Allure_2.13.1\bin\allure.bat generate C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-results -c -o C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-report
Report successfully generated to C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-report
Allure report was successfully generated.
Creating artifact for the build.
Artifact was added to the build.
Finished: FAILURE
And before I used to get this output when there was no allure-results folder in my workspace:
[PythonAllure] $ C:\Users\Alex\.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\Allure_2.13.1\bin\allure.bat generate -c -o C:\Users\Alex\.jenkins\workspace\PythonAllure\allure-report
we are not using any post-build steps on UI but using jenkins pipeline groovy script as below:
def allureReportsGenerationTask() {
try {
allure([includeProperties: false, jdk: '', properties: [], reportBuildPolicy: 'ALWAYS', results: [[path: 'target/allure-results']]])
} catch(Exception error) {
println("Caught Exception: ${error}")
}
}
The project structure was like that only
ProjectRepo
- src
- target
-alure-results
- pom.xml
- testng.xml
In this case, we are getting the allure-results getting generated but it was not getting picked in the Jenkins pipeline allure plugin. ON UI below command was running always
/opt/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/bin/allure generate -c -o /opt/jenkins/workspace/ProjectRepoPipeline/allure-report
you can see Jenkins was not able to find allure-results for generating parameters in the above Jenkins pipeline command
We added the below parameter in pom.xml maven-surefire-plugin
<systemPropertyVariables>
<allure.results.directory>../target/allure-results</allure.results.directory>
</systemPropertyVariables>
Now project structure becomes
-ProjectRepo
- src
- pom.xml
- testng.xml
target
-allure-results
Now on running the same via pipeline script, we were able to run the below command
/opt/jenkins/tools/ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation/allure/bin/allure generate /opt/jenkins/workspace/ProjectRepoPipeline/target/allure-results -c -o /opt/jenkins/workspace/ProjectRepoPipeline/allure-report
ProjectRepoPipeline - This is the Jenkins pipeline name that is running CI/CD

Custom Ant Task Not Working On Build Server

I've got a custom Ant task that I'm using successfully from gradle on my local machine:
task fetchRelMod {
doLast {
println 'Fetching the RelMod'
ant.taskdef(name:'relmod',
classpath:'retrievePBSInfo.jar:hsjt400-4-9.jar',
classname:"com.myco.ant.tasks.RetrievePBSRelModString")
ant.relmod(user:project.ext.props.getProperty('fetchrelmod.username'),
password:project.ext.props.getProperty('fetchrelmod.password'),
prodCode:project.ext.props.getProperty('profile.pbs.product.code'),
branch:project.ext.props.getProperty('profile.pbs.branch'),
state:project.ext.props.getProperty('profile.pbs.relmod.selector'))
project.ext.set('iseries_relmod',ant.relmodStub)
project.ext.set('iseries_relmodAndDate', ant.relmod)
}
}
I've got the jar files sitting next to build.gradle for now, out of simplicity... they exist in the same location on the build server. Works great locally. When I run my build from my build server (either through Jenkins or going on the box and running Gradle directly), I get the following:
sudo /var/lib/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle214/bin/gradle all -DisQUABuild=true
Building My App
Loading Properties files...
QUA Build. Using build-qua.props
:fetchRelMod
Fetching the RelMod
:fetchRelMod FAILED
FAILURE: Build failed with an exception.
* Where:
Build file '/var/lib/jenkins/workspace/MyApp/build.gradle' line: 141
* What went wrong:
Execution failed for task ':fetchRelMod'.
> taskdef class com.myco.ant.tasks.RetrievePBSRelModString cannot be found
using the classloader AntClassLoader[/var/lib/jenkins/workspace/myApp/hsjt400-4-9.jar]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.104 secs
What concerns me is that there are two jar files in the classpath and it only mentions one in the error. Does anyone have any ideas as to what might be going on?

Unable to run the demo setup

I have downloaded the Activity 5.10 zip file and then i have downloaded and configured the Apache ANT and i test it and it worked successfully.
But i am unable to run the demo file as specified in this link http://activiti.org/userguide/#demo.setup
if i type the following using the cmd command line:-
C:\activiti-5.10\activiti-5.10\setup>ant demo.start
I will get the following error:-
'ant' is not recognized as an internal or external command, operable program or batch file.
Can anyone help me in identifying what is the problem?
BR
:::UPDATE:::
thanks for the reply, i have copied the ANT bin files inside the setup directory for the activity,, then i run the CMD command again ,, but i got the following error that i build failed,,
AS MENTIONED BELOW:-
C:\Users\Desktop\activiti-5.10\activiti-5.10\setup>ant demo.start
Buildfile: C:\Users\Desktop\activiti-5.10\activiti-5.10\setup\build.xml
demo.install:
internal.cfg.create:
[copy] Copying 1 file to C:\Users\Desktop\activiti-5.10\activiti-5.
10\setup\build\activiti-cfg
[zip] Building zip: C:\Users\Desktop\activiti-5.10\activiti-5.10\s
etup\build\activiti-cfg.jar
[echo] copying configuration to ../workspace/activiti-engine-examples/src/m
ain/config
[unzip] Expanding: C:\Users\Desktop\activiti-5.10\activiti-5.10\setu
p\build\activiti-cfg.jar into C:\Users\Desktop\activiti-5.10\activiti-5.
10\workspace\activiti-engine-examples\src\main\config
internal.classpath.libs:
internal.taskdef.launch:
h2.start:
[echo] starting H2 database...
[launch] launching cmd 'C:\Users\Desktop\activiti-5.10\activiti-5.10\
apps\h2\h2.start.bat ' in dir 'C:\Users\Desktop\activiti-5.10\activiti-5
.10\apps\h2'
[launch] waiting for launch completion msg 'TCP server running'...
[launch] 'java' is not recognized as an internal or external command,
[launch] operable program or batch file.
[launch] launched process completed
[echo] H2 database started
tomcat.start:
BUILD FAILED
C:\Users\Desktop\activiti-5.10\activiti-5.10\setup\build.xml:330: couldn
't find executable for script C:\Users\Desktop\activiti-5.10\activiti-5.
10\apps\apache-tomcat-6.0.32\bin\startup
Total time: 0 seconds
Looks like you didn't set the ant directory in you path variable. Either specifiy the entire path to ant or add it to the path variable
I typed tomcat.install and it solved the problem since I need to download the tomcat inside the apps directory.

Resources