1.下載war包
2.安裝
java -jar jenkins.war
Error:
Feb 21, 2019 2:17:25 AM winstone.Logger logInternal
SEVERE: Container startup failed
java.io.IOException: Failed to start Jetty
at winstone.Launcher.<init>(Launcher.java:186)
at winstone.Launcher.main(Launcher.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Main._main(Main.java:344)
at Main.main(Main.java:160)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.server.Server.doStart(Server.java:395)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at winstone.Launcher.<init>(Launcher.java:184)
... 7 more
解決:
修改Jenkins端口java -jar jenkins.war --httpPort=8081
jenkins plugin提示: Update information obtained: 不可用 ago;
出現堆棧錯誤;
解決:
我們將.jenkins/hudson.model.UpdateCenter.xml文件內容中的https://updates.jenkins.io/update-center.json改為http://updates.jenkins.io/update-center.json即可;即為https協議改為http協議;然后我們重啟一下jenkins,插件即可正常搜索訪問;
jenkins時區設置為上海時間
打開 【系統管理】->【腳本命令行】運行下面的命令
System.setProperty('org.apache.commons.jelly.tags.fmt.timeZone', 'Asia/Shanghai')
jenkins 關閉和重啟實現方式.
1、關閉Jenkins
只需要在訪問jenkins服務器的網址url地址后加上exit。例如我jenkins的地址http://localhost:8080/,那么我只需要在瀏覽器地址欄上敲下http://localhost:8080/exit 網址就能關閉jenkins服務.
2、重啟Jenkies
http://localhost:8080/restart
3、重新加載配置信息
http://localhost:8080/reload
3.項目配置(gerrit提交patch動態觸發jenkins自動編譯)
①建立gerrit服務器連接
②確保手動觸發的可執行性
③項目動態觸發條件配置
4.構建腳本
以下是構建腳本可能需要的一些參數,僅供參考:
-----------------------------------------------------------Gerrit--triggered--parameters-------------------------------------------------------------
Trigger the build on Gerrit events.
The triggered build will be provided with the following parameters:
For all events
GERRIT_PROJECT: The name of the project.
GERRIT_EVENT_TYPE: The type of this event.
GERRIT_EVENT_HASH: A unique hash making all triggered builds unique in the queue.
GERRIT_EVENT_ACCOUNT: The name and email of the account associated with the event, if any. "Name" <name@somewhere.com>.
GERRIT_EVENT_ACCOUNT_NAME: The name of the account associated with the event, if any.
GERRIT_EVENT_ACCOUNT_EMAIL: The email of the account associated with the event, if any.
GERRIT_NAME: The name of the Gerrit instance that provided the event.
GERRIT_HOST: The hostname of the Gerrit instance that provided the event.
GERRIT_PORT: The port number of the Gerrit instance that provided the event.
GERRIT_SCHEME: The protocol name of the Gerrit instance that provided the event.
GERRIT_VERSION: The version number of the Gerrit instance that provided the event.
For events on a change (Patch set created, Draft published, Change merged, Change abandoned, Change restored, Comment added)
GERRIT_CHANGE_ID: The Change-Id.
GERRIT_CHANGE_SUBJECT: The first line of the commit message.
GERRIT_CHANGE_COMMIT_MESSAGE: The full commit message, UTF-8 Base64 encoded. (Only when Gerrit version is 2.8 or above).
GERRIT_CHANGE_NUMBER: The change number.
GERRIT_CHANGE_URL: The URL to the change.
GERRIT_PATCHSET_NUMBER: The Patch Set number.
GERRIT_PATCHSET_REVISION: The Patch Set revision id.
GERRIT_BRANCH: The name of the branch.
GERRIT_TOPIC: The name of the topic.
GERRIT_REFSPEC: The ref-spec. (refs/changes/xx/xxxx/z).
GERRIT_CHANGE_OWNER: The name and email of the owner of the change "Name" <name@somewhere.com>.
GERRIT_CHANGE_OWNER_NAME: The name of the owner of the change.
GERRIT_CHANGE_OWNER_EMAIL: The email of the owner of the change.
GERRIT_PATCHSET_UPLOADER: The name and email of the uploader of the Patch Set "Name" <name@somewhere.com>.
GERRIT_PATCHSET_UPLOADER_NAME: The name of the uploader of the Patch Set.
GERRIT_PATCHSET_UPLOADER_EMAIL: The email of the uploader of the Patch Set.
GERRIT_PATCHSET_ABANDONER: The name and email of the abandoner of the Patch Set "Name" <name@somewhere.com>.
GERRIT_PATCHSET_ABANDONER_NAME: The name of the abandoner of the Patch Set.
GERRIT_PATCHSET_ABANDONER_EMAIL: The email of the abandoner of the Patch Set.
GERRIT_PATCHSET_RESTORER: The name and email of the restorer of the Patch Set "Name" <name@somewhere.com>.
GERRIT_PATCHSET_RESTORER_NAME: The name of the restorer of the Patch Set.
GERRIT_PATCHSET_RESTORER_EMAIL: The email of the restorer of the Patch Set.
Additionally for Change merged events
GERRIT_NEWREV: The revision of the merge commit.
Additionally for Comment added events
GERRIT_EVENT_COMMENT_TEXT: The comment posted to Gerrit, UTF-8 Base64 encoded.
For Reference updated events
GERRIT_REFNAME: Ref name within project.
GERRIT_OLDREV: The old value of the ref, prior to the update.
GERRIT_NEWREV: The new value the ref was updated to.
The parameters will be available to the build as environment variables. E.g. $GERRIT_REFSPEC