Tag: jenkins pipeline

jenkins – pipe道(亚马逊EC2容器服务插件)

我刚开始使用Jenkins和Pipeline,并将其与Jenkins Amazon EC2容器服务插件一起使用。 一切正常,到目前为止,我宣布代理,我需要使用它为我的构build,它启动docker形象进行构build并完成任务完成后。 但是,我想我可以同时运行多个任务(对于每个任务,它将运行一个新的docker服务),但是看起来像只有一个从站是可用的。 例如,如果我的从服务器正在执行某些操作,则下一个任务将等待以下消息:“等待下一个可用的执行器在Jenkins-Slave-12cbf90f1ed9上” 我像这样设置pipe道: #!groovy pipeline { agent { label 'maven'} stages { stage('Build') { steps { sh 'mvn clean install' } } } 有没有我没有正确的设置,或者这是如何工作?

我如何在Jenkins中运行两个docker机器来模拟ssh服务器和ssh客户机?

我正在testing一个pipe道,其中一个ssh客户端与许多服务器对话以从中收集数据。 我目前正在testing我的软件,启动一个docker机器来模拟一个ssh服务器。 现在我想在Jenkins自动化testing。 如何在Jenkins中启动docker ssh服务器,而不是充当代理,而是等待代理通过ssh请求联系他们? 下面是当前的Jenkinspipe道。 dockerfile创build运行python脚本的机器,但是我需要创build一个docker ssh服务器来与之通话。 pipeline { agent { dockerfile true } stages { stage('Checkout') { steps { checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'somecredentials', url: 'a git repo']]]) } } stage('Run Tests') { steps { sh "python ./rsyncUnitTests.py" } } } post { failure […]

Docker远程API + Docker组合-f选项

我正在使用Docker引擎API在-H选项的帮助下pipe理远程Docker实例。 我成功地configuration了远程守护进程接受来自外部的http请求,并且能够从本地机器连接到它并调用远程docker引擎。 现在我想用docker-compose工具来检查在远程主机上运行的项目。 在远程主机上,名为testproject的项目正在运行(以在docker -compose命令中使用-p参数设置自定义proj名称)。 testproject由docker -compose文件描述,其path为/opt/myproject/compose/docker-compose.yml。 当试图从我的本地机器检查docker-compose进程时使用以下命令: docker-compose -H tcp://${remote_ip}:2375 -p testproject ps 我不断收到这个错误: ERROR: Can't find a suitable configuration file in this directory or any parent. Are you in the right directory? Supported filenames: docker-compose.yml, docker-compose.yaml 所以我试图使用-f和–project-directory选项来指定远程docker-compose.yml文件的位置,但是恐怕这两个选项都与我的本地机器有关,因为我得到了“找不到文件“错误。 这是对的吗 ? (我在官方文档中没有find明确的答案)我该如何解决这个问题?

在Dockerfile里运行“From ..”docker镜像

我正在构build一个构buildJenkins的映像,我试图在运行时使用Jenkins上的插件,所以,我需要在插件执行之前运行Jenkins。 我执行它像dockerbuild设-tdocker文件和我所获得的错误: jenkins.JenkinsException:请求中的错误:[错误99]无法分配请求的地址 我认为问题是当插件被执行时,猜猜Jenkins正在运行,而不是。 FROM foxylion/jenkins MAINTAINER Mishel Uchuari <dmuchuari@hotmail.com> RUN /usr/local/bin/install-plugins.sh workflow-remote-loader workflow-aggregator build-pipeline-plugin ENV JENKINS_USER replicate ENV JENKINS_PASS replicate USER root RUN apt-get -y update && apt-get -y upgrade RUN apt-get install -y apt-utils RUN apt-get install -y python-pip RUN apt install -y linuxbrew-wrapper RUN useradd someuser -m -s /bin/bash USER someuser RUN […]

基本图像导致通过Jenkinepipe道在我的泊坞窗文件caching半身像

我在随机时间观察caching半身像时,由于我的基本Python图像,当我通过生产服务器上的Jenkins构build,而不是在本地机器上,这有点奇怪。 这种破坏发生在随机的时间,并不总是。 我还没有find一个模式。 docker文件的前几个命令: FROM python:2.7 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install –assume-yes apt-utils RUN apt-get update && apt-get install -y curl RUN apt-get update && apt-get install -y unzip 生成过程(内部版本号:74)的日志没有caching破坏: 17:11:02 [workspace] Running shell script 17:11:02 + docker build -t ourapi:0.5.3 . 17:11:02 Sending build context […]

如何在Cloudbees Pipeline中保存Docker卷以防失败

我在一个由Jenkins-Pipeline-Stage(Cloudbees-plugin)启动的Docker-Container中运行一组APItesting。 如果舞台(见下文)失败,我想保存testing日志。 我试图在后期采取后续操作,但之后我无法再访问该映像。 你将如何解决这个问题? 如何在失败的情况下保存图像? stage('build Dockerimage and run API-tests') { steps{ script { def apitestimage = docker.build('apitestimage', '–no-cache=true dockerbuild') apitestimage.inside('-p 5800:5800') { dir('testing'){ sh 'ctest -V' } } sh 'docker rmi –force apitestimage' } } }

我怎样才能在Jenkins(Pipeline)中为我的dockercontainer指定开始脚本?

我已经configuration了我的Jenkins在Docker容器中运行我们的构build作业和functiontesting。 例如,当我点击“Build Now”button时 – Jenkins将构buildGit中的Dockerfile并运行该容器,以便在此容器中完成Buildsteps(Jenkinsfile)。 我现在的问题是:如何在Jenkins-Pipeline中为我的Container指定开始脚本? 感谢您的任何提示。

使用Jenkins Blue Ocean部署构build

我最近使用Docker和Jenkinsbuild立了我自己的小型CI / CD设置。 我已经为Jenkins安装了新的Blue Ocean插件,并build立了一个pipe道:从Git拉 – >运行testing – >构build。 这是完美的。 但是,我一直无法find如何在stream水线中创build适当的部署/发布步骤。 构build完成后,我想让Jenkins容器通过SSH连接到运行所有Docker容器的VPS,然后重新构build特定容器(使用Docker Compose)。 我注意到在蓝海有一个选项,可以inputtesting/编译后运行的bash脚本 – 这是我应该使用的吗? 我一直在寻找使用通过SSH发布插件为jenkins,但我一直没有能够find这个插件是否与蓝色海洋,我也没有能够find如何创build使用jenkins容器的SSH密钥。 我非常感谢任何有关如何发布/构build更新的容器的见解/build议。

处理docker和Jenkins中的大型二进制文件(3 GB)

我在我的docker文件中使用谷歌模型(二进制文件:大约3GB),然后使用jenkins生成和部署在生产服务器上。 其余的代码是从bitbucket回购。 从docker文件中下载并解压文件的示例行。 它只会发生一次,因为这个命令将被caching。 FROM python:2.7.13-onbuild RUN mkdir -p /usr/src/app WORKDIR /usr/src/app ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install –assume-yes apt-utils RUN apt-get update && apt-get install -y curl RUN apt-get update && apt-get install -y unzip RUN curl -o – https://s3.amazonaws.com/dl4j-distribution/GoogleNews-vectors-negative300.bin.gz \ | gunzip > /usr/src/app/GoogleNews-vectors-negative300.bin 当我在本地机器上构build并运行Docker时,一切正常。 但是,当我通过修补版本将这些更改通过Jenkins推送到生产服务器时,我的构build过程最终失败。 设置,构build和testing阶段工作正常。 但是,构build后阶段失败。 (构build过程推动更改回购,并根据日志,在docker文件中的所有命令也运行良好。)之后发生的事情,当我看到日志时,我得到以下错误。 18:49:27 654f45ecb7e3: […]