How to set corporate proxy for maven build in OpenShift Container Platform 4 Pipelines

Solution Verified - Updated -

Issue

  • We defined a Tekton Task as following to use our proxy when accessing the maven repositories, but it does not seem to honor the proxy. Can you help us understand how it's done?
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: foo-maven
spec:
  workspaces:
    - name: maven-repo
  inputs:
    params:
      - name: GOALS
        description: The Maven goals to run
        type: array
        default: ["package -Dhttps.proxyHost=proxy.example.com -Dhttp.proxyHost=proxy.example.com -Dhttp.proxyPort=8023 -Dhttp.nonProxyHosts=localhost|127.0.0.1|*.example.com"]
      - name: PROXY_HOST
        default: "proxy.example.com"
      - name: PROXY_PORT
        default: "8023"
      - name: PROXY_PROTOCOL
        default: "http"
      - name: NON_PROXY_HOST
        default: "localhost,127.0.0.1,.example.com"
    resources:
      - name: source
        type: git
  stepTemplate:
    env:
      - name: "HTTPS_PROXY"
        value: "http://proxy.example.com:10465"
      - name: "HTTP_PROXY"
        value: "http://proxy.example.com:10465"
      - name: "NO_PROXY"
        value: "localhost,127.0.0.1,.example.com"
  steps:
    - name: mvn
      image: registry.example.com/test/mvn
      workingDir: /workspace/source
      command: ["/usr/bin/mvn"]
      args:
        - -Dmaven.repo.local=$(workspaces.maven-repo.path)
        - "$(inputs.params.GOALS)"

Environment

  • Red Hat OpenShift Container Platform 4
  • OpenShift Pipelines

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In