get the variable from ingress file and copy on the jenkins file

1/30/2020

I am looking to display the hostname of the application on the Jenkins file. So we don't need in every time to go search for the ingress file to know what is it the hostname knowing that the hostname is dynamically created at runtime.

This is my ingress.yaml file (only the part that I interested to):

spec:
  rules:
{{- range .Values.ingress.hosts}}

and this is my values.yaml file:

ingress:
  enabled: false
  annotations:
    kubernetes.io/ingress.class: nginx-int
    <%_ if (platformDeployment === AZURE_PLATFORM ) { _%>
    ingress.host.com/dns-managed: "True"
    <%_ } _%>
    <%_ if(hasOauth2Project) { _%>
    nginx.ingress.kubernetes.io/affinity: cookie
    nginx.ingress.kubernetes.io/session-cookie-name: INGRESSCOOKIE
    <%_ } _%>
    nginx.ingress.kubernetes.io/proxy-body-size: 10m
  hosts:
    name:
    <%_ if (platformDeployment === GCP_PLATFORM ) { _%>
    - <%= shortName %>-<%= environment %>.<%= _getEnvironnement(environment, platformDeployment) %>.<%= _getVpodNameFroGCPEnvironnement(environment) %>.host.com
    <%_ } _%>
    <%_ if (platformDeployment === AZURE_PLATFORM ) { _%>
    - <%= shortName %>-<%= environment %>-<%= _getEnvironnement(environment, platformDeployment) %>.vpod1.host.com
    <%_ } _%>
    #secretName: <%= shortName %>-tls-secret

What I want is to get the variable from ingress file and copy on the jenkins file:

currentBuild.description = "URL : <a href='.Values.ingress.hosts'>https:hostName.com</a>"

Have you any ideas how can I achieve that ?

-- Hamdy
jenkins
jenkins-pipeline
kubernetes
kubernetes-helm
kubernetes-ingress

0 Answers