`
sillycat
  • 浏览: 2536154 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Jenkins 2019 in Docker(3)Blue Ocean and Pipeline

 
阅读更多
Jenkins 2019 in Docker(3)Blue Ocean and Pipeline
Enable Blue Ocean
‘Manage Jenkins’ -> ‘Manage Plugins’ -> ‘Available’ -> Check ‘Blue Ocean’ and ‘Download now and install after restart'
Restart Jenkins when installation is complete and no jobs are running.
Click the Button ‘Open Blue Ocean’ to go to new UI or directly visit
http://server/blue
Follow the UI to create a new pipeline
In GitHub.com in the Settings-> Developer Settings -> Personal Access Tokens -> Generate new token
133ad445xxxxxxxxxa6cf9cff2
In jenkins, Credentials -> System -> Global credentials -> Secret Text
Put the token in Secret, Give an ID as Jenkins
More Examples
https://jenkins.io/doc/pipeline/examples/
https://github.com/jenkinsci/pipeline-examples
Cache the maven libraries
https://jenkins.io/doc/book/pipeline/docker/
Currently, I am using the simplest configuration file Jenkinsfile
pipeline {
  agent {
    docker {
      image 'maven:3.6.0-jdk-11'
      args '-v $HOME/.m2:/root/.m2'
    }
  }
  stages {
    stage('Clone Code') {
      steps {
        git(url: 'https://github.com/sillycat/NetsuiteConnector', branch: 'master', changelog: true, poll: true, credentialsId: 'yiyikang')
      }
    }
    stage('Compile Build') {
      steps {
        sh 'mvn clean'
        sh 'mvn install -DskipTests=true'
      }
    }
    stage('Unit Test') {
      steps {
        sh 'mvn test'
      }
    }
  }
}
Agent Docs to build with Dockerfile
https://jenkins.io/doc/book/pipeline/syntax/#agent
Use docker ENV to build the application, Dockerfile.build
FROM maven:3.6.0-jdk-11    
MAINTAINER  Yiyi Kang <yiyikangrachel@gmail.com>
RUN apt-get -qq update
RUN apt-get -qqy dist-upgrade
RUN curl -fsSL https://get.docker.com | sh
Jenkinsfile
pipeline {
  options {
    buildDiscarder(logRotator(numToKeepStr: '10'))
  }
  agent {
    dockerfile {
      filename 'Dockerfile.build'
      args '-v $HOME/.m2:/root/.m2 -v /var/run/docker.sock:/var/run/docker.sock'
    }
  }
  stages {
    stage('Clone Code') {
      steps {
        git(url: 'https://github.com/sillycat/NetsuiteConnector', branch: 'master', changelog: true, poll: true, credentialsId: 'yiyikang')
      }
    }
    stage('Compile Build') {
      steps {
        sh 'mvn clean'
        sh 'mvn install -DskipTests=true'
      }
    }
    stage('Unit Test') {
      steps {
        sh 'mvn test'
      }
    }
    stage('Docker Image') {
      steps {
        sh 'docker build -t sillycat/public:sillycat-netsuite .'
      }
    }
  }
}
It will build the building ENV in Dockerfile.build, then Jenkinsfile will use that ENV to build.
References:
https://jenkins.io/zh/doc/book/blueocean/getting-started/
https://blog.csdn.net/neven7/article/details/53645215
https://jenkins.io/zh/doc/pipeline/tour/hello-world/
https://github.com/jenkinsci/pipeline-examples
https://medium.com/@gustavo.guss/jenkins-building-docker-image-and-sending-to-registry-64b84ea45ee9
https://jenkins.io/doc/book/pipeline/docker/
https://stackoverflow.com/questions/39542485/how-to-write-pipeline-to-discard-old-builds
分享到:
评论

相关推荐

    Learning.Continuous.Integration.with.Jenkins.2nd.epub

    We also talk in detail about the new Jenkins Blue Ocean interface and its features to quickly and easily create a CI pipeline. You'll gain a foothold in implementing CI and CD methods. Then we dive ...

    jenkins-docker-project:Jenkins管道,Docker组成,Jenkins Blue Ocean,持续集成,自动化

    jenkins-pipeline-docker-project 此仓库将演示Jenkins Pipeline。

    Jenkins-pipeline-user-handbook

    这部分内容包括声明式Pipeline的基础知识和高级用法,以及Pipeline的开发工具,例如Blue Ocean Editor和命令行Pipeline Linter。还包含了如何运行和修改Pipeline运行的示例。 在文档的结尾,还提供了关于Pipeline...

    jenkins-terraform-pipeline:创建一个使用terraform管理AWS资源的jenkins管道

    安装推荐的插头和(可选)Blue Ocean插件 码头工人 IAM用户AWS凭证应保存在主机实例上的/root/.aws/ -在运行管道时,这些凭证将映射到Docker容器并由Docker容器使用。 确保IAM用户的许可足以完成所有任务/创建管

    Jenkins 用户手册.pdf

    - **Blue Ocean:** Blue Ocean是Jenkins的一个插件,用于提供一个更加现代化和简化的方式来创建、设置和监控流水线。它提供了可视化的流水线编辑器,使得构建过程更加直观。 - **多分支流水线:** Jenkins支持多分支...

    Jenkins常用插件大全jenkins-plugin-war.tar.gz

    - **Blue Ocean Plugin**:提供了一个现代化的用户界面,简化了Jenkins的配置和工作流设计。 - **Pipeline as Code**:利用Groovy脚本定义整个CI/CD流程,实现流程的版本控制和可维护性。 - **Docker Pipeline**...

    jenkins所需的插件等

    6. **Blue Ocean 插件**:提供现代化的用户界面,使得 Pipeline 的创建和管理更为直观。 7. **Pipeline as Code 插件**(Jenkinsfile):允许将 Jenkinsfile 存储在版本控制系统中,实现持续集成流程的代码化管理。...

    Jenkins用户手册

    - **Blue Ocean编辑器。** 是Jenkins的现代化用户界面,用于创建和编辑Pipeline。 - **命令行Pipeline Linter。** 可以在代码提交到SCM之前检查Pipeline脚本的语法。 #### 测试与示例 - **Pipeline单元测试框架。*...

    jenkins-ci:此仓库显示了如何使用docker,jenkins和maven来构建,测试和部署Java应用

    持续集成演示 此仓库显示了如何使用dockerized jenkins来构建,测试和部署Java和python应用程序。 为了测试Java应用程序,此演示使用... 另一种方法是将预构建的Docker映像与已安装的jenkins blue-ocean插件一起使用。

    jenkins的默认推荐下载的插件

    12. **蓝绿部署插件**(如 Blue Ocean 插件):提供了一个现代化的 UI,简化了 Pipeline 的创建和理解。 13. **Docker 插件**:支持在 Docker 容器中运行构建任务,这在多环境部署和隔离性方面非常有帮助。 这些...

    Docker Jenkins Git Maven Nexus3持续集成部署

    什么是持续集成、什么是容器化集成和部署、怎么样安装Jenkins、规避哪些坑、什么是Blue Ocean 什么是流水线技术、什么是Jenkins Piepeline流水线技术、怎么样写流水线脚本 如何实现串行部署、并行部署、单节点部署、...

    Jenkins2.346插件包.rar

    6. **Blue Ocean插件**:提供现代的、可视化的工作流编辑界面,简化CI/CD流程的创建和维护。 7. **Pipeline插件**:支持定义Declarative或Scripted Pipeline,实现自动化构建、测试和部署流程。 8. **GitHub/Bit...

    jenkins

    Jenkins 提供了丰富的插件,例如Blue Ocean插件提供了更加友好的用户界面,使得配置和查看构建流程变得更加直观。Pipeline插件则允许用户编写声明式或脚本式的构建流程,这些流程定义在代码中,可以版本控制,易于...

    jenkins-pipeline:随着代码在Jenkins上运行,以及GIT命令和日常操作,项目将围绕管道运行

    安装Jenkins(dekstop或在容器中)并管理插件并安装“ Blue Ocean” 如果使用jenkins容器,请确保已安装docker,然后在此处为docker运行Jenkins中的命令: : 为左侧菜单激活Blue Ocean并创建新管道,选择Github...

    浅析Jenkins在java项目开发中的应用.zip

    例如,Docker插件支持Docker容器化的构建和部署,Blue Ocean插件提供了更现代的UI界面。 ### 9. 集成其他工具 Jenkins可以与许多其他工具集成,如Artifactory或Nexus用于管理依赖库,Ansible或Chef用于自动化部署...

    Docker到Kubernetes进阶视频.rar

    │ kubernetes-learning.pdf,网盘文件永久链接 ├ 一、课程介绍 │ └ 11.课程介绍.mp4 ├ 七、深入理解Pod │ │ 18.YAML 文件.mp4 ... │ 71.Jenkins Blue Ocean 的使用.mp4 │ 72.Harbor.........

    jenkinsplugins

    - **蓝绿部署插件(Blue Ocean)**:提供更友好的用户界面,简化多分支和Pipeline的管理。 5. **插件开发** 对于有需求的开发者,Jenkins提供了详细的插件开发指南。开发者可以利用Jenkins API和Maven插件构建...

    jenkins2

    总结起来,Jenkins 2通过Pipeline as Code、Blue Ocean等特性提升了CI/CD的效率和易用性,其丰富的插件生态系统和强大的扩展能力使其成为现代软件开发不可或缺的工具。通过合理利用Jenkins 2,团队可以实现更快的...

    plugins.zip

    8. **Blue Ocean Plugin**:提供现代化的用户界面,简化Jenkins的配置和操作,使其更加直观。 9. **GitHub Plugin**:与GitHub紧密集成,支持Webhooks、PR(Pull Request)构建等功能。 10. **Artifactory Plugin*...

Global site tag (gtag.js) - Google Analytics