我们在jenkins中配置了两个Kubernetes云
pipeline {
agent {
kubernetes {
cloud 'apps-dev'
yamlFile '''
apiVersion: v1
kind: Pod
metadata:
labels:
jenkins/label: jenkins-apps-dev-agent
namespace: jenkins-jobs
containers:
- name: mavenjdk11
image: maven:3.8.2-adoptopenjdk-11
resources:
limits:
memory: "512Mi"
cpu: "500m"
requests:
memory: "256Mi"
cpu: "100m"
command:
- sleep
args:
- 99d
volumes:
- name: sharedvolume
emptyDir: {}
'''
}
}
...
Created Pod: foo jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][LoggingEnabled] Successfully enabled logging for pod
Still waiting to schedule task
‘foo-foo-integration-foo-feature-tests-17-m-4hhpq’ is offline
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][Scheduled] Successfully assigned jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq to fargate-ip-176-24-3-48.ec2.internal
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][Pulling] Pulling image "jenkins/inbound-agent:4.3-4"
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][TaintManagerEviction] Cancelling deletion of Pod jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][Pulled] Successfully pulled image "jenkins/inbound-agent:4.3-4" in 15.29095263s
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][Created] Created container jnlp
[Normal][jenkins-jobs/foo-foo-integration-foo-feature-tests-17-m-4hhpq][Started] Started container jnlp
Agent foo-foo-integration-foo-feature-tests-17-m-4hhpq is provisioned from template foo_foo-integration_foo-feature-tests_17-mnscq-lz8wj
---
apiVersion: "v1"
kind: "Pod"
metadata:
annotations:
buildUrl: "https://jenkins.cloud.bar.com/job/foo/job/foo-integration/job/foo-feature-tests/17/"
runUrl: "job/foo/job/foo-integration/job/foo-feature-tests/17/"
labels:
jenkins/label-digest: "baf69ff51703705e7e8252b6f5a54fc663dae21d"
jenkins/label: "foo_foo-integration_foo-feature-tests_17-mnscq"
name: "foo-foo-integration-foo-feature-tests-17-m-4hhpq"
spec:
containers:
- env:
- name: "JENKINS_SECRET"
value: "********"
- name: "JENKINS_AGENT_NAME"
value: "foo-foo-integration-foo-feature-tests-17-m-4hhpq"
- name: "JENKINS_WEB_SOCKET"
value: "true"
- name: "JENKINS_NAME"
value: "foo-foo-integration-foo-feature-tests-17-m-4hhpq"
- name: "JENKINS_AGENT_WORKDIR"
value: "/home/jenkins/agent"
- name: "JENKINS_URL"
value: "https://jenkins.cloud.bar.com/"
image: "jenkins/inbound-agent:4.3-4"
name: "jnlp"
resources:
limits: {}
requests:
memory: "256Mi"
cpu: "100m"
volumeMounts:
- mountPath: "/home/jenkins/agent"
name: "workspace-volume"
readOnly: false
nodeSelector:
kubernetes.io/os: "linux"
restartPolicy: "Never"
volumes:
- emptyDir:
medium: ""
name: "workspace-volume"
我的yaml中有一个错误,应该是
apiVersion: v1
kind: Pod
metadata:
labels:
jenkins/label: jenkins-apps-dev-agent
namespace: jenkins-jobs
spec:
containers:
- name: mavenjdk11
image: maven:3.8.2-adoptopenjdk-11
resources:
limits:
memory: "512Mi"
cpu: "500m"
requests:
memory: "256Mi"
cpu: "100m"
command:
- sleep
args:
- 99d
volumes:
- name: sharedvolume
emptyDir: {}
缺少容器之前的规范:
我想通过JobDSL生成基于管道插件的作业,该作业包含在Jenkins签出的git存储库中。 然而,我认为在作业DSL脚本中使用引用字符串的管道脚本不是很好。因此,我想将它们读入一个字符串,并将其传递给函数: 我必须把放在哪里才能工作?我试着把它放在我的DSL脚本旁边,也放在我的DSL源代码的文件夹中。但是Jenkins总是抛出一个“未找到文件”。
错误: 棱角版本:
使装饰器包含具有name属性的管道元数据。 此值将用于在模板表达式中调用此管道。 它必须是有效的JavaScript标识符。 实现PipeTransform接口的transform方法。 此方法接受管道的值和任何类型的可变数量的参数,并返回一个变换的(“管道”)值。 import { Component } from '@angular/core'; selector: 'app-root',
我正在编写一个Groovy脚本,其中包含部署terraform的作业。我正在使用作业DSL并使种子作业由JCasC实现,一切正常。然后我有一个包含作业的Groovy文件的存储库。 如果我将Groovy文件保持为单个作业,它就可以正常工作。 然而,我希望能够构建具有构建阶段的管道。我知道我可以把管道写在詹金斯文件中 我有这个作为开始: 但是,我看到了这个错误: 我已经尝试了各种方法,并阅读了一堆文档
我试图从流水线步骤中运行一个job-dsl脚本。一般来说,这应该是可能的,正如这里所描述的,在管道步骤中添加了以下代码片段: null 我如何知道脚本的真实位置,以及如何指定一个jobDsl作为目标,它本身位于不同的repo中?还是我完全走错了方向? 编辑 经过进一步的研究,共享库存储库被签出到“真实”工作区旁边的一个目录中,后缀为@libs,这似乎是事实。所以我认为使用以下方法是个好主意: 与此
我有一个简单的Jenkinsfile,我想在其中从工作区加载一些数据。我正在使用管道插件来利用存储库中的Jenkinsfile。构建被外包给匹配的Jenkins代理。当我尝试使用“readFile”时,我收到以下消息: Java语言io。FileNotFoundException:/path/to/jenkins/workspace/XXXXX/project/data。json(无此类文件或目录