Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

时间:2022-08-29 09:24:38

本文分两部分,第一部分是手动计划任务的方式构建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:Git@github.com:sangrealest/Jenkins_Docker_Ansible.git
 
Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Dockerfile 很简单,就是拉取最新的Nginx,并将2048游戏添加到Nginx根目录

FROM nginx:latest
MAINTAINER Shanker shanker@yeah.net
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游戏的界面:

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

以上的构建是基于计划任务的,每小时的随机分钟内执行一次构建任务(SCM H * * * *),然后懒人还有懒人的做法,就是添加Github webhook功能,当push一个更新的时候自动trigger一次构建。
 
2.1 在Github个人主页上安装Github Plugin并添加你的Jenkins server的webhook地址:比如我的Jenkins地址是mywebsite.com:8080,这里要写的地址就应该是http://mywebsite.com:8080/github-webhook
 
Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

2.2 返回jenkins-docker项目首页,点击 Configure, 添加Github的账号密码信息,因为我用的个人仓库,需要使用私钥认证,选择Certificate, 将放在jenkins home/.ssh 下的私钥路径填上:

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

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

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块
 
2.4 这时候可以更新一下Github Project下面的文件并且push一下,看看是否触发了jenkins的构建动作:
如图,我刚push完成,jenkins这边就已经捕捉到并且开始构建新的任务:

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

我们在Github项目地下echo 一句话到testfile,并且添加到容器的/root下时间是7:49:58,然后我的容器更新后并启动运行的时间是7:50:26,只用了28秒钟就构建成功了!

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

有了这样的集成,后续我们就可以考虑将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

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Touhou Community Reliant Automatic Patcher

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

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,E=yourmail@provider.net" -$ 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. ☺

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Last updated at 2017-03-29 05:41:44

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Reimu Hakurei

Reimu Hakurei is a playable character in Fantasy Crescendo.

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

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块 Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块 Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块 Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块

Trivia

External Links


CategoryCharacters

Jenkins + Github持续集成构建Docker容器,*&人工自能(AI)模块的更多相关文章

  1. jenkins&plus;github持续集成中的坑

    1.前言 刚开始开发自己的独立博客的时候,每次发布都要手动打包,上传服务器,杀tomcat进程,重启,来回这么重复性工作,很快就有点不耐烦了.如果能自动化的东西,就绝不要手动了,所以自己搭建了个持续集 ...

  2. 通过 Azure Pipelines 实现持续集成之docker容器化及自动化部署

    通过 Azure Pipelines 实现持续集成之docker容器化及自动化部署 Intro Azure DevOps Pipeline 现在对于公开的项目完全免费,这对于开源项目来讲无疑是个巨大的 ...

  3. NET Core&plus;win10&plus;Jenkins&plus;Github持续集成

    本篇和上一篇NET Core+win10+Jenkins+Gogs+open ssh持续集成没什么区别,只不过源码库换成github. 这里有两点不一样的是: 获取的代码的凭证不用用户名和密码用sec ...

  4. Jenkins&plus;Github持续集成

    由于最近团队代码库从coding迁移到github,在CI工具的选型上尝试了travis-ci和circle-ci,最后决定自己搭建CI服务器,而我也有幸认领了这个任务的调研,因此有了这篇文章. 之前 ...

  5. ARTS-S gitlab与jenkins实现持续集成

    jenkins配制 系统管理->管理插件->可选插件->选择安装 Gitlab Hook Plugin和Build Authorization Token Root Plugin插件 ...

  6. docker&plus;jenkins实现持续集成

    持续集成的概念我就不多说了,网上一大堆,今日主要讲讲怎么通过docker 和jenkins实现项目的持续集成.看着简单,网上完整教程很少,本人摸索很久才搞定!!! 一.首先安装docker.安装过程可 ...

  7. 使用Jenkins来构建Docker容器

    使用Jenkins来构建Docker容器(Ubuntu 14.04) 当开发更新了代码,提交到Gitlab上,然后由测试人员触发Jenkins,于是一个应用的新版本就被构建了.听起来貌似很简单,dua ...

  8. 【iOS】Jenkins Gitlab持续集成打包平台搭建

    Jenkins Gitlab持续集成打包平台搭建 SkySeraph July. 18th 2016 Email:skyseraph00@163.com 更多精彩请直接访问SkySeraph个人站点: ...

  9. 使用jenkins实现持续集成

    一.jenkins 介绍 它是一个自动化的周期性的集成测试过程,从检出代码.编译构建.运行测试.结果记录.测试统计等都是自动完成的,无需人工干预: 它需要有专门的集成服务器来执行集成构建: 它需要有代 ...

随机推荐

  1. notepad&plus;&plus;对systemverilog的支持

    找到notepad++根目录中的"langs.xml",用notepad++打开,并搜索"verilog",     找到后,修改后面那句话为ext=&quot ...

  2. ODI中查看变更及对象查找

    ODI中可以查看每个对象的修改时间.修改人,当ETL作业失败之后,可以根据这些信息了解到是否有人修改过相关的对象. 另外,在ODI的菜单项中,也可以查看按修改时间.人员等搜索指定的对象,如查找最近7天 ...

  3. &lbrack;转&rsqb;What’s Behind Ericsson’s OpenWebRTC Project&quest;

    [转]What’s Behind Ericsson’s OpenWebRTC Project? http://www.tuicool.com/articles/z6rAVrJ Ericsson’s O ...

  4. java项目中eclipse控制台输出log4j的信息

    最近做的一个hadoop项目中,用MR实现了一个比较复杂的问题,其中的日志信息都是使用的是log4j来处理的.但不知怎么控制台不输出日志信息,只能输出System.out.println()信息,这个 ...

  5. 创建多模块maven项目

    有两种方式: 1,new -->maven project-->maven-archetype-quickstart 建完多个独立的project后,手动修改pom文件的packing类型 ...

  6. 作为IT行业计算机从业人士,不要做&OpenCurlyDoubleQuote;邻居盖新房&comma;你就是背后放火的那种人”

    金华-普通人(214103872)  21:03:01 尽扯蛋   颇有点凤姐的营销方式  横瓜(601069289)  21:05:16 不服气 你搞一个下面的类似软件出来 http://www.s ...

  7. 用Backtrack进行渗透测试评估

    Web应用程序的分析在渗透测试和漏洞评估中发挥了重要的作用.确定Web应用程序的正确信息(例如使用的插件,CMS类型等)都可以帮助测试者使用准确的漏洞来测试,能够降低整个渗透测试漏洞评估所花费的时间. ...

  8. Ex 2&lowbar;4 假定您需要在以下三种算法中作出抉择&period;&period;&period;&lowbar;第三次作业

  9. jqgrid 滚动分页

    有时,我们不想在底部显示分页信息,而是通过用户滚动鼠标,当鼠标滚到到底自动加载下一页数据,再滚动再加载直至数据全部加载完毕.如何配置? 设置 scroll:true   emptyrecords用于在 ...

  10. 在idea中为函数自动生成注释(解决注释无法出现形参的情况)

    1 点击“File”-->“Settings”-->“Live Templates”打开如下对话框,点击右边绿色的加号,创建一个自定义的Template Group,如“Java” 2.选 ...