作为上一个问题的继续,我可以摆脱Node(node is not a kubernetes node)的错误,但是我想设置代理以便从外部为我的Maven项目下载内容。
有人可以帮我设置吗?
Jenkinsfile:
pipeline {
agent {
kubernetes {
cloud 'openshift'
label 'jagathespike'
yamlFile 'jenkins/BuildPod.yaml'
}
}
stages {
stage('*****Maven Compile*****') {
steps {
container('oc-dev') {
sh 'mvn compile -DproxyHost=$(HTTP_PROXY_HOST) -DproxyPort=$(HTTP_PROXY_PORT)'
}
}
}
stage('*****Maven Test*****') {
steps {
container('oc-dev') {
sh 'mvn test'
}
}
}
stage('*****Maven Package*****') {
steps {
container('oc-dev') {
sh 'mvn package'
}
}
}
}
}
BuildPod.yaml:
kind: Pod
apiVersion: v1
metadata:
name: Agathe-Build
labels:
app: jagathespike
spec:
containers:
- env:
- name: "HTTP_PROXY"
value: "my-url"
- name: jnlp
image: openshift/jenkins-slave-base-centos7:latest
tty: true
envFrom:
- configMapRef:
name: jenkins-config
- name: oc-dev
image: maven:latest
envFrom:
- configMapRef:
name: jenkins-config
tty: true
command:
- cat