-
Bug
-
Resolution: Cannot Reproduce
-
Major
-
None
-
Jenkins ver. 2.60.3
Kubernetes plugin - 1.8.4
if hostname is a added to the specs, container shell couldn't locate the hostname. Since jenkins slave sets pod name as hostname. Keeping both same as same. Is there a way to overwrite only hostname within a podname. Kubernetes support it where podname and hostname can be different. usecase is to have different podname and hostname. Trying to keep hostname as consistent for a build activity trying to avoid rebuild as build records hostname information in its objects.
Detail of the podtemplate used
------------
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(name: "myname", label: label, defaultContainer: "busybox", namespace: "noormohamed", yaml: """
apiVersion: v1
kind: Pod
metadata:
labels:
label: build
spec:
hostname: myhostname
containers:
- name: maven
image: maven:alpine
command: - cat
tty: true - name: busybox
image: busybox
command: - cat
tty: true
"""
) {
node (label)Unknown macro: { container('maven') { sh 'hostname' sh 'mvn -version' } container('busybox') { sh 'hostname' sh '/bin/busybox' } }}