Travis run-check permission denied error solution? - java

I spent a few hours on searching how to resolve this error but can't find any solution to do so. My gradle build is successful, and this is the first time I am getting a permission denied for my run-checks.sh.
Even if I revert to old code that passes the travis checks, it gives me the same permission denied as well.
I was wondering is it affected by the idea/workspace.xml file?
Any idea how I could go about this?
0.00s$ ./config/travis/run-checks.sh && travis_retry ./gradlew clean
checkstyleMain checkstyleTest headless allTests coverage coveralls asciidoctor
copyDummySearchPage
/home/travis/.travis/job_stages: line 104: ./config/travis/run-checks.sh:
Permission denied

Travis is trying to run a file ./config/travis/run-checks.sh, but it doesn't have permissions to execute that file.
You'll need to give it permissions depending on where run-checks.sh lives. If this is something from your repo, you can give it permission to execute with:
git update-index --add --chmod=+x ./config/travis/run-checks.sh
git commit -m "Added permissions for run-checks.sh"
git push
If it's a script that's only available and found in travis' own environment, then you'll need travis to execute giving the permission.
before_script:
- chmod +x build.sh
Related: https://stackoverflow.com/a/42714604/245268

Related

Trying to set .policy java file with denied access network and access other files than source - mvn surefire plugin-Error while executing forked tests

Always I read your helpful post, but this is my first time that I didn't find a solution for my case and I am forced to write this post and asking you for your help.
I have problem with set up .policy java file to block access for network and files. Of course I read this 2 posts:
How to disable all network connections in Java
Disable "internet access" for JVM?
and many more other posts about this problem (this two I think are the closest to my case).
For beginning I tried to put in .policy file anything that will be worked when I will start command mvn clean install or mvn test.
So in my .policy file I've put the same code like in first link:
grant {
permission java.io.FilePermission "<<ALL FILES>>", "read,write,execute,delete";
permission java.util.PropertyPermission "*", "read,write";
permission java.lang.RuntimePermission "*";
permission java.net.NetPermission "*";
permission java.lang.reflect.ReflectPermission "*";
permission java.net.SocketPermission "*";
};
And after any maven command I received:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project zadanie2: There are test failures.
[ERROR]
[ERROR] Please refer to E:\projects\exampleProject\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C ""C:\Program Files\Java\jdk-18.0.1.1\bin\java" -jar C:\Users\xxx\AppData\Local\Temp\surefire2284009761624596034\surefirebooter17583345691919401837.jar C:\Users\xxx\AppData\Local\Temp\surefire2284009761624596034 2022-08-12T22-27-35_585-jvmRun1 surefire10226365412794941225tmp surefire_0532462194274044084tmp"
[ERROR]
[ERROR] Error while executing forked tests.Error while executing process.Cannot run program "cmd.exe" (in directory "E:\projects\exampleProject"): Malformed argument has embedded quote: "C:\Program Files\Java\jdk-18.0.1.1\bin\java" -jar C:\Users\xxx\AppData\Local\Temp\surefire2284009761624596034\surefirebooter17583345691919401837.jar C:\Users\xxx\AppData\Local\Temp\surefire2284009761624596034 2022-08-12T22-27-35_585-jvmRun1 surefire10226365412794941225tmp surefire_0532462194274044084tmporg.apache.maven.surefire.shade.org.apache.maven.shared.utils.cli.CommandLineException: Error while executing process.
[ERROR] at org.apache.maven.surefire.shade.org.apache.maven.shared.utils.cli.Commandline.execute(Commandline.java:412)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.lazytestprovider.OutputStreamFlushableCommandline.execute(OutputStreamFlushableCommandline.java:65)
[ERROR] at org.apache.maven.surefire.shade.org.apache.maven.shared.utils.cli.CommandLineUtils.executeCommandLineAsCallable(CommandLineUtils.java:229)
I also tried option from second link, but maven always needed new permission and I gave it, gave it and for last info was problem with converting AccessException into IOException.
Still same thing - is not working.
Do you have any example .policy file that for sure will be working with my API? Or any suggestions how I can solve it? What to change? What to do to block any network and file access other than necessary, for API?
I will be very grateful guys!

Sonarcloud is not authorized using Travis CI and Maven

I have an experimental project on my Github used for the practising the CI service integrations. I struggle with using Sonarcloud.
I have followed both Tavis CI + Sonarcloud tutorial and Maven example. Mz first confusion starts with the token and properties file whereas the first source suggests creating sonar-project.properties file and the Maven example source does not have any. Here where the documentation is very unclear.
I ignored the properties file and I have done the following steps:
Generated token on sonarcloud.io for my project: e53.....239
Encrypted token on travis-encrypt.github.io since it's the most comfortable way for a Windows user. The 2 following inputs resulted in g3s.....+Q=:
NicharNET/Gistintex
SONAR_TOKEN="e53...239" - I tried both to wrap between quotation marks and without.
Added to Settings -> Environment variable key SONAR_TOKEN with the value of the generated Sonarcloud token e53...239.
Completed travis.yml with the secure token:
language: java
sudo: false
jdk: oraclejdk8
addons:
sonarcloud:
organization: "nicharnet-github"
token:
secure: "g3sLTdS597mklh1I9HgXr71NRCiOk2n9I41PL2wklnAidwibfocyEcWvSQxjmbhNTjdrcW0cAfzh73Ago8hwfdloraryDY9Ng9L1runxayShtPOqZMPI6nz8zUwLaDfqJVwXWv6A3xICOMFl0UhvF351GPErHhrUO7YIa8el3kESeotYy7kkTzeQ7BA239y7EVFw8H4OCW2gjP2G/InxKnlXfNjgQA3GsnZdJ3uWO3No5kwt5ybfuCCV42cp/UczLIzNbo0RW9Z9jBl5IFMzJaUQUfWV3Pp5QEPmpB7Anr/4W1EtjJPjpSIC/+jBmbrkvC/CSzzTPjaH9LzEQ5m4F5JpRw01blqgKH/153qfs1jRgZK6WVRuhe7yAATHCO/IM0DM+kC0mUJTcXKyv9pRm93E4wp+KzdHYy0LdA83wFgMmvlB8pcm20ImAe7B2SBFx5TGtETa6ea6k2BS+DfBXe6sLBnrl1zZB8nxCDnYiwT1BJFxizgv3EJ6Krjd3cSSxr6PGnXDD/yTeFNJarpMbA+wR6AQetJ89LiDBXYiw6GPgWk/A4vUDIsIaXGqCpydeZHkr2ufS1Ap4yYS0Um2GeDeQXTsBTSCg7BViFgduUI1NPYT1avKg7b64nsdpdjBVofOvzJsgiT66WlaJmt23BUCJsnmXwwEcW1387b4G+Q="
script:
- mvn clean install org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar
Committed and pushed changes into the repository and Travis CI started to work and resulted in:
Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.4.1.1168:sonar (default-cli) on project gistintex: Not authorized. Please check the properties sonar.login and sonar.password.
The error could be found on my Travis CI build. What do I do wrong?
I have skimmed through Error using Travis CI with Sonarcloud: Not authorized. Please check the properties sonar.login and sonar.password SO question and Travis CI Sonarqube analysis article, which unfortunately didn't help me though. My GitHub project source.
I have tried to add these plugins to pom.xml and run the analysis locally:
org.codehaus.mojo: sonar-maven-plugin: 5.1
org.sonarsource.scanner.maven: sonar-maven-plugin: 3.4.1.1168
Running this on my machine resulted in the correct Sonarcloud analysis:
mvn sonar:sonar \
-Dsonar.organization=nicharnet-github \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.login=e53.....239
However, my goal is to run the analysis after every committed version using Travis CI. I am sure I have done wrong the key encryption but I can't figure what exactly.
The key encryption problem usually happens when you execute the generation without the login command against travis.com instead of travis.org
In order to run on every commit you could connect your repo with SonarCloud Scan, generate a secret in your sonarcloud.io project page and there you will find instructions to modify your .travis.yml
if you use travis.org
travis encrypt <YOUR_SONAR_SECRET>
if you use travis.com
travis login --pro
then generate your token like this:
travis encrypt --pro <YOUR_SONAR_SECRET>
finally you need to add your pipeline instruction to your .travis.yml file
Check in your Travis CI repo settings when it should be triggered
here some related links:
Error using Travis CI with Sonarcloud: Not authorized. Please check the properties sonar.login and sonar.password
https://docs.travis-ci.com/user/encryption-keys/#usage
https://github.com/marketplace/actions/sonarcloud-scan
https://sonarcloud.io/documentation/integrations/github/

Permission error when using Snyk for gradle wrapper in GitLab

I am trying to integrate Snyk into my GitLab CI pipeline. I install it with npm, authenticate with my personal token and run snyk test. I get the following error which prevents me from getting the results:
Testing /builds/User/pipeline...
Downloading https://services.gradle.org/distributions/gradle-4.5-all.zip
................................................................................
Unzipping /root/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4/gradle-4.5-all.zip to /root/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-4.5-all/cg9lyzfg3iwv6fa00os9gcgj4/gradle-4.5/bin/gradle
ERROR: Job failed: exit code 1

Can not run program, permission denied erro13 Jenkins

I created a new job for android new project on Jenkin. Whenever I run the job I got error java.io.ioexception error 13 permission denied. Jenkin says unable to run program gradlew. I know gradlew script need execution permissions according to the error explanation . I granted these and re run the jenkin job. I still get the same error. Jenkin revert the execution permission back after build. When I create new job from existing job and configured with old projects repository , it runs fine. when I configured with new project repository it raised permission issues. I played a lot with permission but no success. I also compared old and new project script file. There was few lines difference but it shouldn't be an issue. Any one can guide me what I am doing wrong.
Thanks
It is clearly a permission issue.
java.io.IOException: Cannot run program "<http://jenkins.gradlew"
error=13, Permission denied
Caused by: java.io.IOException: error=13, Permission denied
There are two solutions to resolve the gradlew permission issue.
Go to Jenkin Job configuration
Go to Build tab and check gradlew executable.
Jenkin will change the permission when you press build now. Keep in mind that these changes are uncommitted. The process works fine if your job is not a release job. If it is release job it creates another issue that I came across.
:workspace:app:checkCommitNeeded FAILED
:app:release FAILED
* What went wrong:
Execution failed for task ':workspace:app:checkCommitNeeded'.
> You have uncommitted files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
M gradlew
So work around is
commit gradlew with executable bit set:
git update-index --chmod=+x gradlew
git commit
Then you will no longer need the jenkins setting to set it executable, which is the workaround causing the 2nd issue.
Hopefully it would save someone time because I spent hours for the work around.
I was using Github for source code management. It was fetching code there and was updating it every single time, so changing it to +x before submitting my Jenkins job didn't help.
In Linux the project is at /.jenkins/workspace/MyProjectName/SomeSubFolder/gradlew - and it was loosing +x evereytime a new job was submitted (to 644, I think).
The solution was to select the Make gradlew executable checkbox (in Build --> Use Gradle Wrapper) - it is 755 now, and is executing gradle tasks.
Are you using a jenkinsfile for your job configuration?
If so you need to add the permission change for gradlew there.
sh 'chmod 755 ./gradlew'
It sounds like your gradlew is being replaced each time with a version that doesn't have the execute permission set so you will need to do it as part of the jenkins job either via a script or the jenkinsfile.

ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")

When starting for example Elasticsearch 5.5 :
main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
Workaround with Oracle Java 1.8.0_131 is to open file <jre>/lib/security/java.policy and add this line to grant section (i.e. between curly brackets):
permission javax.management.MBeanTrustPermission "register";
Why workaround? The upright solution would be to specify extra grant section which code exactly should get this permission.
got the same error and the answer is here java.security.AccessControlException when using Ant, but runs ok when invoking java from console
Append the grant section in java.policy file with
permission javax.management.MBeanTrustPermission "register";
I had this same issue when moving from a single instance to two instances locally.
I tried what Alice suggested above. Even re-installed Elasticsearch (5.5.0).
I also updated my Java to the latest one for Linux provided by Oracle.
Nothing was working. Then I discovered, that I couldn't just take the elasticsearch-5.5.0/config directory and rename it to elasticsearch-5.5.0/node1.
So... I had to leave that config directory in place and clone it to node1/node2.
EVEN if I configure path.config in the runtime args, ES still needs that base line config directory.
Hope this helps.
I faced same issue on Ubuntu-16.04 system.
Solution:
ElasticSeearch service is not allowed to run for "ROOT" user. That's why change the ownership of elasticsearch folder with below command:
go to Elasticseach installation directory
$ sudo chown -R user_name:user_Group elasticsearch-5.5.0
$/bin/elasticsearch
this will start elasticsearch service. It is working form me perfectly.

Categories