织梦优美文章阅读网站源码平面设计软件手机
web/
2025/10/1 3:04:05/
文章来源:
织梦优美文章阅读网站源码,平面设计软件手机,优享揭阳网站建设,个人博客网页制作前提准备#xff1a; gitlab中上传相应的jenkinsfile文件和源码。 安装和破解ansible-tower。 安装jenkins。 大致流程#xff1a;从gitlab中拉取文件#xff0c;存放到windows机器上#xff0c;使用nuget等进行打包到windows中#xff0c;使用sshPublisher语句传输到远程…前提准备 gitlab中上传相应的jenkinsfile文件和源码。 安装和破解ansible-tower。 安装jenkins。 大致流程从gitlab中拉取文件存放到windows机器上使用nuget等进行打包到windows中使用sshPublisher语句传输到远程ansible-tower的机器上打包传输完成后使用ansible-tower进行发布。 机器分布 jenkins:192.168.50.155 gitlab:192.168.50.156 ansible-tower:192.168.50.157 后端服务器192.168.50.154 192.168.50.155 1.jenkins中的配置 第一步配置gitlab的用户名和密码 第二步新建项目item 第三步得到的界面 2.配置Nodes.配置window机器将项目打包 配置好后还需要在节点windows服务器中执行相关的命令才能建立连接。参考 https://blog.csdn.net/weixin_41238626/article/details/137828742 3.配置远端ansible-tower服务器相关 参考 https://blog.csdn.net/qq_25646191/article/details/109103252 需要安装Publish over SSH插件。输入密码后可以点击右下角进行测试 test configuration 4 在打包机器上安装dotnet版本 需要安装dotnet环境 https://download.visualstudio.microsoft.com/download/pr 需要配置环境变量 安装 nuget 需要配置环境变量 安装vs https://c2rsetup.officeapps.live.com/ 工作负载选择ASP.NET和Web开发、.NET桌面开发 参考https://www.cnblogs.com/sgxw/p/15607574.html proget 8624端口部署–》安装 参考 https://www.cnblogs.com/zerodai/p/10796535.html 5 测试查看是否能够打包已经是否能够传输到ansible-tower中 Jenkinsfile文件内容
pipeline{parameters {string defaultValue: , description: tag, name: Tag, trim: falsechoice choices: [class-assistant-linux-pr, class-assistant-linux], description: , name: TARGET_HOSTchoice choices: [Release, Publish, Alpha, Debug], description: , name: Configuration
}agent nonestages{stage(build){agent {label win-110-88}steps(first steps){bat nuget.exe restore .\\src\\ClassAssistant.sln -Source http://192.168.60.216:8624/nuget/Proget/bat dotnet publish .\\src\\ClassAssistant.Apis\\ClassAssistant.Apis.csproj --force -o ./publish/publish --configuration %Configuration%powershell Get-ChildItem -Path $ENV:WORKSPACE/publish/publish/* -Include appsettings.*,log4net.config -Recurse | Remove-Itembat cd %WORKSPACE%\\publish\\publish\\C:\\Program Files\\7-Zip\\7z.exe a ..\\latest.zip .archiveArtifacts /publish/*.zip}}stage(sendfile and ansible job){agent {label win-110-88}steps(sendfile steps){sshPublisher(publishers: [sshPublisherDesc(configName: ansible-50.157, transfers: [sshTransfer(cleanRemote: false, excludes: , execCommand: , execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: [, ], remoteDirectory: /${TARGET_HOST}/, remoteDirectorySDF: false, removePrefix: /publish, sourceFiles: /publish/*.zip)], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])}}}
}6 ansible-tower中中进行相关配置配置发布 参考https://blog.csdn.net/qq_48736646/article/details/137777740 ansible剧本内容
class-test.yaml
---
- name: iis pull latest.zip and updatehosts: class-assistant-linuxgather_facts: falsemax_fail_percentage: 100serial: 2vars:PATH: class-assistant-linux#group group: 重启group需要加: program program重启单个项目直接写项目名称AppPool: core-class-assistant-linuxvars_files:- ./extend_vars.yamlroles:- update
extend_vars.yaml
iis_path:class-assistant-linux:192.168.50.154:- /opt/class-assistant-linux192.168.50.155:- /opt/class-assistant-linux
hosts:
[class-assistant-linux]
192.168.50.154
192.168.50.155update/tasks/main.yml
---
- name: url get fileshell: scp -o StrictHostKeyCheckingno root192.168.50.157:/data/win_iis/{ PATH }/latest.zip /tmp/{{ PATH }}_latest.ziptags: update
- name: unzip fileshell: sudo unzip -q -o /tmp/{{ PATH }}_latest.zip -d {{ item }}with_items: {{ iis_path[PATH][inventory_hostname] }}tags: update
- name: restart webapppoolshell: sudo supervisorctl restart {{AppPool}}- name: Remove a file, if presentshell: rm -f /tmp/{{ PATH }}_latest.ziptags: update
7 结果
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/84804.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!