Uploaded image for project: 'OpenShift BuildConfig'
  1. OpenShift BuildConfig
  2. OCPBUILD-119

Support valueFrom syntax for pipeline build env vars [techdebt]

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Won't Do
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • 5

      Pipeline Build env vars should support the standard k8s pod syntax of allowing "valueFrom" in addition to "value", where "valueFrom" uses the downward api to reference existing env variables or jsonpath references to the build object.

      here's the syntax that needs to be supported:

      ```
      RESOURCE: valueFrom <Object>

      DESCRIPTION:
      Source for the environment variable's value. Cannot be used if value is not
      empty.

      EnvVarSource represents a source for the value of an EnvVar.

      FIELDS:
      configMapKeyRef <Object>
      Selects a key of a ConfigMap.

      fieldRef <Object>
      Selects a field of the pod: supports metadata.name, metadata.namespace,
      metadata.labels, metadata.annotations, spec.nodeName,
      spec.serviceAccountName, status.podIP.

      resourceFieldRef <Object>
      Selects a resource of the container: only resources limits and requests
      (limits.cpu, limits.memory, requests.cpu and requests.memory) are currently
      supported.

      secretKeyRef <Object>
      Selects a key of a secret in the pod's namespace
      ```

      (Obviously the list of fields that fieldRef can reference will need to be modified to align with fields that exist in a Build object)

      We should also support $() substitution in the "value" field of an envvar:

      ```
      FIELD: value <string>

      DESCRIPTION:
      Variable references $(VAR_NAME) are expanded using the previous defined
      environment variables in the container and any service environment
      variables. If a variable cannot be resolved, the reference in the input
      string will be unchanged. The $(VAR_NAME) syntax can be escaped with a
      double $$, ie: $$(VAR_NAME). Escaped references will never be expanded,
      regardless of whether the variable exists or not. Defaults to "".

      ```
      This card is a follow on from https://trello.com/c/lDxfG8GO, which added this support to the other build strategies. This one will be different since the implementation will be in the sync plugin java code, rather than in the build controller Go code.

      *Related RFE*

      *References*

            Unassigned Unassigned
            openshift_jira_bot OpenShift Jira Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: