<commit_before>---
layout: post
title: Jenkins使用
tags:
- Jenkins
categories: Tools
description: Jenkins配置 使用
---

# 一，与GitLab使用

 1. 下载并安装插件“GitLab Plugin”和“Git plugin”    
  
	![](https://thumbnail0.baidupcs.com/thumbnail/0651e7c147c41542647a98c866cb8266?fid=354717987-250528-834110623132902&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-QcNP4yudaQyYfEoNeKs%2B9%2BTyak0%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

2. 在“系统管理”的“系统设置”中的“Gitlab”添加” Gitlab host URL”和“API Token”和勾选”Ignore SSL Certificate Errors” 

	![](https://thumbnail0.baidupcs.com/thumbnail/112c6fe9c18a7d0b174dd27a1b791860?fid=354717987-250528-1095860993020438&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-YYWe3wQbvxHIo09g5iR7WtZqrwE%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

3. 新建项目，源码管理，勾选”Git”, “Credentials”，ssh设置“id_rsa”文件的全部内容 

	![](https://thumbnail0.baidupcs.com/thumbnail/70cff7b6a22bcf061c0db7a66a259d36?fid=354717987-250528-317917118347545&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-9zF7H4RAURE9pBegeplx8iZzQ0E%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

 
	![](https://thumbnail0.baidupcs.com/thumbnail/065a5c63173d30ceba76357dc524b289?fid=354717987-250528-109215184157001&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-bniAzTyiIF9IlCcj1fKsyytRoZk%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

# 二，相关问题

### 一

--- ruby
What went wrong: 
Execution failed for task ‘:app:processDebugResources’. 
A problem occurred starting process ‘command ‘/usr/local/android-sdk-linux/build-tools/23.0.2/aapt”
---

__原因__  
缺少32库

__解决__

```
sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1  
1
```

### 问题2

```
FATAL: command execution failed 
java.io.IOException: Cannot run program “gradle” (in directory “/home/zhaoliu/.jenkins/workspace/test”): error=2, 没有那个文件或目录 
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) 
at hudson.ProcLocalProc.(Proc.java:244)athudson.ProcLocalProc.(Proc.java:216) 
at hudson.LauncherLocalLauncher.launch(Launcher.java:816)athudson.LauncherProcStarter.start(Launcher.java:382) 
at hudson.LauncherProcStarter.join(Launcher.java:389)athudson.plugins.gradle.Gradle.performTask(Gradle.java:262)athudson.plugins.gradle.Gradle.perform(Gradle.java:116)athudson.tasks.BuildStepMonitor1.perform(BuildStepMonitor.java:20) 
at hudson.model.AbstractBuildAbstractBuildExecution.perform(AbstractBuild.java:785)athudson.model.BuildBuildExecution.build(Build.java:205) 
at hudson.model.BuildBuildExecution.doRun(Build.java:162)athudson.model.AbstractBuildAbstractBuildExecution.run(AbstractBuild.java:537) 
at hudson.model.Run.execute(Run.java:1741) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:98) 
at hudson.model.Executor.run(Executor.java:410) 
Caused by: java.io.IOException: error=2, 没有那个文件或目录 
at java.lang.UNIXProcess.forkAndExec(Native Method) 
at java.lang.UNIXProcess.(UNIXProcess.java:186) 
at java.lang.ProcessImpl.start(ProcessImpl.java:130) 
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) 
… 16 more
```

__原因__   
即使配置了gradle_home它也找不到

__解决__   
[Manage Jenkins]-〉[Configure System]配置本地gradle 路径，然后再 在项目配置里边 Gradle Version 选择你刚刚配置的那个gradle name

### 问题3

```
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence. 
java.lang.RuntimeException: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. 
at com.android.build.gradle.internal.SdkHandler.getAndCheckSdkFolder(SdkHandler.java:140) 
at com.android.build.gradle.internal.SdkHandler.getSdkLoader(SdkHandler.java:150) <commit_msg>nothing<commit_after>---
layout: post
title: Jenkins使用
tags:
- Jenkins
categories: Tools
description: Jenkins配置 使用
---

# 一，与GitLab使用

 1. 下载并安装插件“GitLab Plugin”和“Git plugin”    
  
	![](https://thumbnail0.baidupcs.com/thumbnail/0651e7c147c41542647a98c866cb8266?fid=354717987-250528-834110623132902&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-QcNP4yudaQyYfEoNeKs%2B9%2BTyak0%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

2. 在“系统管理”的“系统设置”中的“Gitlab”添加” Gitlab host URL”和“API Token”和勾选”Ignore SSL Certificate Errors” 

	![](https://thumbnail0.baidupcs.com/thumbnail/112c6fe9c18a7d0b174dd27a1b791860?fid=354717987-250528-1095860993020438&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-YYWe3wQbvxHIo09g5iR7WtZqrwE%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

3. 新建项目，源码管理，勾选”Git”, “Credentials”，ssh设置“id_rsa”文件的全部内容 

	![](https://thumbnail0.baidupcs.com/thumbnail/70cff7b6a22bcf061c0db7a66a259d36?fid=354717987-250528-317917118347545&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-9zF7H4RAURE9pBegeplx8iZzQ0E%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

 
	![](https://thumbnail0.baidupcs.com/thumbnail/065a5c63173d30ceba76357dc524b289?fid=354717987-250528-109215184157001&time=1470013200&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-bniAzTyiIF9IlCcj1fKsyytRoZk%3D&expires=2h&chkv=0&chkbd=0&chkpc=&dp-logid=2108252325&dp-callid=0&size=c850_u580&quality=100)

# 二，相关问题

### 问题一

	What went wrong: 
	Execution failed for task ‘:app:processDebugResources’. 
	A problem occurred starting process ‘command ‘/usr/local/android-sdk-linux/	build-tools/23.0.2/aapt”

__原因__  
缺少32库

__解决__

```
sudo apt-get install -y libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1  
1
```

### 问题二

```
FATAL: command execution failed 
java.io.IOException: Cannot run program “gradle” (in directory “/home/zhaoliu/.jenkins/workspace/test”): error=2, 没有那个文件或目录 
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047) 
at hudson.ProcLocalProc.(Proc.java:244)athudson.ProcLocalProc.(Proc.java:216) 
at hudson.LauncherLocalLauncher.launch(Launcher.java:816)athudson.LauncherProcStarter.start(Launcher.java:382) 
at hudson.LauncherProcStarter.join(Launcher.java:389)athudson.plugins.gradle.Gradle.performTask(Gradle.java:262)athudson.plugins.gradle.Gradle.perform(Gradle.java:116)athudson.tasks.BuildStepMonitor1.perform(BuildStepMonitor.java:20) 
at hudson.model.AbstractBuildAbstractBuildExecution.perform(AbstractBuild.java:785)athudson.model.BuildBuildExecution.build(Build.java:205) 
at hudson.model.BuildBuildExecution.doRun(Build.java:162)athudson.model.AbstractBuildAbstractBuildExecution.run(AbstractBuild.java:537) 
at hudson.model.Run.execute(Run.java:1741) 
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
at hudson.model.ResourceController.execute(ResourceController.java:98) 
at hudson.model.Executor.run(Executor.java:410) 
Caused by: java.io.IOException: error=2, 没有那个文件或目录 
at java.lang.UNIXProcess.forkAndExec(Native Method) 
at java.lang.UNIXProcess.(UNIXProcess.java:186) 
at java.lang.ProcessImpl.start(ProcessImpl.java:130) 
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028) 
… 16 more
```

__原因__   
即使配置了gradle_home它也找不到

__解决__   
[Manage Jenkins]-〉[Configure System]配置本地gradle 路径，然后再 在项目配置里边 Gradle Version 选择你刚刚配置的那个gradle name

### 问题三

```
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence. 
java.lang.RuntimeException: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. 
at com.android.build.gradle.internal.SdkHandler.getAndCheckSdkFolder(SdkHandler.java:140) 
at com.android.build.gradle.internal.SdkHandler.getSdkLoader(SdkHandler.java:150) 
{'fraction_non_alphanumeric': 0.12188014696566578, 'fraction_numerical': 0.1345496009122007, 'mean_word_length': 8.115473441108545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1435159', 'n_tokens_mistral': 4063, 'n_tokens_neox': 3412, 'n_words': 326}