Kubernetes plugin to provide option to overwrite hostname in podtemplate

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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' } }

        }

            Assignee:
            Unassigned
            Reporter:
            NOOR MOHAMED NAINAMOHAMED
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: