Jenkins Pipeline Deployment
Command to download the binary to directory
> wget --user yiyikang --password xxxxxxx http://webapi-dev.sillycat.com:49001/artifactory/libs-snapshot-local/com/sillycat/netsuiteconnector/1.0/netsuiteconnector-1.0.1-bundle.tar.gz
Unzip the file to target directory
> sudo tar xvzf ./netsuiteconnector-1.0.1-bundle.tar.gz -C /opt/sillycat/
Kill the Old Service
stop.sh
#!/bin/sh -ex
PID=$(ps -ef | grep "lib/netsuiteconnector" | grep -v grep | awk '{ print $2 }')
if test -n "${PID}"; then
sudo kill -9 ${PID};
fi
Here is command in Dockerfile.build to enable the jfrog command in build image
RUN curl -fL https://getcli.jfrog.io | sh
RUN mv jfrog /usr/local/bin/
Here is the stage information in pipeline How I publish my build to artifactory
stage('Release to Artifactory') {
steps {
sh 'mvn package -DskipTests=true'
withCredentials([string(credentialsId: 'artifactory', variable: 'TOKEN')]) {
sh '''
set +x
jfrog rt config --url http://xxxxx.199:49001/artifactory --user yiyikang --apikey $TOKEN --interactive=false
jfrog rt u target/netsuiteconnector-*-bundle.tar.gz libs-snapshot-local/com/sillycat/netsuiteconnector/1.0/
'''
}
}
}
Deploy the release package to one server
stage('Deploy to Stage') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: 'yiyikang_dev', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
sh '''
ssh -o StrictHostKeyChecking=No -i $identity $userName@333.333.333.333 "rm -fr install/*"
scp -i $identity target/netsuiteconnector-*-bundle.tar.gz $userName@333.333.333.333:~/install/
ssh -o StrictHostKeyChecking=No -i $identity $userName@333.333.333.333 "tar xvzf ~/install/netsuiteconnector-*-bundle.tar.gz -C /opt/sillycat/"
ssh -o StrictHostKeyChecking=No -i $identity $userName@333.333.333.333 "cd /opt/sillycat/netsuiteconnector-*/;bin/restart.sh;"
'''
}
}
}
Wget command and curl command can download the file from Artifactory easily as well.
References:
https://github.com/jenkinsci/ssh-steps-plugin
https://engineering.cerner.com/blog/ssh-steps-for-jenkins-pipeline/
分享到:
相关推荐
在Jenkins持续集成环境中,Pipeline作为一种强大的自动化工具,允许开发者定义和执行复杂的构建、测试和部署流程。本资料包着重讲解了如何在Pipeline中利用参数和条件控制来实现灵活的流程执行策略。以下是对该主题...
Jenkins 2 Up and Running Evolve Your Deployment Pipeline for Next Generation Automation 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
Jenkins 2 Up and Running Evolve Your Deployment Pipeline for Next Generation Automation 英文mobi 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
Jenkins 2 Up and Running Evolve Your Deployment Pipeline for Next Generation Automation 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国亚马逊官网搜索此书
Jenkins 2 Up and Running Evolve Your Deployment Pipeline for Next Generation Automation 英文无水印转化版pdf pdf所有页面使用FoxitReader、PDF-XChangeViewer、SumatraPDF和Firefox测试都可以打开 本资源...
7. **部署策略(Deployment Strategies)**:Pipeline 支持多种部署策略,包括蓝绿部署、金丝雀发布等,确保安全且高效地更新生产环境。 8. **错误处理和通知**:Pipeline 允许添加错误处理机制,并配置在构建失败...
Jenkins Pipeline(或者简单用一个大写字母P代替”Pipeline”)是一套插件,这套插件支持实现和整合持续集成pipelines(continuous delivery pipelines)到Jenkins中。 持续集成Pipeline (continuous delivery ...
jenkins-pipeline-library:具有针对CICD环境的通用功能的Jenkins管道库,主要用于实现https:indigo-dc.github.iosqa-baseline的SQA基线要求的实现
最后,为了实现自动化部署,你可以创建一个Jenkins pipeline,该pipeline可以读取Git仓库中的代码并执行构建、测试和部署任务。Jenkinsfile是一个Groovy脚本,定义了整个流水线的步骤: ```groovy pipeline { ...
5. **流水线(Pipeline)**:掌握Jenkins Pipeline语法,编写Declarative或Scripted Pipeline,实现持续集成和持续部署的自动化流程,以及如何在版本控制中存储和管理Pipeline脚本。 6. **蓝绿部署和金丝雀发布**:...
Learning Continuous Integration with Jenkins - Second Edition: A beginner's guide to implementing Continuous ... Continuous Deployment Using Jenkins Chapter 10. Supporting Tools And Installation Guide
5. **持续交付/部署(Continuous Delivery/Deployment, CD)**:结合Pipeline,实现一键部署,确保代码快速、可靠地发布到生产环境。 四、Jenkins Pipeline与其他工具的集成 1. **源码管理**:与Git、SVN等源码...
Jenkins是一款开源的持续集成(Continuous Integration, CI)和持续部署(Continuous Deployment, CD)工具,旨在简化软件开发过程中的自动化任务。本篇将深入讲解Jenkins的核心功能及其应用场景。 一、Jenkins概述...
Evolve Your Deployment Pipeline for Next Generation Automation Design, implement, and execute continuous delivery pipelines with a level of flexibility, control, and ease of maintenance that was not ...
9. **持续部署(Continuous Deployment, CD)**:Jenkins 不仅支持 CI,还可以实现 CD,即每次代码成功构建和测试后自动部署到生产环境。 10. **蓝绿部署和金丝雀发布**:Jenkins 支持高级部署策略,如蓝绿部署...
Jenkins 是一款开源的持续集成(Continuous Integration, CI)和持续部署(Continuous Deployment, CD)工具,广泛应用于软件开发流程中,帮助团队高效地管理和测试代码。版本号 2.346.3 是 Jenkins 的一个稳定更新...
3. 基本的提交到部署的流程(commit-to-deploy pipeline):详细阐述了从提交代码到最终部署的整个流程,强调了自动化的重要性,并可能介绍了Jenkins在这个过程中的具体应用。 4. 多分支工作流与Gerrit和Jenkins的...
本文档主要介绍了如何在 K8s 之外部署 GitLab 10.6.3 和 Jenkins 2.164.3,并实现 CICD(Continuous Integration and Continuous Deployment) Pipeline。 一、GitLab 10.6.3 部署 GitLab 部署使用 Docker 容器,...
Learn about creating a pipeline using Build Pipeline plugin and the Pipeline as Code feature available after the release of Jenkins 2.0 Book Description In agile development practices, developers need...
3. **部署Jenkins Pod**: 使用YAML文件定义Jenkins的Deployment,包括镜像、副本数、环境变量等。 4. **配置Ingress**: 为了通过HTTPS访问Jenkins,需要创建一个Ingress资源,配置SSL证书和规则,确保流量通过HTTPS...