1. 程式人生 > >Jenkins + Github持續集成構建Docker容器,維基百科&人工自能(AI)模塊

Jenkins + Github持續集成構建Docker容器,維基百科&人工自能(AI)模塊

tro mail topic 計劃任務 nts state all event feature

本文分兩部分,第一部分是手動計劃任務的方式構建Github上的Docker程序,第二部分是用Github webhook Trigger一個自動構建任務。

Jenkins采用2.5版本
Docker采用1.7.1
代碼托管使用的Github官網
系統為IBM Bluemix提供的Cent6.7,服務器地址在美國南加州

1.1 創建一個Freestyle Project, let‘s say jenkins-docker

1.2 Set workplace to /var/lib/jenkins/jobs/jenkins-docker/workplace

1.3 Add Github address:[email protected]:sangrealest/Jenkins_Docker_Ansible.git

技術分享圖片

Dockerfile 很簡單,就是拉取最新的Nginx,並將2048遊戲添加到Nginx根目錄

FROM nginx:latest
MAINTAINER Shanker [email protected]
ADD 2048-master /usr/share/nginx/html
ADD testfile /root/
EXPOSE 80


1.4 Under Build Triggers, set Poll SCM: H * * * *

1.5 Under Build->Execute shell, use below shell script:

#!/bin/sh
echo ‘>>> Get old container id‘
CID=$(docker ps | grep "jenkins-docker" | awk ‘{print $1}‘)
echo $CID
sudo /usr/bin/docker build -t jenkins-docker /var/lib/jenkins/jobs/jenkins-docker/workspace | tee /var/lib/jenkins/jobs/jenkins-docker/workspace/Docker_build_result.log
echo ‘>>> Stopping old container‘
if [ "$CID" != "" ];then
sudo /usr/bin/docker stop $CID
fi
echo ‘>>> Restarting docker‘
sudo service docker restart
sleep 5

echo ‘>>> Starting new container‘
sudo /usr/bin/docker run -p 3000:80 -d jenkins-docker

1.6 配置jenkins用戶

因為jenkins service是用jenkins用戶啟動的,所有要執行docker相關命令需要將jenkins加入到docker group,賦予jenkins sudo without password

sudo usermod -G docker jenkins
visudo, add bellow
jenkins ALL=(ALL:ALL) NOPASSWD: ALL"

然後Build Project, 如果成打開運行Jenkins機器的3000端口會看到2048遊戲的界面:

技術分享圖片

以上的構建是基於計劃任務的,每小時的隨機分鐘內執行一次構建任務(SCM H * * * *),然後懶人還有懶人的做法,就是添加Github webhook功能,當push一個更新的時候自動trigger一次構建。

2.1 在Github個人主頁上安裝Github Plugin並添加你的Jenkins server的webhook地址:比如我的Jenkins地址是mywebsite.com:8080,這裏要寫的地址就應該是http://mywebsite.com:8080/github-webhook

技術分享圖片

2.2 返回jenkins-docker項目首頁,點擊 Configure, 添加Github的賬號密碼信息,因為我用的個人倉庫,需要使用私鑰認證,選擇Certificate, 將放在jenkins home/.ssh 下的私鑰路徑填上:

技術分享圖片

2.3 Build Triggers 勾上Build when a change is pushed to Github

技術分享圖片

2.4 這時候可以更新一下Github Project下面的文件並且push一下,看看是否觸發了jenkins的構建動作:
如圖,我剛push完成,jenkins這邊就已經捕捉到並且開始構建新的任務:

技術分享圖片

技術分享圖片

我們在Github項目地下echo 一句話到testfile,並且添加到容器的/root下時間是7:49:58,然後我的容器更新後並啟動運行的時間是7:50:26,只用了28秒鐘就構建成功了!

技術分享圖片

技術分享圖片

有了這樣的集成,後續我們就可以考慮將Ansible也加進來,做持續部署,當把jenkins pipeline, docker, ansible都集成到一起,就是CI/CD完全集成工作了,或者用Mesos+Marathon+Docker雲數據中心的方式來做持續部署。

歡迎補充!

域網內利用GitLab+Jenkins自動生成GitBook並發布(Nginx) http://www.linuxidc.com/Linux/2016-05/131136.htm

Linux+Git+Maven+Jenkins+Neuxs自動化編譯環境搭建 http://www.linuxidc.com/Linux/2016-02/128652.htm

在CentOS 7上安裝Jenkins http://www.linuxidc.com/Linux/2016-11/137548.htm

CentOS6安裝Jenkins http://www.linuxidc.com/Linux/2016-05/131365.htm

使用Jenkins配置Git+Maven的自動化構建 http://www.linuxidc.com/Linux/2016-02/128641.htm

Jenkins+Maven+Git搭建持續集成和自動化部署的配置手記 http://www.linuxidc.com/Linux/2015-06/118606.htm

Jenkins的分布式構建及部署——節點 http://www.linuxidc.com/Linux/2015-05/116903.htm

CentOS7下Jenkins 服務器的安裝 http://www.linuxidc.com/Linux/2017-02/141119.htm

Jenkins+Gitlab+Sonar代碼檢查平臺搭建 http://www.linuxidc.com/Linux/2017-01/139900.htm

在Fedora 21上搭建Jenkins+SonarQube的Maven項目自動化測試平臺 http://www.linuxidc.com/Linux/2017-02/140780.htm

Jenkins 的詳細介紹:請點這裏
Jenkins 的下載地址:請點這裏

本文永久更新鏈接地址:http://www.linuxidc.com/Linux/2017-03/141642.htm

技術分享圖片

技術分享圖片

Touhou Community Reliant Automatic Patcher

技術分享圖片

Description

Basically, this is an almost-generic, easily expandable and customizable framework to patch Windows applications in memory, specifically tailored towards the translation of Japanese games.

It is mainly developed to facilitate self-updating, multilingual translation of the Touhou Project games on Touhou Patch Center, but can theoretically be used for just about any other patch for these games, without going through that site.

Main features of the base engine

  • Easy DLL injection of the main engine and plug-ins into the target process.

  • Full propagation to child processes. This allows the usage of other third-party patches which also use DLL injection, together with thcrap. (Yes, this was developed mainly for vpatch.)

  • Uses JSON for all patch configuration data, making the patches themselves open-source by design. By recursively merging JSON objects, this gives us...

  • Patch stacking - apply any number of patches at the same time, sorted by a priority list. Supports wildcard-based blacklisting of files in certain patches through the run configuration.

  • Automatically adds transparent Unicode filename support via Win32 API wrappers to target processes using the Win32 ANSI functions, without the need for programs like AppLocale.

  • Patches can support multiple builds and versions of a single program, identified by a combination of SHA-256 hashes and .EXE file sizes.

  • Binary hacks for arbitrary in-memory modifications of the original program (mostly used for custom assembly).

  • Breakpoints to call custom DLL functions at any instruction of the original code. These functions can read and modify the current CPU register state.

  • Multiple sets of sequentially applied binary hacks and breakpoints, for working around EXE packers and DRM schemes.

  • File breakpoints to replace data files in memory with replacements from patches.

  • Wildcard-based file format patching hooks called on file replacements - can apply patches to data files according to a (stackable!) JSON description.

  • Optional Steam integration for games that are available through Steam, but don‘t come with Steam integration themselves. Can be disabled by deleting steam_api.dll.

  • ... and all that without any significant impact on performance. ?

Modules included

  • win32_utf8: A UTF-8 wrapper library around the Win32 API calls we require. This is a stand-alone project and can (and should) be freely used in other applications, too.
  • thcrap: The main patch engine.
  • thcrap_loader: A command-line loader to call the injection functions of thcrap on a newly created process.
  • thcrap_configure: A rather cheap command-line patch configuration utility. Will eventually be replaced with a GUI tool.
  • thcrap_tsa: A thcrap plug-in containing patch hooks for games using the STG engine by Team Shanghai Alice.
  • thcrap_update: A thcrap plug-in containing updating functionality for patches as well as digitally signed automatic updates of thcrap itself.

Building

A ready-made Visual Studio build configuration, covering all modules and their dependencies, is provided as part of this repository. To set up the build:

  • Install Visual Studio Community 2013.

  • Make sure that you‘ve pulled all Git submodules together with this repo:

    git clone --recursive https://github.com/thpatch/thcrap.git
  • (Optional) If your thcrap build should be able to automatically update itself, you need to create a code signing certificate. To do this, run the following commands on the Visual Studio command prompt (vcvarsall.bat) in the root directory of this repo (the one with thcrap.sln):

    makecert -n "CN=Your Name,[email protected]" -$ individual -a sha256 -len 4096 -r -cy authority -sky signature -pe -sv cert.pvk cert.cer pvk2pfx -pvk cert.pvk -spc cert.cer -pfx cert.pfx

    cert.pfx is used to sign the binaries as part of the build, so don‘t change the file name.

Then, open thcrap.sln, choose Debug or Release from the drop-down menu in the toolbar (or the Configuration Manager) and run Build → Build Solution from the main menu.

You can also build from the command line by running the Visual Studio tool environment batch file (vcvarsall.bat), then run

msbuild /m /p:Configuration=Debug

or

msbuild /m /p:Configuration=Release

in the thcrap directory. The binaries will end up in the bin/ subdirectory.

Signing a release archive for automatic updates

First, convert cert.pvk to a .pem file using OpenSSL, then use this file together with scripts/release_sign.py:

openssl rsa -inform pvk -in cert.pvk -outform pem -out cert.pempython release_sign.py -k cert.pem thcrap.zip

Using different compilers

Visual Studio Community 2013 is recommended for building, and the build configuration references the Visual Studio 2013 platform toolset with Windows XP targeting support by default. However, the project should generally build under every version since Visual C++ 2010 Express after changing the <PlatformToolset> value in Base.props. For a list of all platform toolsets available on your system, open the Properties dialog for any included project and refer to the drop-down menu at Configuration Properties → General → Platform Toolset.

Compilation with MinGW is currently not supported. This is not likely to change in the foreseeable future as we don‘t see much value in it.

Dependencies

All required third-party libraries for the C code are included as Git submodules. These are:

  • Jansson, required for every module apart from win32_utf8.

  • libpng (>= 1.6.0), required by thcrap_tsa for image patching.

  • zlib, required by thcrap_update for CRC32 verification. It‘s required by libpng anyway, though.

The scripts in the scripts directory are written in Python 3. Some of them require further third-party libraries not included in this repository:

  • PyCrypto is required by release_sign.py.

License

The Touhou Community Reliant Patcher and all accompanying modules are released to the Public Domain, unless stated otherwise. This means you can do whatever you want with this code without so much as crediting us.

That said, we do appreciate attribution. ?

技術分享圖片

Characters

  1. MarisaKirisame
  2. MinamitsuMurasa
  3. ReimuHakurei
  4. SakuyaIzayoi
  5. WriggleNightbug
  6. YoumuKonpaku
  7. YuugiHoshiguma
  8. YuukaKazami

Stages

  1. ForestOfMagic
  2. HakureiShrine
  3. Makai
  4. Netherworld

Projects

  1. FantasyCrescendo
  2. HouraiLauncher
  3. HouraiLib
  4. HouraiLocalization
  5. SmashBrew

Navigation

  • Home
  • RecentChanges
  • FindPage
  • FantasyCrescendo
  • Development
  • ReimuHakurei
Last updated at 2017-03-29 05:41:44

技術分享圖片

Reimu Hakurei

Reimu Hakurei is a playable character in Fantasy Crescendo.

目錄

  1. Reimu Hakurei
    1. General Information
    2. Attacks
    3. Images
    4. Trivia
    5. External Links

General Information

Home Stage: Hakurei Shrine
Height: 1.5 m
Weight: 1 weight unit
Walk Speed: 5 m/s
Run Speed: 10 m/s

Attacks

Work in Progress This section is a work in progress. A lot of what is presented here is subject to potential future change.

Attack

Description

Damage

Knockback

Ground Attacks

Neutral Combo

TODO

N/A

N/A

Strong Attacks

Forward Tilt

TODO

N/A

N/A

Up Tilt

TODO

N/A

N/A

Down Tilt

TODO

N/A

N/A

Smash Attacks

Forward Smash

TODO

N/A

N/A

Up Smash

TODO

N/A

N/A

Down Smash

TODO

N/A

N/A

Aerial Attacks

Neutral Aerial

TODO

N/A

N/A

Up Aerial

TODO

N/A

N/A

Forward Aerial

TODO

N/A

N/A

Back Aerial

TODO

N/A

N/A

Special Attacks

Neutral Special

TODO

N/A

N/A

Up Special

TODO

N/A

N/A

Side Special

TODO

N/A

N/A

Down Special

TODO

N/A

N/A

Images

技術分享圖片 技術分享圖片 技術分享圖片 技術分享圖片

Trivia

External Links

  • Reimu Hakurei on TouhouWiki


CategoryCharacters

Jenkins + Github持續集成構建Docker容器,維基百科&人工自能(AI)模塊